<!--

this_page_currYr="";
this_page_currMnth="";
this_page_currDay="";

idsezione = "";


function setIdSezione(id){
idsezione = id;
}

function setIdSito(idsito){
idsezione = idsezione + "&idsito="+idsito;
}

function setQuotidiani(){
idsezione = idsezione + "&tipo=quotidiani";
}


function setDate(x,str) {
//alert("setDate "+x);
temp="calendar_"+x;
//alert(temp);

 if (str == "   ") {
  return;
 }

 mnth1 = document.getElementById(temp+"_month").value;
 mnth = mnth1;
 mnth++;
 year = document.getElementById(temp+"_year").value;

if(mnth<10){mnth=0+""+mnth;}
if(str<10){str=0+""+str;}
 dateStr = year+""+mnth+""+str;

dateStr = trim(dateStr);
 
window.location = "?idsezione="+idsezione+"&data="+dateStr;

 //document.getElementById("dateField_"+x).value = dateStr;


}//setDate()

/**
 * The function removes spaces from the selected date.
 */

function trim(str) {

 res="";

 for(var i=0; i< str.length; i++) {
   if (str.charAt(i) != " ") {
     res +=str.charAt(i);
  }
 }

 return res;

}//trim()

/**
 * The method to get the Month name given the Month number of the year.
 */

function getMonthName(mnth) {

 if (mnth == 0) {
  name = "Gennaio";
 }else if(mnth==1) {
  name = "Febbraio";
 }else if(mnth==2) {
  name = "Marzo";
 }else if(mnth==3) {
  name = "Aprile";
 }else if(mnth==4) {
  name = "Maggio";
 } else if(mnth==5) {
  name = "Giugno";
 } else if(mnth==6) {
  name = "Luglio";
 } else if(mnth==7) {
  name = "Agosto";
 } else if(mnth==8) {
  name = "Settembre";
 } else if(mnth==9) {
  name = "Ottobre";
 } else if(mnth==10) {
  name = "Novembre";
 } else if(mnth==11) {
  name = "Dicembre";
 }

 return name;

}//getMonthName()

/**
 * Get the number of days in the month based on the year.
 */

function getNoOfDaysInMnth(mnth,yr) {

 rem = yr % 4;

 if(rem ==0) {
   leap = 1;
 } else {
  leap = 0;
 }

 noDays=0;

 if ( (mnth == 1) || (mnth == 3) || (mnth == 5) ||
      (mnth == 7) || (mnth == 8) || (mnth == 10) ||
      (mnth == 12)) {
  noDays=31;
 } else if (mnth == 2) {
           noDays=28+leap;
        } else {
           noDays=30;
 }

 ////alert(noDays);
 return noDays;


}//getNoOfDaysInMnth()

/**
 * The function to reset the date values in the buttons of the
 * slots.
 */

function fillDates(x,dayOfWeek1,noOfDaysInmnth) {
//alert("fillDates "+x);
temp="calendar_"+x;
//alert(temp);

  dt = new Date();
  mnth  = dt.getMonth(); /* 0-11*/
  dayOfMnth = dt.getDate(); /* 1-31*/
  dayOfWeek = dt.getDay(); /*0-6*/
  yr = dt.getFullYear(); /*4-digit year*/

    
  currMnth=document.getElementById(temp+"_month").value;
  currYr=document.getElementById(temp+"_year").value;
  
 for(var i=1; i<43; i++) {
   str = "s"+i;
   document.getElementById(temp+"_"+str).innerHTML="   ";
   document.getElementById(temp+"_"+str).className = "text_button_empty";  
 }


 startSlotIndx = dayOfWeek1;
 slotIndx = startSlotIndx;

  if(slotIndx==1){
	startDay=6;
  }
  else{
   startDay=-1;
  }
 

 for(var i=1; i<(noOfDaysInmnth+1); i++) {
 

  slotName = "s"+(slotIndx);

  
  slotName = "s"+(slotIndx+startDay);




  val="";
  if (i<10) {
    val = " "+i+" ";
  } else {
    val = i;
  }

  document.getElementById(temp+"_"+slotName).innerHTML = val;
  document.getElementById(temp+"_"+slotName).className = "text_button";
if(x!=2){
  if(i==dayOfMnth && currMnth==mnth && currYr==yr){   document.getElementById(temp+"_"+slotName).className = "text_button_today"; }}

else{
  if(i==this_page_currDay && currMnth==this_page_currMnth && currYr==this_page_currYr){   document.getElementById(temp+"_"+slotName).className = "text_button_today"; }

}
  
  slotIndx++;
 }

}//fillDates()


/**
 * The function that is called at the time of loading the page.
 * This function displays Today s date and also displays the
 * the calendar of the current month.
 */


function thisMonth(x) {
//alert("thisMonth "+x);
temp="calendar_"+x;
//alert(temp);

  dt = new Date();
  mnth  = dt.getMonth(); /* 0-11*/
  dayOfMnth = dt.getDate(); /* 1-31*/
  dayOfWeek = dt.getDay(); /*0-6*/
  yr = dt.getFullYear(); /*4-digit year*/

  ////alert("month:"+(mnth+1)+":dayofMnth:"+dayOfMnth+":dayofweek:"+dayOfWeek+":year:"+yr);

  mnthName = getMonthName(mnth)+ " ";
  document.getElementById(temp+"_month").value = mnth;
  document.getElementById(temp+"_year").value = yr;
  document.getElementById(temp+"_currMonth").value = mnth;
  document.getElementById(temp+"_currYear").value = yr;

//  document.getElementById(temp+"_monthDisplay").value = mnthName;
 // document.getElementById(temp+"_yearDisplay").value = yr;
  document.getElementById("dateField_"+x).value = (mnth+1)+"/"+dayOfMnth+"/"+yr;

  startStr = (mnth+1)+"/1/"+yr;
  dt1 = new Date(startStr);
  dayOfWeek1 = dt1.getDay(); /*0-6*/

  //noOfDaysInMnth = getNoOfDaysInMnth(mnth+1,yr);¨
  
  noOfDaysInMnth = dayOfMnth;
  
  fillDates(x,dayOfWeek1+1,noOfDaysInMnth);


}//thisMonth()

/**
 * The function that will be used to display the calendar of the next month.
 */
 

function thisDate(x,new_date){
//alert("prevMonth "+x);
temp="calendar_"+x;
//alert(temp);

new_date=parseInt(new_date);
currYr=Math.floor(new_date/10000);
currMnth=Math.floor((new_date-currYr*10000)/100);
currMnth=currMnth - 1;
currDay=Math.floor(new_date-currYr*10000-(currMnth+1)*100);

this_page_currYr=currYr;
this_page_currMnth=currMnth;
this_page_currDay=currDay - 1 + 1;

// var currMnth = document.getElementById(temp+"_month_select").value;
// var currYr	=  document.getElementById(temp+"_year").value;
 
  dt = new Date();
  mnth  = dt.getMonth(); /* 0-11*/
  dayOfMnth = dt.getDate(); /* 1-31*/
  dayOfWeek = dt.getDay(); /*0-6*/
  yr = dt.getFullYear(); /*4-digit year*/
 
if(currYr==2009 && currMnth < 8){ 
var monthList = document.getElementById(temp+"_month_select"); 
var curMonthOption = monthList[""+8];
curMonthOption.selected = true;
currMnth=8;
}
if(currYr==yr && currMnth > mnth){  
var monthList = document.getElementById(temp+"_month_select");
var curMonthOption = monthList[""+mnth];
curMonthOption.selected = true;
currMnth=mnth;
}
 

  
 str = (currMnth+1)+"/1/"+currYr;
 dt = new Date(str);
 dayOfWeek = dt.getDay();


 mnthName = getMonthName(currMnth);
 document.getElementById(temp+"_month").value=currMnth;
 document.getElementById(temp+"_year").value=currYr;

 //document.getElementById(temp+"_monthDisplay").value= mnthName;
 //document.getElementById(temp+"_yearDisplay").value= currYr;

 if(currYr==yr && currMnth==mnth){ noOfDays = dayOfMnth;}
 else{ noOfDays = getNoOfDaysInMnth(currMnth+1,currYr); }


 fillDates(x,dayOfWeek+1,noOfDays);


} 

function nextMonth(x) {
//alert("nextMonth "+x);
temp="calendar_"+x;
//alert(temp);

  dt = new Date();
  mnth  = dt.getMonth(); /* 0-11*/
  dayOfMnth = dt.getDate(); /* 1-31*/
  dayOfWeek = dt.getDay(); /*0-6*/
  yr = dt.getFullYear(); /*4-digit year*/
 



 var currMnth = document.getElementById(temp+"_month").value;
 currYr = document.getElementById(temp+"_year").value;
 if(currYr==yr && currMnth==mnth){ }
 else{
 
 if (currMnth == "11") {
    nextMnth = 0;
    nextYr = currYr;
    nextYr++;
 } else {
   nextMnth=currMnth;
   nextMnth++;
   nextYr = currYr;
 }

 mnthName = getMonthName(nextMnth);
 document.getElementById(temp+"_month").value=nextMnth;
 document.getElementById(temp+"_year").value=nextYr;
 //document.getElementById(temp+"_monthDisplay").value= mnthName;
// document.getElementById(temp+"_yearDisplay").value= nextYr;
 
 str = (nextMnth+1)+"/1/"+nextYr;
 dt = new Date(str);
 dayOfWeek = dt.getDay();

 if(nextYr==yr && nextMnth==mnth){ noOfDays = dayOfMnth;}
 else{ noOfDays = getNoOfDaysInMnth(nextMnth+1,nextYr); }

 fillDates(x,dayOfWeek+1,noOfDays);

}
}



/**
 * The method to display the calendar of the previous month.
 */

function prevMonth(x) {
//alert("prevMonth "+x);
temp="calendar_"+x;
//alert(temp);

 var currMnth = document.getElementById(temp+"_month").value;
 currYr = document.getElementById(temp+"_year").value;

  if(currYr==2009 && currMnth == "8"){}
 else{
 
 if (currMnth == "0") {
    prevMnth = 11;
    prevYr = currYr;
    prevYr--;
 } else {
   prevMnth=currMnth;
   prevMnth--;
   prevYr = currYr;
 }

 str = (prevMnth+1)+"/1/"+prevYr;
 dt = new Date(str);
 dayOfWeek = dt.getDay();

 /***********************************************
  * Remove the comment if do not want the user to
  * go to any previous month than this current month.
  ***********************************************/

 /*

 runningMonth = document.getElementById(temp).currMonth.value;
 rMonth=runningMonth;
 rMonth++;
 runningYear = document.getElementById(temp).currYear.value;
 rYear=runningYear;

 str = (rMonth)+"/1/"+rYear;
 dt1 = new Date(str);

 if (dt.valueOf() < dt1.valueOf()) {
   //alert('Cannot Go Before Current Month');
   return;
 }

 */

 /**************************************************
 * End of comment
 **************************************************/

 mnthName = getMonthName(prevMnth);
 document.getElementById(temp+"_month").value=prevMnth;
 document.getElementById(temp+"_year").value=prevYr;
// document.getElementById(temp+"_monthDisplay").value= mnthName;
//document.getElementById(temp+"_yearDisplay").value= prevYr;
 
 noOfDays = getNoOfDaysInMnth(prevMnth+1,prevYr);
 fillDates(x,dayOfWeek+1,noOfDays);

 }
}//prevMonth()


function prevYear(x){
//alert("prevMonth "+x);
temp="calendar_"+x;
//alert(temp);


 var currMnth = document.getElementById(temp+"_month").value;
 currYr = document.getElementById(temp+"_year").value;
 if(currYr==2009){}
 else{
    prevYr = currYr;
    prevYr--;
    prevMnth=currMnth;


 str = (prevMnth+1)+"/1/"+prevYr;
 dt = new Date(str);
 dayOfWeek = dt.getDay();

 mnthName = getMonthName(prevMnth);
 document.getElementById(temp+"_month").value=prevMnth;
 document.getElementById(temp+"_year").value=prevYr;
 //document.getElementById(temp+"_monthDisplay").value= mnthName;
 //document.getElementById(temp+"_yearDisplay").value= prevYr;

 noOfDays = getNoOfDaysInMnth(prevMnth+1,prevYr);
 fillDates(x,dayOfWeek+1,noOfDays);
}
}

function nextYear(x){
//alert("nextYear "+x);
temp="calendar_"+x;
//alert(temp);




 var currMnth = document.getElementById(temp+"_month").value;
 currYr = document.getElementById(temp+"_year").value;
   
   
  dt = new Date();
  mnth  = dt.getMonth(); /* 0-11*/
  dayOfMnth = dt.getDate(); /* 1-31*/
  dayOfWeek = dt.getDay(); /*0-6*/
  yr = dt.getFullYear(); /*4-digit year*/
  
if(currYr==yr){ }
else{
    nextMnth=currMnth;
    nextYr = currYr;
    nextYr++;


 mnthName = getMonthName(nextMnth);
 document.getElementById(temp+"_month").value=nextMnth;
 document.getElementById(temp+"_year").value=nextYr;
 //document.getElementById(temp+"_monthDisplay").value= mnthName;
 //document.getElementById(temp+"_yearDisplay").value= nextYr;

 str = (nextMnth+1)+"/1/"+nextYr;
 dt = new Date(str);
 dayOfWeek = dt.getDay();

 if(nextYr==yr && nextMnth==mnth){ noOfDays = dayOfMnth;}
 else{ noOfDays = getNoOfDaysInMnth(nextMnth+1,nextYr); }

 fillDates(x,dayOfWeek+1,noOfDays);

}
}



function newMonth(x){
//alert("prevMonth "+x);
temp="calendar_"+x;
//alert(temp);


 var currMnth = document.getElementById(temp+"_month_select").value;
 currMnth=parseInt(currMnth);
 var currYr	=  document.getElementById(temp+"_year").value;
 
  dt = new Date();
  mnth  = dt.getMonth(); /* 0-11*/
  dayOfMnth = dt.getDate(); /* 1-31*/
  dayOfWeek = dt.getDay(); /*0-6*/
  yr = dt.getFullYear(); /*4-digit year*/
 
if(currYr==2009 && currMnth < 8){ 
var monthList = document.getElementById(temp+"_month_select"); 
var curMonthOption = monthList[""+8];
curMonthOption.selected = true;
currMnth=8;
}
if(currYr==yr && currMnth > mnth){  
var monthList = document.getElementById(temp+"_month_select");
var curMonthOption = monthList[""+mnth];
curMonthOption.selected = true;
currMnth=mnth;
}
 

  
 str = (currMnth+1)+"/1/"+currYr;
 dt = new Date(str);
 dayOfWeek = dt.getDay();
 mnthName = getMonthName(currMnth);
 document.getElementById(temp+"_month").value=currMnth;
 document.getElementById(temp+"_year").value=currYr;
 //document.getElementById(temp+"_monthDisplay").value= mnthName;
 //document.getElementById(temp+"_yearDisplay").value= currYr;

 if(currYr==yr && currMnth==mnth){ noOfDays = dayOfMnth;}
 else{ noOfDays = getNoOfDaysInMnth(currMnth+1,currYr); }

 fillDates(x,dayOfWeek+1,noOfDays);


}


function newYear(x){
//alert("prevMonth "+x);
temp="calendar_"+x;
//alert(temp);


 var currMnth = document.getElementById(temp+"_month").value;
 currMnth=parseInt(currMnth);
 var currYr	=  document.getElementById(temp+"_year_select").value;
 var oldstring = currYr
 var newstring = parseInt (currYr).toString();

 
//alert(currYr);
 
 if(newstring.length!=oldstring.length || newstring=="NaN" || newstring.length!=4){
   dt = new Date();
   yr = dt.getFullYear(); /*4-digit year*/
  
 currYr=yr;
 }
 
 if(currYr==2009 && currMnth < 8){ 
var monthList = document.getElementById(temp+"_month_select"); 
var curMonthOption = monthList[""+8];
curMonthOption.selected = true;
currMnth=8;
}
if(currYr==yr && currMnth > mnth){  
var monthList = document.getElementById(temp+"_month_select");
var curMonthOption = monthList[""+mnth];
curMonthOption.selected = true;
currMnth=mnth;
}
 
 
  dt = new Date();
  mnth  = dt.getMonth(); /* 0-11*/
  dayOfMnth = dt.getDate(); /* 1-31*/
  dayOfWeek = dt.getDay(); /*0-6*/
  yr = dt.getFullYear(); /*4-digit year*/
  
 str = (currMnth+1)+"/1/"+currYr;
 dt = new Date(str);
 dayOfWeek = dt.getDay();
 mnthName = getMonthName(currMnth);
 document.getElementById(temp+"_month").value=currMnth;
 document.getElementById(temp+"_year").value=currYr;
 //document.getElementById(temp+"_monthDisplay").value= mnthName;
 //document.getElementById(temp+"_yearDisplay").value= currYr;

 if(currYr==yr && currMnth==mnth){ noOfDays = dayOfMnth;}
 else{ noOfDays = getNoOfDaysInMnth(currMnth+1,currYr); }

 fillDates(x,dayOfWeek+1,noOfDays);

}


function writeCalendar(x,new_date){
  dt = new Date();
  mnth  = dt.getMonth(); /* 0-11*/
  dayOfMnth = dt.getDate(); /* 1-31*/
  dayOfWeek = dt.getDay(); /*0-6*/
  yr = dt.getFullYear(); /*4-digit year*/

currYr=yr;
currMnth=mnth;  

if(new_date+""!="undefined"){
new_date=parseInt(new_date);
currYr=Math.floor(new_date/10000);
currMnth=Math.floor((new_date-currYr*10000)/100);
currMnth=currMnth - 1;
}


//alert("writeCalendar "+x);
temp="calendar_"+x;
//alert(temp);

 mnth  = dt.getMonth(); /* 0-11*/
  dayOfMnth = dt.getDate(); /* 1-31*/
  dayOfWeek = dt.getDay(); /*0-6*/
  yr = dt.getFullYear(); /*4-digit year*/

 date_mnth = mnth;
 date_mnth++;
 date_year =  yr;
 date_day = dayOfMnth;
 
if(date_mnth<10){date_mnth=0+""+date_mnth;}
if(date_day<10){date_day=0+""+date_day;}
 dateStr = date_year+""+date_mnth+""+date_day;

dateStr = trim(dateStr);


document.writeln("<div id=\"calendar_div_"+x+"\" align=\"right\">");
document.writeln('<form>');
document.writeln('<!-- Hidden fields --->');
//alert("id=\"calendar_"+x+"_month\"");
document.writeln("<input type=hidden id=\"calendar_"+x+"_month\" name=\"calendar_"+x+"_month\">");

//alert("id=\"calendar_"+x+"_year\"");

document.writeln("<input type=hidden id=\"calendar_"+x+"_year\" name=\"calendar_"+x+"_year\">");
document.writeln("<input type=hidden id=\"calendar_"+x+"_currMonth\" name=\"calendar_"+x+"_currMonth\">");
document.writeln("<input type=hidden id=\"calendar_"+x+"_currYear\" name=\"calendar_"+x+"currYear\">");
document.writeln('<!-- End of Hidden fields --->');

//////OLD ARROW NEXT-PREV TEMPLATE/////////////
//document.writeln("<table cellpadding=\"0\" cellspacing=\"0\"><tr>");
//document.writeln("<td style=\"vertical-align: bottom;\"><img src=\"/img/calendar/arrow_up.gif\" style=\"border: 0px solid #FFFFFF; display: inline;\" onClick=\"nextMonth("+x+");\"></td>");
//document.writeln("<td rowspan=\"2\" style=\"vertical-align: center;\">&nbsp;<input type=\"text\" size=\"10\" id=\"calendar_"+x+"_monthDisplay\" name=\"calendar_"+x+"_monthDisplay\" class=\"input_calendario\">&nbsp;<input type=\"text\" size=\"4\" id=\"calendar_"+x+"_yearDisplay\" name=\"calendar_"+x+"_yearDisplay\" class=\"input_calendario\">&nbsp;</td>");
//document.writeln("<td style=\"vertical-align: bottom;\"> <img src=\"/img/calendar/arrow_up.gif\" style=\"border: 0px solid #FFFFFF;\" onClick=\"nextYear("+x+");\"></td>");
//document.writeln("</tr><tr>");
//document.writeln("<td style=\"vertical-align: top;\"><img src=\"/img/calendar/arrow_down.gif\" style=\"border: 0px solid #FFFFFF; display: inline;\" onClick=\"prevMonth("+x+");\"></td>");
//document.writeln("<td style=\"vertical-align: top;\"><img src=\"/img/calendar/arrow_down.gif\" style=\"border: 0px solid #FFFFFF;\" onClick=\"prevYear("+x+");\"></td>");
//document.writeln("</tr></table>");


//////NEW SELECT MONTH YEAR/////////////


 classtype="";

if(x==2){ classtype="_fixed"; }  

document.writeln("<table cellpadding=\"0\" cellspacing=\"0\"  class=\"table_calendar_select"+classtype+"\" style=\"border:1px solid #969696; border-bottom:none;\"><tr>"); 
document.writeln("<td style=\"padding-top:5px;padding-bottom:5px;\"><select name=\"calendar_"+x+"_month_select\" id=\"calendar_"+x+"_month_select\" onchange=\"newMonth("+x+")\" onblur=\"keepCalendar("+x+");\" class=\"InputForm\">");
month_selected="";
for(i=0;i<=11;i++){
mnthName = getMonthName(i);
if(i==currMnth){ month_selected="selected=\"selected\"";}
else{ month_selected="";}

document.writeln("<option value=\""+i+"\" "+month_selected+">"+mnthName+"</option>");
}
document.writeln("</select></td>");
document.writeln("<td><select name=\"calendar_"+x+"_year_select\" id=\"calendar_"+x+"_year_select\" onchange=\"newYear("+x+");\" onblur=\"keepCalendar("+x+");\" class=\"InputForm\">");
year_selected="";
for(i=2009;i<=yr;i++){
if(i==currYr){year_selected="selected=\"selected\"";}
else{year_selected="";}
document.writeln("<option value=\""+i+"\" "+year_selected+">"+i+"</option>");}
document.writeln("</select>&nbsp;&nbsp;<a href=\"?idsezione="+idsezione+"&data="+dateStr+"\" class=\"rubriche\" style=\"padding-right:3px;\">Oggi</a></td>"); 
document.writeln("</tr></table>");


document.writeln('<table aclass="calendar_table'+classtype+'" border="1" bordercolor="#969696" cellpadding="0" cellspacing="0" style="border-collapse:collapse;">');
document.writeln('<tr class="calendar_table_header">');
document.writeln('<td style="text-align: center;"><span class="small_text"><strong>LU</strong></span></td>');
document.writeln('<td style="text-align: center;"><span class="small_text"><strong>MA</strong></span></td>');
document.writeln('<td style="text-align: center;"><span class="small_text"><strong>ME</strong></span></td>');
document.writeln('<td style="text-align: center;"><span class="small_text"><strong>GIO</strong></span></td>');
document.writeln('<td style="text-align: center;"><span class="small_text"><strong>VE</strong></span></td>');
document.writeln('<td style="text-align: center;"><span class="small_text"><strong>SA</strong></span></td>');
document.writeln('<td style="text-align: center;"><span class="small_text"><strong>DO</strong></span></td>');
document.writeln('</tr><tr>');
for(i=1; i<=42; i++){ 

if(i<=30){tempvalue=" "+i+" ";}
else { tempvalue="   ";}

document.writeln("<td align=\"center\"><span class=\"text_button\" type=\"button\" id=\"calendar_"+x+"_s"+i+"\" name=\"calendar_"+x+"_s"+i+"\" onclick=\"setDate("+x+",this.firstChild.nodeValue);\" onmouseover=\"temp_old=this.className;if(this.className=='text_button_empty'){}else{this.className='text_button_hover';}\" onmouseout=\"this.className=temp_old;\">"+tempvalue+"</span></td>");
temp=i/7;
if(temp==1||temp==2||temp==3||temp==4||temp==5) {document.writeln('</tr><tr>');}
}


document.writeln('</tr></table>');


if(x!=2){
document.writeln('<span class="small_text" style="text-align: left; float: left; display: inline;"><a href="javascript:void(0)" onmouseover="document.getElementById(\'text_chiudi\').style.display = \'inline\'" onmouseout="document.getElementById(\'text_chiudi\').style.display = \'none\'" onclick="document.getElementById(\'hideField_'+x+'\').style.display=\'none\'" class="rubriche">(x)</a></span><span class="small_text" id="text_chiudi" style="float: left; display:none;"><a class="rubriche" onclick="document.getElementById(\'hideField_'+x+'\').style.display=\'none\'"  href="javascript:void(0)">chiudi</a></span>');
}
document.writeln('</form></div>');

 
}


//Show And Hide Calendar
calendarStatus= new Array();
var disable_hidden=false;
var enable_hidden_count=0;
var hideCalendarDalay_count=0;

function showCalendar(x){
//alert("showCalendar "+x);
calendarStatus[x]=true;

document.getElementById("hideField_"+x).style.display="inline";

}

function keepCalendar(x){
disable_hidden=true;
temp=x;
enable_hidden_count++;
setTimeout('enable_hidden(temp)',5000);
}

function hideCalendar(x){
//alert("hideCalendar "+x);
calendarStatus[x]=false;
temp=x;
if(disable_hidden==true){}
else{
hideCalendarDalay_count++;
setTimeout('hideCalendarDalay(temp)',500);

}

}

function hideCalendarDalay(x){
if(hideCalendarDalay_count>1){ hideCalendarDalay_count--; }
else{
if(calendarStatus[x]==false){document.getElementById("hideField_"+x).style.display="none"; hideCalendarDalay_count--;}
else{}
}
}

function enable_hidden(x){
disable_hidden=false;
if(enable_hidden_count>1){ enable_hidden_count--; }
else{
if(calendarStatus[x]==false){document.getElementById("hideField_"+x).style.display="none"; enable_hidden_count--;}
else{}
}
}




//-->