/////////////by mhammad mer3i
     ///////////// move and stop

var nav = (document.layers);
var tmr = null;
var tmrDev = null;
var spd = 0;
var x = 0;
var x_offset =-125;
var y = 0;
var y_offset = -10;

if(nav) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = get_mouse;

function get_mouse(e)
{
  x = (nav) ? e.pageX : event.clientX+document.body.scrollLeft;
  y = (nav) ? e.pageY : event.clientY+document.body.scrollTop;
  x += x_offset;
  y += y_offset;
 // beam();
}
function beam()
{

      if(nav)
    {
   eval("document.DivCal.top="+y);
      eval("document.DivCal.left="+x);
       //  eval(" document.getElementById('DivCal').style.visibility='visible'");
    }
       else
    {
     eval(" document.getElementById('DivCal').style.top="+y);
      eval("document.getElementById('DivCal').style.left="+x);
    //  eval(" document.getElementById('DivCal').style.visibility='visible'");
   }

 tmr=setTimeout('beam()',spd);
 }

  function MS()
{
//if(BT.value=='Move')
//{
//BT.value='Stop';
beam();

//}
/*else
{
BT.value='Move';
clearTimeout(tmr);

} */
}
var ic=0;
function showDev()
{    ic=ic+1;
  tmrDev=setTimeout('showDev()',1000);
  if(ic>=3 && ic<=6 )
  {
   document.getElementById('TiT').title="Developed by Mohammad Merhi" ;

  }
    if(ic==7 )
  {
   document.getElementById('TiT').title="Earlyhost.com" ;
    clearTimeout(tmr);
    ic=0;
  }


}




  /////////////////////// calendar
var namedate="res";
var heading = "#5E85BF";
var bgcolor1 = "#BACADC";
var bgcolor2 = "#3A2B3E";
var font1 = "white";
var font2 = "#000000";
var height = "180";
var width = "250";
 var ar = new Array("01","02","03","04","05","06","07","08","09","10","11","12");
 var  firstyear=100

 function put(result,e) {
 if(e!="" && namedate=="res")
 {
document.getElementById('res').value=result;
}
if(e!="" && namedate=="dt2")
 {
document.getElementById('dt2').value=result;
}
    }
   //month is 30 or 31
function DaysInMonth(Y, M) {
    with (new Date(Y, M, 1, 12)) {

       setDate(0);
        return getDate();

    }
}

function setcal(mon,yea)
{
	mon=mon+1;
	var days = DaysInMonth(yea,mon);
        //alert(days)
	var D = new Date(mon+"/01/"+yea);
	var day = D.getDay();
     //   alert(day)
  var ar1 = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
//var ar = new Array("01","02","03","04","05","06","07","08","09","10","11","12");

//  var df = ar1[document.getElementById('monthselect').value-1];


// df = document.getElementById('yearselect').value+"-"+df;
  document.getElementById('yearselect').value=D.getFullYear();
 document.getElementById('monthselect').selectedIndex=12-mon;
 var df = ar1[mon-1];

	df =D.getFullYear()+"-"+df;
 document.getElementById('ddd').value = df;

	var ddf = document.calen.length;

	for(var xx=0; xx<ddf; xx++)
	   document.calen[xx].value = "";

	var ss = 1;
   // alert(day+days)
	for(var xx=day; xx<day+days; xx++){
	   document.calen[xx].value = ss++;
	}
}

var exd = new Date();
var day1 = exd.getDate();
var monthe1 =ar[exd.getMonth()] ;
var yeare1 = exd.getFullYear();
var monthe2 =exd.getMonth() ;
/////

//var monthe =exd.getMonth() ;
//var yeare = exd.getFullYear();
//var yeare =document.getElementById('yearselect').value ;
//var monthe = document.getElementById('monthselect').value;




document.write("<table width="+width+" height="+height+"\
		style=\"font-family: arial, verdana; color: "+font1+"; font-size: 12px; border-collapse:collapse;\" bordercolor=#003366 bgcolor="+bgcolor1+" border=1>\
			<tr bgcolor="+heading+" align=center><td colspan=7>\
				<table width=100% bordercolor=#003366  border=1 align=center style=\"color: "+font2+"; font-size: 12px;border-collapse:collapse;\" align=center><tr ><td bgcolor=\"#003366\"  bordercolor=#003366 colspan=3 align=center>  <input type=text size=10 style=\"font-size: 10px; \
				font-weight: bold; text-align: center; font-family: san-serif, verdana, arial;\" readonly type=text name=ddd id=ddd></td></tr>\
				<tr align=center><td ><input type=button style=\"background-color: "+bgcolor1+";cursor:hand; color: "+font2+"; border: 0px;Height=19px;\" value=Prev onclick=\"return prev()\" ></td>\
				<td><form name=xxx style=\"margin: 0px; padding: 0px;\"> ");
                document.write("<select name=yearselect id=yearselect onclick=thismon()  onchange=thismon()  style='font-size: 10px;'>");
                j=0;
                 for(var ii=yeare1; ii>parseInt(yeare1-firstyear); ii--)
                     {


			document.write("<option value="+ii+" >"+ii+"</option>");



    }

               document.write("</select><select id=monthselect name=monthselect onclick=thismon() onchange=thismon()  style='font-size: 10px;'>");
                     for(var jj=11; jj>=0; jj--)
                     {


			document.write("<option value="+jj+">"+ar[jj]+"</option>");


    }
               document.write("</select></form></td>\
				<td><input type=button style=\"background-color: "+bgcolor1+";cursor:hand; color: "+font2+"; border: 0px;Height=19px;\" value=Next  onclick=\"return next()\"  ></td></tr></table>\
			</td></tr>\
			<tr bgcolor="+bgcolor2+" align=center><td>Sun</td><td>Mon</td><td>Tue</td><td>Wed</td><td>Thur</td><td>Fri</td><td>Sat</td></tr>");
document.write("<form name=calen  name=calen style=\"border: 0px; padding:0px;\">");
for(var xx=0; xx<6; xx++)
{
	document.write("<tr>");
	for(var cc=0; cc<7; cc++){
		var dd = xx*7+cc;
         dd=parseInt(dd);
		if(dd == 41)
        		 //document.write("<td align=center><a onmouseover='showDev()' id='TiT' title='Earlyhost.com' target=_blank style=\"font-size: 9px; color:white;  text-decoration: none;\" href=http://www.EarlyHost.com >EH</a></td>");

		 document.write("<td align=center></td>");
		else

			document.write("<td align=center><input type=button  style=\"background-color: "+bgcolor1+";cursor:hand; color: "+font2+"; border: 0px;  \" name=x"+dd+"  id=x"+dd+"  onclick=\"put(document.getElementById('yearselect').value+'-'+ ar[document.getElementById('monthselect').value]+'-'+ this.value,this.value);disp();\"></td>");

    }
	document.write("</tr>");
}

document.write("</form></table>");


document.getElementById('monthselect').selectedIndex=12-monthe2;
 var yeare =parseInt(document.getElementById('yearselect').value);
var monthe =parseInt(document.getElementById('monthselect').value);



function prev()
{
 yeare =parseInt(document.getElementById('yearselect').value);
 monthe =parseInt(document.getElementById('monthselect').value);
	monthe = monthe-1;
	if(monthe < 0)
	{
		yeare = yeare-1;
		monthe = 11;
	}
     if(yeare>parseInt(yeare1-firstyear))
    {
	setcal(monthe, yeare);
    }
	return false;

}

function next()
{
 yeare =parseInt(document.getElementById('yearselect').value);
 monthe =parseInt(document.getElementById('monthselect').value);
	monthe = monthe+1;
	if(monthe > 11)
	{
		yeare = yeare+1;
		monthe = 0;
	}
    if(yeare<=yeare1)
    {
	setcal(monthe, yeare);
    }
	return false;
}
function thismon()
{
var yeare3 =parseInt(document.getElementById('yearselect').value);
var monthe3 =parseInt(document.getElementById('monthselect').value);
	//yeare = yeare+1900;
	setcal(monthe3, yeare3);
}



/*   Free Script provided by HIOXINDIA            */
/*   visit us at http://www.hscripts.com     */
/*   This is a copyright product of hioxindia.com */

