//date conversion
function checkDate(strDate) {
	var myDate = new Date();
	vDate = strDate.split("/")
	validDate = myDate.setFullYear(vDate[2],vDate[1],vDate[0]);
	return validDate;
}

function CheckAll(Form) {
	for(intI=0;intI<=Form.elements.length-1;intI++) {		
		if(Form.elements[intI].type=="checkbox")
		 {	
			if(Form.txtCheck.value=="unCheck") {
				Form.elements[intI].checked=true;
				strCheck = "Check"; strString = "Uncheck all"; }			
				else {
				Form.elements[intI].checked=false;
				strCheck = "unCheck"; strString = "Check all";}
		 }
	}
	Form.txtCheck.value = strCheck;
	document.getElementById("divCheck").innerHTML = strString;
}

function frmSubmitProcess(Form) {
	for(intI=0;intI<=Form.elements.length-1;intI++) {		
		
		if(Form.elements[intI].type=="checkbox")
		 {	
		 	if(Form.elements[intI].checked==true) {
			strFlag = "Y";break; }
		 	else if(Form.elements[intI].checked==false) {
			strFlag = "N"; 
		 }
	}
}
	Form.txtOpt.value = strFlag;
	flag="ok"
	//Form.txtOption.value = flag;
	
	//alert(Form.txtOpt.value)
	if(Form.txtOpt.value=="N") {
		alert("Please select atleast a record to continue");
		Form.selOptions.focus();
		return false;
	}
}


function frmSubmitProcess1(Form) {
	for(intI=0;intI<=Form.elements.length-1;intI++) {		
		
		if(Form.elements[intI].type=="checkbox")
		 {	
		 	if(Form.elements[intI].checked==true) {
			strFlag = "Y";break; }
		 	else if(Form.elements[intI].checked==false) {
			strFlag = "N"; 
		 }
	}
}
	Form.txtOpt.value = strFlag;
	flag="ok"
	//Form.txtOption.value = flag;
	
	//alert(Form.txtOpt.value)
	if(Form.txtOpt.value=="N") {
		alert("Please select the records to process");
		Form.selOptions.focus();
		return false;
	}
}

// JavaScript Document
function showHideSelect(obj,strID,strLabel){
//	intFlag=1 Show
//	intFlag=0 Hide
	if(obj.value=="0"){
		document.getElementById(strID).style.display="none";
	}
	else{
		document.getElementById(strID).style.display="block";
	}
	
	if(strLabel!="" && obj.value!="0"){
		eval(strLabel).innerHTML=obj.options[obj.selectedIndex].text;
	} else {
		eval(strLabel).innerHTML="";
	}
}



function showHideSelect1(obj,strID,strLabel,obj1){
//	intFlag=1 Show
//	intFlag=0 Hide
	if(obj.value=="0"){
		document.getElementById(strID).style.display="none";
	}
	else{
		document.getElementById(strID).style.display="block";
	}
	
	if(strLabel!="" && obj.value!="0"){
		eval(strLabel).innerHTML=obj.options[obj.selectedIndex].text;
	} else {
		eval(strLabel).innerHTML="";
	}
	obj1.value="0"
}

function modify(intI)
{
	if(intI==1)
	{
		con=confirm("Do you want to modify this record?")
	}
	else if(intI==2)
	{
		con=confirm("Do you want to delete this record?")
	}
	if(con==true) {
		return true;
	}
	else {
		return false;
	}
}


function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
    try {
    req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (err2) {
        try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        } catch (err3) {
            req = false;
        }
    }
}
return req;
}

var http = getXMLHTTPRequest();
function getServerTime(url,func,id) {
	document.getElementById(id).style.display="block"
	http.open("GET", url, true);
    http.onreadystatechange = func;
    http.send(null);
}

function getServerReq(url,func) {
	http.open("GET", url, true);
    http.onreadystatechange = func;
    http.send(null);
}
function getServerTimeAdmin(url,func,id) {
	alert(url)
	document.getElementById(id).style.display="block"
	http.open("GET", url, true);
    http.onreadystatechange = func;
    http.send(null);
}
