
function strReplace(str1, str2, str3) { 
 while(str1.indexOf(str2) != -1) 
 {
   str1 = str1.replace(str2, str3);
 } 
 return str1;     
} 


function changedayofweek(strDay)
{
	if (strDay=="MON")
	{
		return "TUE";
	}
	if (strDay=="TUE")
	{
		return "WED";
	}
	if (strDay=="WED")
	{
		return "THU";
	}
	if (strDay=="THU")
	{
		return "FRI";
	}
	if (strDay=="FRI")
	{
		return "SAT";
	}
	if (strDay=="SAT")
	{
		return "SUN";
	}
	if (strDay=="SUN")
	{
		return "MON";
	}
	
}

function changemonth(strMonth)
{
	if (strMonth == "JAN")
	{
		return "FEB";
	}
	if (strMonth == "FEB")
	{
		return "MAR";
	}	
	if (strMonth == "MAR")
	{
		return "APR";
	}	
	if (strMonth == "APR")
	{
		return "MAY";
	}	
	if (strMonth == "MAY")
	{
		return "JUN";
	}	
	if (strMonth == "JUN")
	{
		return "JUL";
	}	
	if (strMonth == "JUL")
	{
		return "AUG";
	}	
	if (strMonth == "AUG")
	{
		return "SEP";
	}	
	if (strMonth == "SEP")
	{
		return "OCT";
	}	
	if (strMonth == "OCT")
	{
		return "NOV";
	}	
	if (strMonth == "NOV")
	{
		return "DEC";
	}	
	if (strMonth == "DEC")
	{
		return "JAN";
	}	
}

function daysofmonth(strMonth, intYear)
{
	if ((strMonth=="JAN")|(strMonth=="MAR")|(strMonth=="MAY")|(strMonth=="JUL")|(strMonth=="AUG")|(strMonth=="OCT")|(strMonth=="DEC"))
		return 31;
	if ((strMonth=="APR")|(strMonth=="JUN")|(strMonth=="SEP")|(strMonth=="NOV"))
		return 30;
	if (strMonth=="FEB")
	{
		if (intYear % 4 == 0)
		{
			return 29;
		}
		else
		{
			return 28;
		}
	}
	
}


function addminute(){
	var txtDate = document.getElementById("tdDate").innerHTML;
	var txtTimeOrig = txtDate.substring(0, 5);
	var txtTime = strReplace (txtTimeOrig, " ", "");
//	var intMinutes = parseInt(txtTime.substring( txtTime.indexOf(":")+1, txtTime.indexOf(":")+3));

//	alert(strReplace(   txtTime.substring( txtTime.indexOf(":")+1, txtTime.indexOf(":")+3), ":", ""))
	var intMinutes = 0;
	var txtMinutes = strReplace(   txtTime.substring( txtTime.indexOf(":")+1, txtTime.indexOf(":")+3), ":", "");
//	alert(txtMinutes);
	if (txtMinutes.substring(0,1)=="0" )
	{
		txtMinutes = txtMinutes.substring(1,2);
	}
	intMinutes = parseInt (txtMinutes);


	

//	var intMinutes = parseInt(   strReplace(   txtTime.substring( txtTime.indexOf(":")+1, txtTime.indexOf(":")+3), ":", "")     );
	//alert(intMinutes);

	var intHours = parseInt(txtTime.substring( 0, txtTime.indexOf(":")));
	var txtDateWork = txtDate.substring(txtDate.indexOf("&gt;")+4);
	var arrvalues = txtDateWork.split(" ");
	var id;
	arrvalues[3] = strReplace(arrvalues[3], ",", "");
	intMinutes = intMinutes + 1;
	if (intMinutes>59){
		intMinutes=0;
		intHours=intHours+1;
		if (intHours>23)
		{
			intHours=0;
			//change day of week
			arrvalues[1] = 	changedayofweek(arrvalues[1]);
			var intDaysOfMonth = daysofmonth(arrvalues[2], parseInt(arrvalues[4]));
			//change year if it is necesary
			if ((arrvalues[2]=="DEC")&&(arrvalues[3]=="31"))
			{
				arrvalues[4] = String(parseInt(arrvalues[4]) + 1);
			}
			arrvalues[3] = String(parseInt(arrvalues[3])+1);
			if ( parseInt(arrvalues[3])> intDaysOfMonth)
			{
				arrvalues[3] = "1";
				arrvalues[2] = changemonth(arrvalues[2]);
			}
			var txtNewDate = " " + arrvalues[1] + " " + arrvalues[2] + " " + arrvalues[3] + ", " + arrvalues[4];
			txtDate = strReplace(txtDate,txtDateWork,txtNewDate);
		}
	}
	var txtNewTime = "";
	if (intMinutes>9)
	{
		txtNewTime = ":" + intMinutes.toString();
	}
	else
	{
		txtNewTime = ":0" + intMinutes.toString();
	}
	if (intHours>9)
	{
		txtNewTime = intHours.toString() + txtNewTime;
	}
	else
	{
		txtNewTime = intHours.toString() + txtNewTime + " ";
	}
	if (intHours==10)
	{
		txtNewTime = txtNewTime + " ";
	}
	document.getElementById("tdDate").innerHTML = strReplace(txtDate, txtTimeOrig, txtNewTime)
	id=setTimeout("addminute()",60000)
	
}

function init(){
	var id=setTimeout("addminute();",60000);
	
}


function dosearch()
{
	var txtValue = document.getElementById("txtsearch").value;
	txtValue = strReplace (txtValue, " ", "");
	if (txtValue!="")
	{
		document.frmsearch.submit();
	}

}