﻿var today = new Date();
var separator="-"; 
var inover=false;
//Default_day,Default_month,Default_year
var Default_day = today.getDate();       
var Default_month = today.getMonth() + 1;       
var Default_year = today.getFullYear();       
var Default_date = Default_year + "-" + Default_month + "-" + Default_day;       

function change_date(temp,mode,index)
{

	if(arguments.length==3)
		index=index=='2'?'2':'';
	else
		index='';
	change_double_date(temp,mode,index);
	if(sod=='2')
	{
		if(index=="2")
			{
				var tempdate=new Date(document.getElementById("cele_date_year2").value,parseInt(document.getElementById("cele_date_month2").value,10)-1,1);
				tempdate.setMonth(parseInt(tempdate.getMonth(),10)-1);
				document.getElementById("cele_date_year").value=tempdate.getFullYear().toString();
				document.getElementById("cele_date_month").value=(parseInt(tempdate.getMonth(),10)+1).toString();
				set_double_calendar(tempdate.getFullYear(),parseInt(tempdate.getMonth(),10)+1,'');
			}
		if(index=="")
		{
				var tempdate=new Date(document.getElementById("cele_date_year").value,parseInt(document.getElementById("cele_date_month").value,10)-1,1);
				tempdate.setMonth(parseInt(tempdate.getMonth(),10)+1);
				
				document.getElementById("cele_date_year2").value=tempdate.getFullYear().toString();
				document.getElementById("cele_date_month2").value=(parseInt(tempdate.getMonth(),10)+1).toString();
				set_double_calendar(tempdate.getFullYear(),parseInt(tempdate.getMonth(),10)+1,'2');
		}
	}
	display_btn_prvnxt();
 
}
function change_double_date(temp,mode,index)
{
	var t_month,t_year;
	var monthobj,yearobj,monthobj2,yearobj2;
		monthobj=document.getElementById("cele_date_month"+index);
		yearobj=document.getElementById("cele_date_year"+index);
		var start=date_start;
		var end=date_end;
		if(index=='2')
		{
			var date_start2=new Date(date_start.getFullYear(),date_start.getMonth(),date_start.getDate());
			date_start2.setMonth(eval(parseInt(date_start.getMonth(),10)+1));
			var date_end2=new Date(date_end.getFullYear(),date_end.getMonth(),date_end.getDate());;
			date_end2.setMonth(eval(parseInt(date_end.getMonth()) + 1));
			start=date_start2;
			end=date_end2;
		}
	
	if (mode){
        if(mode==1)
      	  t_month=parseInt(monthobj.value,10)+parseInt(temp,10);
		else
       	 t_month=parseInt(temp,10);
			
		if (t_month<monthobj.options[0].innerHTML) {
			resetMonthSelect(parseInt(yearobj.value,10)-1,index);
            monthobj.value=monthobj.options[monthobj.length-1].innerHTML;
	        change_double_date(parseInt(yearobj.value,10)-1,0,index);
            }
        else{
            if (t_month>monthobj.options[monthobj.length-1].innerHTML)
			{
				resetMonthSelect(parseInt(yearobj.value,10)+1,index);
                monthobj.value=monthobj.options[0].innerHTML;
            	change_double_date(parseInt(yearobj.value,10)+1,0,index);
                }            
            else
                {monthobj.value=t_month;
                 set_double_calendar(yearobj.value,monthobj.value,index);                
                }
        }
    }  
    else{
        t_year=parseInt(temp,10);
        
        if (t_year<yearobj.options[0].innerHTML) {
            yearobj.value=yearobj.options[0].innerHTML;
			set_double_calendar(yearobj.value,start.getMonth(),index);                
            }
        else{
            if (parseInt(t_year,10)>parseInt(yearobj.options[yearobj.length-1].innerHTML,10)){
                yearobj.value=yearobj.options[yearobj.length-1].innerHTML;
                set_double_calendar(yearobj.value,end.getMonth(),index);                
                }            
            else
                {yearobj.value=t_year;
				
				if(date_start.getFullYear()==parseInt(t_year,10)&&date_start.getMonth()>eval(monthobj.value-1))
					set_double_calendar(yearobj.value,eval(start.getMonth()+1),index);
				else if(date_end.getFullYear()==parseInt(t_year,10)&&date_end.getMonth()<eval(monthobj.value-1))
				 	set_double_calendar(yearobj.value,eval(end.getMonth()+1),index);
				else
                 set_double_calendar(yearobj.value,monthobj.value,index);     
				
                }
        }
    }

}

function display_btn_prvnxt()
{
		monthobj=document.getElementById("cele_date_month");
		yearobj=document.getElementById("cele_date_year");
		if(yearobj.value==date_end.getFullYear()&&parseInt(monthobj.value,10)>parseInt(date_end.getMonth(),10))
			document.getElementById("btn_nxt").style.display="none";
		else
			document.getElementById("btn_nxt").style.display="block";
		if(yearobj.value==date_start.getFullYear()&&parseInt(monthobj.value,10)<parseInt(date_start.getMonth(),10)+2)
			document.getElementById("btn_prv").style.display="none";
		else
			document.getElementById("btn_prv").style.display="block";
	 document.getElementById("msgDiv").focus();
	
}
function init(d_start,d_end,sord)
{
	var curday=today.getFullYear()+"-"+eval(today.getMonth()+1)+"-"+today.getDate();
     var temp_str="";
     var i=0
     var j=0
	 var minYear,maxYear;
     date_start=new Date(1980,7,1)
     date_end=new Date(2020,8,1)
	 minYear=d_start!="" ? parseInt((d_start.split(separator))[0],10):date_start.getFullYear();
	 maxYear=d_end!="" ? parseInt((d_end.split(separator))[0],10):date_end.getFullYear();
     temp_str+="";
	 var temp_top="";
	 var str_btn_prv="<span id=\"btn_prv\" style=\"display:none\">"
		 str_btn_prv+="<A  style=\"CURSOR: pointer\" onclick=\"change_date(-1,1)\" onmouseover=\"getlayerfocus()\">";
		 str_btn_prv+=" <IMG  src=\"/Utility/CalendarUtility/img/prev.gif\"  border=0></A></span>"
	 var str_btn_nxt="<span id=\"btn_nxt\" style=\"display:none\"><CITE><A  style=\"CURSOR: pointer\" ";
		 str_btn_nxt+="onclick=\"change_date(1,1)\" onmouseover=\"getlayerfocus()\" >";
		 str_btn_nxt+="<IMG   src=\"/Utility/CalendarUtility/img/next.gif\"  ";
		 str_btn_nxt+="border=0><\/A><\/CITE></span>";
	 var Year_Select1_NameId=" name=\"cele_date_year\" id=\"cele_date_year\" onchange=\"change_date(this.value,0,'')\"";
	 var Year_Select2_NameId=" name=\"cele_date_year2\" id=\"cele_date_year2\" onchange=\"change_date(this.value,0,'2')\"";
	 var Month_Select1_NameId=" name=\"cele_date_month\" id=\"cele_date_month\" onchange=\"change_date(this.value,2,'')\"";
	 var Month_Select2_NameId=" name=\"cele_date_month2\" id=\"cele_date_month2\" onchange=\"change_date(this.value,2,'2')\"";
	 var Date_Day_td1="";
	 var Date_Day_td2="";
	 for (i=1 ;i<=6 ;i++)
     {
     Date_Day_td1+="<tr>";
	 Date_Day_td2+="<tr>";
        for(j=1;j<=7;j++){
            Date_Day_td1+="<td name=\"c"+i+"_"+j+"\" id=\"c"+i+"_"+j+"\" style=\"cursor: pointer\" class=\"can1\"  onclick=\"td_click(this,'')\">-</td>";
			Date_Day_td2+="<td name=\"c"+i+"_"+j+"2\" id=\"c"+i+"_"+j+"2\" style=\"cursor: pointer\" class=\"can1\"  onclick=\"td_click(this,'2')\">-</td>"
            }
     Date_Day_td1+="</tr>";
	 Date_Day_td2+="</tr>";  
     }
		
	 
	 temp_top+="      <TABLE  cellSpacing=0 cellPadding=0 style=\"width:100%;background:#ff6600;text-align:center\"  border=0>";
	 temp_top+="        <TBODY>";
     temp_top+="        <TR >";
     temp_top+="<TD   width=\"20px\" rowSpan=\"2\">";
	 temp_top+=" <DIV align=center style=\"margin-left:8px;display:inline\">$$btn_prv$$</DIV></TD>";
	 
	 temp_top+=" <TD  width=\"50px\">";
 	 temp_top+="<DIV align=center> <select $$Year_Select_NameId$$ onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\">";

     for (i=minYear;i<=maxYear;i++)
     {
     	temp_top+="<option value=\""+i.toString()+"\">"+i.toString()+"</option>";
     }
	
	temp_top+="<\/SELECT><\/DIV><\/TD>";
	temp_top+="";
	temp_top+="<TD background=\"/Utility/CalendarUtility/img/1.jpg\" width=\"20px\">";
	temp_top+="<DIV align=center>";
	temp_top+="<SELECT $$Month_Select_NameId$$   ";
	temp_top+="onmouseover=\"getlayerfocus()\" onblur=\"getlayerfocus()\">";
	
	  for (i=1;i<=12;i++)
		 {
			temp_top+="<option value=\""+i.toString()+"\">"+i.toString()+"</option>";
		 }
	temp_top+="<\/SELECT><\/DIV><\/TD>";
	temp_top+="<TD background=\"/Utility/CalendarUtility/img/1.jpg\" width=\"20px\" rowSpan=2>";
	temp_top+="<DIV  align=center>$$btn_nxt$$<\/DIV><\/TD><\/TR>";
	temp_top+=" <\/TBODY><\/TABLE>";

	temp_str+="<TABLE class=\"border1\"  width=\"100%\"  cellSpacing=0 cellPadding=0 align=center border=0 >";
	temp_str+="  <TBODY>";
	temp_str+="  <TR><TD>";
	temp_str+=" <TABLE borderColor=\"#999999\"  cellSpacing=0 cellPadding=0 width=\"100%\" ";
	temp_str+="      bgColor=\"#f39800\" border=0>";
	temp_str+="        <TBODY>";
	temp_str+="        <TR>";
	temp_str+="          <TD>";
	temp_str+="            <TABLE class=\"weekday\" borderColor=#0 cellSpacing=1 cellPadding=0 ";
	temp_str+="            width=\"100%\" align=center border=0 style=\"clear:both;margin:0 auto\">";
	temp_str+="              <TBODY>";
	temp_str+="              <TR align=middle>";
	temp_str+="                <TD class=\"weekend\">Sun<\/TD>";
	temp_str+="                <TD class=\"weekday\" >Mon<\/TD>";
	temp_str+="                <TD class=\"weekday\" >Tue<\/TD>";
	temp_str+="                <TD class=\"weekday\" >Wed<\/TD>";
	temp_str+="                <TD class=\"weekday\" >Thu<\/TD>";
	temp_str+="                <TD class=\"weekday\" >Fri<\/TD>";
	temp_str+="                <TD class=\"weekend\" >Sat<\/TD>";
	temp_str+="              <\/TR><\/TBODY><\/TABLE>";
	temp_str+="           <TABLE id=\"calendardate\"  class=\"date\" cellSpacing=1 cellPadding=0 width=\"100%\" style=\"clear:both;margin:0 auto\" align=center ";
	temp_str+="            border=0>";
	temp_str+="              <TBODY>$$Date_day_td$$";
	
	temp_str+="<\/TBODY><\/TABLE><\/TD><\/TR><\/TBODY><\/TABLE><\/TD><\/TR>";
	temp_str+="<\/TBODY><\/TABLE><\/TABLE>";

	var temp_bottom="";
	temp_bottom+="      <DIV align=center style=\"clear:left\">";
	temp_bottom+="      <TABLE  cellSpacing=0 cellPadding=0 width=\"100%\" border=0>";
	temp_bottom+="        <TBODY>";
	temp_bottom+="        <TR  style=\"cursor: pointer\" id=\"Today_tr\" onclick=\"Settoday('"+curday+"')\">";
	temp_bottom+="          <TD class=\"today\">Today "+curday+"<\/TD>";
	temp_bottom+="          <TD class=\"today\"><IMG style=\"CURSOR: pointer\" onclick=\"Divclose()\"; height=13 ";
	temp_bottom+="            alt=today src=\"/Utility/CalendarUtility/img/CloseWindows.gif\" ";
	temp_bottom+="        width=14><\/TD><\/TR><\/TBODY><\/TABLE><\/DIV>";
	if(sord=='1')
	{
		temp_top=(((temp_top.replace("$$btn_prv$$",str_btn_prv)).replace("$$btn_nxt$$",str_btn_nxt)).replace("$$Year_Select_NameId$$",Year_Select1_NameId)).replace("$$Month_Select_NameId$$",Month_Select1_NameId);
		temp_top=temp_top.replace("float:left;width:50%","width:100%");
		temp_str="<div id=\"innertable\" onblur=\"hilayer()\">"+temp_top+(temp_str.replace("$$Date_day_td$$",Date_Day_td1))+temp_bottom+"</div>"
	}
	else
	{
		temp_top=(((temp_top.replace("$$btn_prv$$",str_btn_prv)).replace("$$btn_nxt$$","")).replace("$$Year_Select_NameId$$",Year_Select1_NameId)).replace("$$Month_Select_NameId$$",Month_Select1_NameId)+(((temp_top.replace("$$btn_prv$$","")).replace("$$btn_nxt$$",str_btn_nxt)).replace("$$Year_Select_NameId$$",Year_Select2_NameId)).replace("$$Month_Select_NameId$$",Month_Select2_NameId);
		temp_str="<div id=\"innertable\" onblur=\"hilayer()\">"+temp_top+"<div style=\"float:left;width:50%\">"+(temp_str.replace("$$Date_day_td$$",Date_Day_td1))+"</div><div style=\"float:right;width:50%\">"+(temp_str.replace("$$Date_day_td$$",Date_Day_td2))+"</div>"+temp_bottom+"</div>";
		}

return temp_str;
}
function set_cele_date(year,month)
{
	set_double_calendar(year,month,'');
	var nexmonth=new Date(year,month-1,1);
	nexmonth.setMonth(parseInt(nexmonth.getMonth(),10)+1);
	
	set_double_calendar(nexmonth.getFullYear(),nexmonth.getMonth()+1,'2');
 	display_btn_prvnxt();
}
function set_double_calendar(year,month,index)
{
	if(arguments.length==3)
		index=index=='2'?'2':'';
	else
		index='';
		
	resetMonthSelect(year,index);
	
  var i,j,p,k;
  var temp;
  var nd=new Date(year,month-1,1);
  var yearobj=document.getElementById("cele_date_year"+index);
  var monthobj=document.getElementById("cele_date_month"+index);
  yearobj.value=year;
  monthobj.value=month;   
  for (i=1;i<=6;i++)
    for(j=1;j<=7;j++)
      {
		 var tempobj1=document.getElementById("c"+i+"_"+j+""+index);
		 tempobj1.innerHTML="";
	     tempobj1.style.background="";
	     tempobj1.onmouseout=null;
	     tempobj1.onmouseover=null;
	     tempobj1.style.cursor="text";  
      }
  k=nd.getDay()-1;
  while(month-1==nd.getMonth())
    { j=(nd.getDay() +1);
      p=parseInt((nd.getDate()+k) / 7)+1;
	  var tempobj;
	  tempobj=document.getElementById("c"+p+"_"+j+""+index);
	  tempobj.innerHTML=nd.getDate();
	  tempobj.style.background="";

	
	 if(nd<=date_end && nd>=date_start)
	  {
		  tempobj.style.background="#d2dcfe";
	      tempobj.onmouseover=function(){overcolor(this)};
	      tempobj.onmouseout=function(){outcolor(this)};
		  tempobj.style.cursor="pointer"; 
	  }
	   
      if (nd>date_end || nd<date_start)
      {
	 	 tempobj.style.cursor="text";
       }
	  if(prmDate!="")
	  {		  
		  if ((nd.getDate()==prmDate.getDate())&&(monthobj.value==prmDate.getMonth()+1)&&(yearobj.value==prmDate.getFullYear()))
		  {
			 tempobj.style.background="#ffd2a6";
			 tempobj.onmouseout=null;
	    	 tempobj.onmouseover=null;
			 
		  }
		  		  
	  }
	  else  if ((nd.getDate()==today.getDate())&&(monthobj.value==today.getMonth()+1)&&(yearobj.value==today.getFullYear()))
	  {
      	 tempobj.style.background="#ffd2a6";
		 tempobj.onmouseout=null;
	     tempobj.onmouseover=null;
      }
      nd=new Date(nd.valueOf() + 86400000)
    }
  
}
function resetMonthSelect(year,ind)
{
	ind=ind=='2'?'2':'';
			var monthobj=document.getElementById("cele_date_month"+ind);
			var monthoptlen=monthobj.options.length;
			var start=date_start;
			var end=date_end;
			if(ind=='2')
				{
					var date_start2=new Date(date_start.getFullYear(),date_start.getMonth(),date_start.getDate());
					date_start2.setMonth(eval(parseInt(date_start.getMonth(),10)+1));
					var date_end2=new Date(date_end.getFullYear(),date_end.getMonth(),date_end.getDate());;
					date_end2.setMonth(eval(parseInt(date_end.getMonth()) + 1));
					if(date_start2.getFullYear()>date_start.getFullYear()&&ind=='2')
						{
							var yearobj=document.getElementById("cele_date_year2");
							yearobj.removeChild(yearobj.options[0]);
						}
					if(date_end2.getFullYear()>date_end.getFullYear()&&ind=='2')
						{
							var yearobj=document.getElementById("cele_date_year2");
							yearobj.options.add( new Option(date_end2.getFullYear(),date_end2.getFullYear()) );
						}
						start=date_start2;
						end=date_end2;
				}

				if(start.getFullYear()==end.getFullYear())
				{
					for (var i=0; i<monthoptlen; i++)
						   {
							 monthobj.removeChild(monthobj.options[0]);
						   }
						   
					for (var i=start.getMonth();i<=end.getMonth();i++)
						   {
							   monthobj.options.add( new Option((i+1).toString(),(i+1).toString()) );
						   }
				}
				else if(start.getFullYear()==year)
					{
						  for (var i=0; i<monthoptlen; i++)
						   {
							 monthobj.removeChild(monthobj.options[0]);
						   }
						   for (i=start.getMonth();i<12;i++)
						   {
							   monthobj.options.add( new Option((i+1).toString(),(i+1).toString()) );
						   }
					}
				else if(end.getFullYear()==year)
					{
						  for (var i=0; i<monthoptlen; i++)
						   {
							 monthobj.removeChild(monthobj.options[0]);
						   }
						   for (var i=0;i<=end.getMonth();i++)
						   {
							   monthobj.options.add( new Option((i+1).toString(),(i+1).toString()) );
						   }
					}
					else
					{
						for (var i=0; i<monthoptlen; i++)
						   {
							 monthobj.removeChild(monthobj.options[0]);
						   }
						   for (var i=0;i<=11;i++)
						   {
							   monthobj.options.add( new Option((i+1).toString(),(i+1).toString()) );
						   }
					}
}
function show_cele_date(d_start,d_end,paramDate,obj,sord)
{
	if (d_start==null || d_start=="")
	{
		d_start="today";
	}
	if (d_end==null || d_end=="")
	{
		d_end=Default_date;
	}
	if (paramDate==null || paramDate=="")
	{
		paramDate=d_start;
	}
	if(arguments.length==5)
		sord=sord=='2'?'2':'1';
	else
		sord='1';
	var frm=null;
	//debugger;
	if(document.getElementById("msgDiv")==null)
	 {
		//obj=document.getElementById(objname);
		if(!document.getElementById(obj.id)){
		  var frms = document.getElementsByTagName("iframe");
		  for(i=0;i<frms.length;i++)
			{
				  if(frms[i].name.toString() != "google_conversion_frame" && window.frames[frms[i].name].document.getElementById(obj.id)!=null)
					{	
						frm=frms[i];
					}
				//}
				
			}
		}
		 var iframeobj= document.createElement("DIV");
            iframeobj.setAttribute("id","coverIframe");
            iframeobj.style.position = 'absolute';
            iframeobj.style.top = getobjTop(obj,frm);
            iframeobj.style.left = getobjLeft(obj,frm);
            iframeobj.style.width = sord=='1'?"165px":"330px"; 
            iframeobj.style.height = '182px';
            iframeobj.style.zIndex = '98';
            iframeobj.style.visibility = 'visible';
			var L=document.createElement("iframe");
			
			 L.setAttribute("name","completionFrame");

			L.width= iframeobj.style.width;
			L.height= iframeobj.style.height;
			
			 iframeobj.appendChild(L);


			document.body.appendChild(iframeobj);
			
		//---------------------------------------------------------------
		 var msgObj=document.createElement("div");
		 msgObj.setAttribute("id","msgDiv");
		 msgObj.setAttribute("tabindex","0");
		 msgObj.style.border="1px solid #f39800";
		 msgObj.style.position = "absolute";
		 msgObj.style.background="#d2dcfe";
		 msgObj.style.left = getobjLeft(obj,frm);
		 msgObj.style.top = getobjTop(obj,frm);
		// msgObj.style.width =sord=='1'?"165px":"330px"; 
		 msgObj.style.width = "165px"; 
		 msgObj.style.height ="auto";
		 msgObj.style.textAlign = "center";
		 msgObj.style.zIndex = "100";
		 msgObj.onblur=function(){hilayer()};
		 msgObj.onmouseout=function(){lostlayerfocus()};
		 msgObj.onmouseover=function(){getlayerfocus()};
			
		// var divobj=document.getElementById("msgDiv");
		 msgObj.innerHTML=init(d_start,d_end,sord);
		
		 //alert(innerstr);
		document.body.appendChild(msgObj);
		var s,cur_d;
	 	
	  
	   if (d_start!="")
	    {
			if (d_start=="today")
			 {
				date_start=new Date(today.getFullYear(),today.getMonth(),today.getDate());
			
			 }
			else
			 {
			 
				s=d_start.split(separator);
				date_start=new Date(s[0],s[1]-1,s[2]);
			 }
		 }
		else
		 {//Default_day,Default_month,Default_year
			date_start=new Date(1980,8,1);
		 }
	
		if (d_end!="")
		 {
			s=d_end.split(separator);
			date_end=new Date(s[0],s[1]-1,s[2]);
		 }
		else
		 {
			date_end=new Date(2020,7,1);
		 }
		g_object=obj;
		if(paramDate=="")
		{
			if (g_object.value=="")
			 {
				cur_d=new Date();
				if(sord=='1')
				 	{
						set_double_calendar(cur_d.getFullYear(),cur_d.getMonth()+1,cur_d.getDate(),'');
						display_btn_prvnxt();
					}
				else
					set_cele_date(cur_d.getFullYear(),cur_d.getMonth()+1,cur_d.getDate());
				
				
			 }
			else
			 {
					var curdate=g_object.value;
					var curdate_array=curdate.split(separator);
					var cur_date=new Date(curdate_array[0],curdate_array[1]-1,curdate_array[2]);
					if((d_start!="")&&(date_start>=cur_date))
						{
							g_object.value=d_start;
							cur_date=date_start;
						}
					if(sord=='1')
						  {
								set_double_calendar(cur_date.getFullYear(),cur_date.getMonth()+1,'');
								display_btn_prvnxt();
						  }
					  else
						 set_cele_date(cur_date.getFullYear(),cur_date.getMonth()+1);
				
			 }
		}
		else
		{  
			var paramdate_array=paramDate.split(separator);
			prmDate=new Date(paramdate_array[0],paramdate_array[1]-1,paramdate_array[2]);

			if((d_start!="")&&(date_start>=prmDate))
						{
							prmDate=date_start;
						}
			if(sord=='1')
				{
					set_double_calendar(prmDate.getFullYear(),prmDate.getMonth()+1,'');
					display_btn_prvnxt();
				}
			else
				set_cele_date(prmDate.getFullYear(),prmDate.getMonth()+1);
				
			 } 
		sod=sord;
		if(date_start<=today&&date_end>=today)
			{
				var tempobj=document.getElementById("Today_tr");
				tempobj.style.color="#ffffff";
				tempobj.onmouseover=function(){this.style.color="#9999ff";};
	      		tempobj.onmouseout=function(){this.style.color="#ff8844";};
			}
		else
			document.getElementById("Today_tr").style.cursor="text";
		msgObj.focus();	
	}

}
function td_click(t_object,index)
{
	if(arguments.length==2)
		index=index=='2'?'2':'';
	else
		index='';
		
	var t_d
	if (parseInt(t_object.innerHTML,10)>=1 && parseInt(t_object.innerHTML,10)<=31 ) 
	 { 
	 	t_d=new Date(document.getElementById("cele_date_year"+index).value,document.getElementById("cele_date_month"+index).value-1,t_object.innerHTML)
		if (t_d<=date_end && t_d>=date_start)
		 {
			var year = document.getElementById("cele_date_year"+index).value;
			var month = document.getElementById("cele_date_month"+index).value;
			var day = t_object.innerHTML;
			if (parseInt(month)<10) month = "0" + month;
			if (parseInt(day)<10) day = "0" + day;
			
			g_object.value=year+separator+month+separator+day;
			//window.document.getElementById("cele_date").style.display="none";
			Divclose();
		 };
	}
}
function Settoday(todays)
{ 
	if(today<date_start||today>date_end)
	return false;
	g_object.value=todays;
	Divclose();
}


function overcolor(obj)
{
  if (obj.style.cursor=="pointer") obj.style.background= "#86a3fd";

  inover=true;

}

function outcolor(obj)
{
	obj.style.background= "#D2DCFE";
	inover=false;

}
function orcolor(obj)
{
	obj.style.background= "";
}

function getNow(o)
{
    var Stamp=new Date();
    var year = Stamp.getFullYear();
    var month = Stamp.getMonth()+1;
    var day = Stamp.getDate();
    if(month<10){
	month="0"+month;
    }
    if(day<10){
	day="0"+day;
    }
    o.value=year+separator+month+separator+day;
}

function hilayer()
{
	if (inover==false)
	{
		Divclose();
	}
}
function getlayerfocus()
{
	inover=true;
	//document.getElementById("msgDiv").focus();
}
function lostlayerfocus()
{
	
	inover=false;
}

function getAbsPoint(e)
{
  var x = e.offsetLeft;
  var y = e.offsetTop;
  while(e = e.offsetParent){
    x += e.offsetLeft;
    y += e.offsetTop;
  }
  return {"x": x, "y": y};
}

function getobjTop(e,ef)
{
	var topy;
	if(ef==null)
		{
 			var xy =getAbsPoint(e);
			topy=(xy.y + e.offsetHeight)+ "px";
		}
		else
		{	var xyF=getAbsPoint(ef);
			var xy =getAbsPoint(e);
			topy=(xyF.y+xy.y + e.offsetHeight)+ "px";
		}
	return topy;
}
function getobjLeft(e,ef)
{
	var leftx;
	if(ef==null)
	 {
		 var xy =getAbsPoint(e);
		leftx=xy.x + "px";
		 
	  }
	else
	  {var xyF=getAbsPoint(ef);
			var xy =getAbsPoint(e);
		 leftx=xyF.x+xy.x + "px";
	   }
	return leftx;
}
function Divclose()
{
	 document.body.removeChild(document.getElementById("msgDiv"));
	 document.body.removeChild(document.getElementById("coverIframe"));

}
