﻿// JScript File

function CheckDiffinBunDates(FromDate, ToDate) {
    var frmdate;
    var checkedList1 = FromDate.split('-');
    var Day = checkedList1[0];
    var Month = checkedList1[1];
    switch (Month) {
        case "Jan":
            Month = "01";
            break;
        case "Feb":
            Month = "02";
            break;
        case "Mar":
            Month = "03";
            break;
        case "Apr":
            Month = "04";
            break;
        case "May":
            Month = "05";
            break;
        case "Jun":
            Month = "06";
            break;
        case "Jul":
            Month = "07";
            break;
        case "Aug":
            Month = "08";
            break;
        case "Sep":
            Month = "09";
            break;
        case "Oct":
            Month = "10";
            break;
        case "Nov":
            Month = "11";
            break;
        case "Dec":
            Month = "12";
            break;
    }
    var Year = checkedList1[2];
    Year = "20" + Year;
    FromDate = Day + "/" + Month + "/" + Year

    var checkedList2 = ToDate.split('-');
    var Day1 = checkedList2[0];
    var Month1 = checkedList2[1];
    switch (Month1) {
        case "Jan":
            Month1 = "01";
            break;
        case "Feb":
            Month1 = "02";
            break;
        case "Mar":
            Month1 = "03";
            break;
        case "Apr":
            Month1 = "04";
            break;
        case "May":
            Month1 = "05";
            break;
        case "Jun":
            Month1 = "06";
            break;
        case "Jul":
            Month1 = "07";
            break;
        case "Aug":
            Month1 = "08";
            break;
        case "Sep":
            Month1 = "09";
            break;
        case "Oct":
            Month1 = "10";
            break;
        case "Nov":
            Month = "11";
            break;
        case "Dec":
            Month1 = "12";
            break;
    }
    var Year1 = checkedList2[2];
    Year1 = "20" + Year1;
    ToDate = Day1 + "/" + Month1 + "/" + Year1
    frmdate = FromDate;
    //alert(pdate.getMonth());
    var idate = ToDate;
    var POdmy = frmdate.split("/");
    var IVdmy = idate.split("/");
    if (parseInt(POdmy[2], 10) > parseInt(IVdmy[2], 10)) {
        return 1;
    }
    else if (parseInt(POdmy[1], 10) > parseInt(IVdmy[1], 10) && parseInt(POdmy[2], 10) == parseInt(IVdmy[2], 10)) {
        return 1;
    }
    else if (parseInt(POdmy[0], 10) > parseInt(IVdmy[0], 10) && parseInt(POdmy[1], 10) == parseInt(IVdmy[1], 10) && parseInt(POdmy[2], 10) == parseInt(IVdmy[2], 10)) {
        return 1;
    }
    return 2;
}


function toggle() {
    if (document.getElementById('Hide').style.display == "block") {
        parent.hideFrame();
        document.getElementById('Show').style.display = "block";
        document.getElementById('Hide').style.display = "none"
    }
    else {
        parent.showFrame();
        document.getElementById('Show').style.display = "none";
        document.getElementById('Hide').style.display = "block";
    }
}

var year=0;
function Convert_enter_Org(ddlid, txtid)
{      
	if(window.event.keyCode == 13)
	{
		//Util.GetLocationShortNames(ddlid, txtid);	
		//document.getElementById('ddlOrg').focus();
		document.getElementById('txtDstshort').select();
		//document.getElementById(ddlid).focus();	
	}	
}

function FillShortName(ddlid,txtid)
{	
	Util.FillLocationShortNames(ddlid,txtid);
	return false;
}

function FillEmpShortName(ddlid,txtid)
{	
   	Util.FillEmployeeShortNames(ddlid,txtid);
	return false;
}

function GetConsigneeName(ddlid,txtid)
{
	Util.GetConsigneeName(ddlid,txtid);
	return false;
}

//function consdet(consno, ConsYear)
//{	
//    //alert('mm');
//	/*if (Editper == 0)
//	{
//		 alert('Your Not Authorised To Edit Consignment List');
//		 return false;
//	}*/
//	var result;
//	var conno="";
//	var custcode="";
//	var dateofbook="";
//	var noofdocs="";
//	var branch="";
//	var dept="";
//	var loadtype="";
//	var doctype="";
//	var weight="";				
//	boal = false;
//	divtag ="editdiv";			
//	sendAjaxRequest('CourierAjax/Consignment/Consignment_List.aspx?par=disp_consignment_edit_view&consno=' + consno + '&ConsYear=' + ConsYear);	
//	result=getvalfromajax();
//	result=result.split('^');
//	conno=result[0];
//	custcode=result[1];
//	dateofbook=result[2];
//	noofdocs=result[3];
//	company = result[4];
//	branch=result[5];
//	dept = result[6];
//	year=result[7];	
//    //	alert(year);	
//	//alert(conno + ' : ' + custcode + ' : ' + dateofbook + ' : ' + noofdocs + ' : ' + branch + ' : ' + dept + ' : ' + loadtype + ' : ' + doctype + ' : ' + weight);					
//	cons_loadvalues(conno,company,dateofbook,noofdocs,branch,dept,0);
//	document.getElementById('consigndet').background="Images/RoundedOrangeExplorer.gif";
//	document.getElementById('consignm').background="Images/RoundedGrayExplorer.gif";			
//	//document.getElementById('express').background="Images/RoundedGrayExplorer.gif";			
//	document.getElementById('conslist').background="Images/RoundedGrayExplorer.gif";	
//	boal = true;
//	divtag ="addcons";	
//	sendAjaxRequest('CourierAjax/Consignment/Consignment_List.aspx?par=for_pod_range&consno=' + consno +'&year='+ConsYear);
//    /*
//	boal = false;
//	divtag ="consinbokdiv";	
//	sendAjaxRequest('CourierAjax/Consignment/ConsignmentDetail.aspx?par=pod_range_details_display&consno=' + consno +'&year='+ConsYear);
//    */	
//    //	year=0;				
//}
	
function LocationShortName(ddlid,txtid,NssLoc)
{		
	/*txtid.value = txtid.value.toUpperCase();
	var OrgName = document.getElementById(txtid.id).value; 	
	if(document.getElementById(ddlid).options.value != OrgName)
	{
	alert('No Location Exists with ' + OrgName + ' As Shortname.');
	}
	else
	{
	document.getElementById(ddlid).options.value = OrgName;
	}*/
	Util.GetLocationShortNames(ddlid,txtid,NssLoc);
  	return false;
}

//function show_flow()
//{
//	window.open('courier_A.html');
//}

//function GetCustomer(ddlid,txtid)
//{   
//    //modified by Ck		
//	var lblName = "ShortName";
//	//txt_validation_alphanumeric(txtid,lblName)
//	txtid.value = txtid.value.toUpperCase();
//	var company = document.getElementById(txtid.id).value; 
//	if(company == "")
//	{
//		document.getElementById(ddlid).options.value = 0;
//	}
//	else
//	{
//		document.getElementById(ddlid).options.value = company;	
//	}			
//	return false;
//}

function Onkeypress_txtDst(ddlid, oEvent, oThis)//enter key event for bkgdst txtbox
{
	if(window.event.keyCode == 13)
	{
		//document.getElementById('ddlDst').focus();
		document.getElementById('txtDstshort1').focus();
		document.getElementById('txtDstshort1').select();
	}
	return MASK_BadChars(oEvent, oThis);	
}

//function CloseManifest(screen)
//{
//	//screen = 1  Booking-manifest 
//	//screen = 2  Manifest New
//	//screen = 3  Runsheet(Remote)
//	//Screen = 4  RTO Manifest
//	//Screen = 5  Runsheet
//	var ManifestId= "";
//	if(screen == 2)
//	{
//		if( document.getElementById("ManifestId").value != "")
//		{
//			ManifestId = document.getElementById("ManifestId").value;
//			divtag="mfdeldiv";			
//			sendAjaxRequest('CourierAjax/General/General.aspx?par=getmanifestclosed&MfId=' +ManifestId+ '&sheettype=3');	
//			return false;
//		}
//		else
//		{
//			alert("Prepare Manifest");
//			return false;
//		}
//	}
//	if(screen == 3)
//	{
//		if(document.getElementById("RsRemoteId").value != "")
//		{
//			ManifestId = document.getElementById("RsRemoteId").value;
//			divtag="RSRemotedeldiv";
//			sendAjaxRequest('CourierAjax/General/General.aspx?par=getmanifestclosed&MfId=' +ManifestId+ '&sheettype=5');	
//			return false;
//		}
//		else
//		{
//			alert("Prepare Runsheet(Remote)");
//			return false;
//		}
//	}
//	if(screen == 1)
//	{
//		if(document.getElementById("BkManifestId").value != "")
//		{
//			ManifestId = document.getElementById("BkManifestId").value;
//		    divtag="bkgMfclosediv"; 
//			sendAjaxRequest('CourierAjax/General/General.aspx?par=getmanifestclosed&MfId=' +ManifestId+ '&sheettype=3');	
//			return false;
//		}
//		else
//		{
//			alert("Prepare manifest ");
//			return false;
//		}
//	}
//	if(screen == 4)
//	{
//		if(document.getElementById("RTOManifestId").value != "")
//		{
//			ManifestId = document.getElementById("RTOManifestId").value;
//			divtag="mfRtodeldiv";
//			sendAjaxRequest('CourierAjax/General/General.aspx?par=getmanifestclosed&MfId=' +ManifestId+ '&sheettype=4');	
//			return false;
//		}
//		else
//		{
//			alert("Prepare RTO Manifest");
//			return false;
//		}
//	}
//	if(screen == 5)
//	{
//		if(document.getElementById("RunSheetId").value != "")
//		{
//			ManifestId = document.getElementById("RunSheetId").value;
//			divtag="RSdeldiv";
//			sendAjaxRequest('CourierAjax/General/General.aspx?par=getmanifestclosed&MfId=' +ManifestId+ '&sheettype=1');	
//			return false;
//		}
//		else
//		{
//			alert("Prepare Runsheet");
//			return false;
//		}
//	}
//}
	
//function EmployeeShortName(ddlid,txtid)
//{	
//	Util.GetEmpShortNames(ddlid,txtid);
//  	return false;
//}	

function Onkeypress_txtOrgshort(ddlid, oEvent, oThis)
{
	Convert_enter_Org(ddlid, oThis);
	return MASK_BadChars(oEvent, oThis);
}

function Onkeypress_Function(oEvent, oThis)  
{
   return MASK_BadChar_AND(oEvent, oThis); 
}

function licalender()
{
	if(window.event.keyCode == 13)
		{
			lical_oo(1);
		}
}

function lical_oo()
{	
	//alert('vachhindi');			
	Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateFrm",button : "clend",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});
	//Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateFrm",button : "clend",ifFormat : "%d-%m-%Y",daFormat : "%d-%m-%Y"}); 
}
	
function lical_oo1()
{
	Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateTo",button : "clend1",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});          			
}
	
function lical_oo7()
{
	Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "txtDateTo",button : "clend7",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});          			
}

function lical_oo6()
{
	Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "txtDateFrm",button : "clend6",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});          			
}

		// This function is added by gouthami --011007
function lical_oo(stat)
{
	if(stat == 1)
	{
		Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateFrm",button : "clend",ifFormat : "%d-%mmm-%Y" ,daFormat : "%d-%m-%Y"}); 
	}
	if(stat == 2)
	{
		Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateTo",button : "clend1",ifFormat : "%d-%mmm-%Y" ,daFormat : "%d-%m-%Y"}); 
	}
	if(stat == 3)
	{
		Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateFrom",button : "clend",ifFormat : "%d-%mmm-%Y" ,daFormat : "%d-%m-%Y"}); 
	}
	if(stat == 4)
	{
		Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "txtDateFrm",button : "clend6",ifFormat : "%d-%mmm-%Y",daFormat : "%d-%m-%Y"});          			
	}
	if(stat == 5)
	{
		Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "txtDateTo",button : "clend7",ifFormat : "%d-%mmm-%Y",daFormat : "%d-%m-%Y"});          			
	}		
}
	
//function ManifestPod_paging(whic,nofpag,Noofrec,RsId, stype, Orgloc, Dstloc)
//{	 
//	var pagno = document.getElementsByName(['page_case'])(0).value;	
//	var	user_maxdisp = document.getElementById('Auser_nof_rec').value;	
//	var norec =Math.ceil(Noofrec / user_maxdisp);
//	if(norec < nofpag)
//	{		
//	document.getElementsByName(['page_case'])(0).value = norec;	
//	pagno =  norec;	
//	}	
//	if(user_maxdisp == "" ||user_maxdisp=='0')
//	{
//		alert('You must provide number of Records per page');
//		return false;
//	}
//	if(pagno == "" ||pagno == '0')
//	{
//		alert('You must provide Page number');
//		return false;
//	}
//	if(pagno > nofpag)
//		{
//			pagno = nofpag;
//		}
//	if(user_maxdisp	>= Noofrec)
//	{
//		user_maxdisp = Noofrec ;
//		document.getElementById('Auser_nof_rec').value = user_maxdisp;
//		pagno=1;
//	}
//	if((pagno * user_maxdisp)/user_maxdisp > 0 && whic =='GO')
//	{
//		user_maxdisp = document.getElementById('Auser_nof_rec').value;
//		pagno = pagno;
//	}	
//	switch(whic)
//	{
//		case "FIRST":
//			pagno = 1;
//			break;
//		case "PREV":
//			pagno = pagno - 1 ;
//			break;
//		case "GO":
//			pagno = pagno;
//			break;
//		case "NEXT":
//			pagno =parseInt(pagno,10) + 1;
//			break;
//		case "LAST":
//			pagno = nofpag;
//			break;
//		default :
//			pagno = 1;
//			break;						
//	}
//	var ord = "";
//	boal = false;
//	divtag ="manidiv";		
//	sendAjaxRequest('CourierAjax/Manifest/ManifestNew_ajax.aspx?par=ViewManifest&RsId='+RsId+'&SheetType='+stype+ '&OrgLocId='+Orgloc+ '&DstLocId='+Dstloc+ '&pageno='+pagno +'&maxdisp='+user_maxdisp );			
//	return false;
//}
	
//function Onkeypress_txtOrgsh(oEvent, oThis, LcnId)  //GT
//{    
//    if(window.event.keyCode == 13)
//	{
//		liManiDetails(LcnId);
//	}		
//	return MASK_BadChars(oEvent,oThis);
//}

//	
//function Print_ManifestList(reporttype)
//{	
//	if(window.event.keyCode == 13)
//   {
//		Manifest_liprint(reporttype);
//   }
//}	

//function  Manifest_liprint(reporttype)
//{
//	var reptypecode = "Portable Document (PDF)";
//	var Org_ID = 0;
//	var Dst_ID = 0;
//	var SheetType =0;
//	var FrmDate;
//	var ToDate;
//	var chkstatus = 1;
//	FrmDate = document.getElementById("DateFrm").value;
//	ToDate = document.getElementById("DateTo").value;
//	/*if(liCheckDiffernce(FrmDate,ToDate) == 1)Softpal.Dates.CompareDates_new(FrmDate,ToDate)
//	{
//		alert('FromDate is always lessthan or equal to ToDate');
//		return false;
//	}*/
//	if(Softpal.Dates.CompareDates_new(FrmDate,ToDate) == 1)
//	{
//		alert('FromDate is always lessthan or equal to ToDate');
//		return false;
//	}
//	var Orig = "";
//	var Dsti = "";
//	SheetType = document.getElementById('ddlSheetType')[document.getElementById('ddlSheetType').selectedIndex].value;
//	if(SheetType == 0)
//	{
//		alert("Please Select Sheet Type");
//		return false;
//	}
//	else
//	{
//		if(SheetType ==1)
//		{
//			SheetType = 3;			
//		}
//		else if(SheetType ==2)
//		{
//			SheetType =4;
//		}
//		else if(SheetType ==3)
//		{
//			SheetType =5;
//		}
//	}
//	if(document.getElementById('ddlOrg'))
//	{
//		Org_ID = document.getElementById('ddlOrg')[document.getElementById('ddlOrg').selectedIndex].value;
//		Orig = document.getElementById('ddlOrg')[document.getElementById('ddlOrg').selectedIndex].text;
//	}
//	if(document.getElementById('ddlDst'))
//	{
//		Dst_ID = document.getElementById('ddlDst')[document.getElementById('ddlDst').selectedIndex].value;
//		Dsti = document.getElementById('ddlDst')[document.getElementById('ddlDst').selectedIndex].text;
//	}
//	var ManifestNo=  document.getElementById('txtManifestNo').value;
//	//added by cgs on 070301
//	var seldate = 0;
//	if (document.getElementById("chkDate").checked==true)
//	{
//		seldate = 1;
//	}
//    //Added By CY
//	var draft = 0;							
//	draft = document.getElementById('ddlreptype')[document.getElementById('ddlreptype').selectedIndex].value;
//	var Rept = 0;
//	Rept = document.getElementById('ddlreporttype')[document.getElementById('ddlreporttype').selectedIndex].value;
//	//By CY	
//	window.open('Form_Reports.aspx?src=1006&Repno=15&pageno=1&maxdisp=20&SheetType='+ SheetType +'&reporttype='+ reporttype + '&Org_ID='+ Org_ID +'&draft='+ draft +'&Rept='+ Rept +'&Orig='+ Orig +'&Dsti='+ Dsti +'&Dst_ID='+ Dst_ID +'&FromDate='+FrmDate +'&ToDate='+ ToDate  +'&State='+ chkstatus +'&ManifestNo='+ ManifestNo +'&RType='+ reptypecode +'&seldate='+seldate,'Reports','height=1px,width=1px,screenX=500px,screenY=500px');		
//	//window.open('Form_Reports.aspx?src=1006&Repno=15&Draft=' + Draft + '&Rept=' + Rept + ' &EmpNam=' + empname +' &RID=' + rid +'&RepDate=' + repdate + '&RType='+ reptypecode + '&stype='+stype,'Reports','height=1px,width=1px,screenX=500px,screenY=500px');
//}
////end
	
//function del_Manifest(MfId,MfNo,PodNum,SheetType,year)
//{	
//	if(PodNum == 0)
//	{
//		if(confirm("Are you sure to delete " +MfNo ))
//		{
//			boal=false;
//			if(SheetType == 1) 
//			{
//			    divtag="RsListdeldiv";			    
//			    sendAjaxRequest('CourierAjax/General/General.aspx?par=delete_Manifest&param1='+MfId + '&podnum=' +PodNum+ '&Stype='+SheetType+ '&year=' +year);
//			    liEmRunDetails();
//			}
//			else
//			{			
//			    divtag="MfListdeldiv";
//			    sendAjaxRequest('CourierAjax/General/General.aspx?par=delete_Manifest&param1='+MfId + '&podnum=' +PodNum+ '&Stype='+SheetType+ '&year=' +year);
//			    liManiDetails();
//			}
//		}
//	}
//	else
//	{
//		if(confirm("Are you sure to delete " +PodNum ))
//		{
//			boal=false;
//        	if(SheetType == 3) 
//			{			   
//			    divtag="mfdeldiv";
//			    sendAjaxRequest('CourierAjax/General/General.aspx?par=delete_Manifest&param1='+MfId + '&podnum=' +PodNum+ '&Stype='+SheetType+ '&year=' +year);
//			    var count = document.getElementById('lblcountno').innerText;
//			    document.getElementById('lblcountno').innerText = count -1; 
//			    document.getElementById('chkGrid').checked = true; 
//			    disp_ManifestSheet();
//			}
//			if(SheetType == 4)
//			{
//			    divtag="mfRtodeldiv";
//			    sendAjaxRequest('CourierAjax/General/General.aspx?par=delete_Manifest&param1='+MfId + '&podnum=' +PodNum+ '&Stype='+SheetType+ '&year=' +year);
//			    var count = document.getElementById('lblcountno').innerText;
//			    document.getElementById('lblcountno').innerText = count -1; 
//			    document.getElementById('chkGrid').checked = true; 
//			    disp_RTOSheet();
//			}
//			if(SheetType == 5)
//			{
//			    divtag="RSRemotedeldiv";
//			    sendAjaxRequest('CourierAjax/General/General.aspx?par=delete_Manifest&param1='+MfId + '&podnum=' +PodNum+ '&Stype='+SheetType+ '&year=' +year);
//			    var count = document.getElementById('lblcountno').innerText;
//			    document.getElementById('lblcountno').innerText = count -1; 
//			    document.getElementById('chkGrid').checked = true; 
//			    disp_RemoteRunSheet();
//			}
//			if(SheetType == 1)
//			{
//			    divtag="RSdeldiv";
//			    sendAjaxRequest('CourierAjax/General/General.aspx?par=delete_Manifest&param1='+MfId + '&podnum=' +PodNum+ '&Stype='+SheetType+ '&year=' +year);
//			    var count = document.getElementById('lblcountno').innerText;
//			    document.getElementById('lblcountno').innerText = count -1; 
//			    document.getElementById('chkGrid').checked = true; 
//			    disp_RunSheet();
//			}	  
//		}
//	}
//}
////end

function cons_cal_oo(stat)
{		
	if(stat == 1)
	{		
		Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "txtbookingdt",button : "trigger",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});          
	}
	else if(stat == 3)
	{
	Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "Delvdat",button : "Delvcal",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});
	}
	else if(stat == 2)
	{
	    Zapatec.Calendar.setup({ firstDay: 1, electric: false, inputField: "txtReportfromdt", button: "clend", ifFormat: "%d-%b-%y", daFormat: "%d-%b-%Y" }); 
	}
	else if(stat == 4)
	{
	    Zapatec.Calendar.setup({ firstDay: 1, electric: false, inputField: "txtReportTodt", button: "clend1", ifFormat: "%d-%b-%y", daFormat: "%d-%b-%Y" });          			
	}
	else if(stat == 5)
	{
		Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateFrm",button : "clend",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"}); 
		Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "Dateto",button : "clend1",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"}); 
	}			// this line is added by gouthami 070801 
	else if(stat == 6)
	{		
		//Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "txtbookingdt",button : "trigger",ifFormat : "%d/%b/%Y",daFormat : "%d/%b/%Y"});
	    Zapatec.Calendar.setup({ firstDay: 1, electric: false, inputField: "txtbunkerfromdt", button: "trigger", ifFormat: "%d-%b-%y", daFormat: "%d-%mmm-%Y" });   
	}	
	else if(stat == 7)
	{
	    Zapatec.Calendar.setup({ firstDay: 1, electric: false, inputField: "DateFrm", button: "clend", ifFormat: "%d-%mmm-%Y", daFormat: "%d-%mmm-%Y" }); 
	}
	else if(stat == 8)
	{
	    Zapatec.Calendar.setup({ firstDay: 1, electric: false, inputField: "txtbunkertodt", button: "clend1", ifFormat: "%d-%b-%Y", daFormat: "%d-%mmm-%Y" });          			
	}
	else if(stat == 9)
	{
	    Zapatec.Calendar.setup({ firstDay: 1, electric: false, inputField: "DateFrm", button: "trigger1", ifFormat: "%d-%mmm-%Y", daFormat: "%d-%mmm-%Y" });          			
	}	
	else if(stat == 10)
	{		
		//Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "txtbookingdt",button : "trigger",ifFormat : "%d/%b/%Y",daFormat : "%d/%b/%Y"});
	    Zapatec.Calendar.setup({ firstDay: 1, electric: false, inputField: "txtbunkertodt", button: "trigger3", ifFormat: "%d-%b-%y", daFormat: "%d-%mmm-%Y" });   
	}
}	
	
//var Softpal = {};
//Softpal.Response = {};
//Softpal.Request = {};
//Softpal.Dates = {};
//Softpal.Response.Loading = function(divID)
//{	
//	if(document.getElementById(divID))
//						{document.getElementById(divID).innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Loading...Please wait.</font>';}			
//}

//Softpal.Request.Processing = function(divID)
//{	
//	if(document.getElementById(divID)) 
//	{
//	    document.getElementById(divID).innerHTML = '<font style="FONT-WEIGHT: bold;FONT-SIZE: xx-small;" color="blue" face="Arial">&nbsp;&nbsp;Processing...</font>';
//	}		
//	//alert('ok');
//}

//Softpal.AllowTime = function(idg)
//{
//	var txtval = idg.value;
//	if(txtval.indexOf(":") != -1)
//	{
//		if(!((window.event.keyCode>=48)&&(window.event.keyCode<=57)))
//		{
//			window.event.keyCode = null;
//		}
//	}
//	else
//	{
//		if(!(((window.event.keyCode>=48)&&(window.event.keyCode<=57)) || (window.event.keyCode == 58)))
//		{
//			window.event.keyCode = null;
//		}
//	}
//	/*var time = idg.value;
//	validateTime(time,idg)*/
//}

//Softpal.validTime = function(idv)
//{
//	var time = idv.value;
//	validateTime(time,idv)
//}

//Softpal.TimeChange = function(idc)
//{

//	var time = idc.value;
//	
////	alert(curtime);
//validateTime(time,idc)
//}

//function validateTime(time,txtid)
//{
//	var txtvalue = time;
//	var timenow = new Date();
//	var curhours=timenow.getHours();
//	var curminutes=timenow.getMinutes();
//	var curseconds=timenow.getSeconds();
//	var today = new Date();
//    var month=today.getMonth() + 1;
//    var dat=today.getDate();
//    var year=today.getFullYear();
//    if(document.getElementById('txtbookingdt') != null)
//    {
//	var textdate1 = document.getElementById('txtbookingdt').value;
//	}
//	else 
//	if(document.getElementById("datefrm") != null)
//	{
//    var textdate1 = document.getElementById("datefrm").value;
//    }
//    if (document.getElementById('Delvdat') != null)
//    {
//    var textdate1 =document.getElementById('Delvdat').value;
//    }
//	//alert(txtid);
//	//alert(textdate1);
//	var check = 0;
//	if(textdate1 != null)
//	{
//	    textdate1=textdate1.replace("-","/")
//	    textdate1=textdate1.replace("-","/")
//	    var textdate1=textdate1.split("/");
//	    if(textdate1[1] == 1 || textdate1[1] == 2 || textdate1[1] == 3 || textdate1[1] == 4 || textdate1[1] == 5 || textdate1[1] == 6 || textdate1[1] == 7 || textdate1[1] == 8 || textdate1[1] == 9 || textdate1[1] == 10
//	    || textdate1[1] == 11 || textdate1[1] == 12)
//	    {
//	    
//	    textmonth=textdate1[1] ;
//	    }
//	    else
//	    {
//	    var textmonth =parseInt(MonthNumber(textdate1[1])) + 1;
//	    }
//	    
//	    
//	    if(txtvalue.indexOf(".") != -1)
//	    {	
//	        	
//		    var txthhmm = txtvalue.split(".");		
//		    var txthh;
//		    txthh = parseInt(txthhmm[0],10);
//		    
//		    var txtmm;
//		    if(txthhmm[1] != "")
//		    {
//			    txtmm = parseInt(txthhmm[1],10);
//			    if( textdate1[2] >= year)
//    	        {
//    	            if(textmonth >= month)
//    	            {
//    	                if(textdate1[0] >= dat)
//    	                {
//    	                    if(txthh >= curhours)
//			                {
//    			
//			                    if(txtmm > curminutes)
//			                    { 
//			                        check = 1;  			    
//		                            alert('Future time should not be allowed');
//		                            txthh = curhours;
//		                            txtmm = curminutes;
//		                            //   txtid.value = curhours+"."+curminutes+"."+curseconds;
//		                            //time.value = curhours+"."+curminutes+"."+curseconds;	
//		                        }		    
//			                }
//    		
//		                 }
//		                else
//		                {
//			               // txtmm = "00";
//		                }
//		            }
//		        }
//		    }
//		    if( textdate1[2] >= year)
//    	    {
//    	        if(textmonth >= month)
//    	        {
//    	            if(textdate1[0] >= dat)
//    	            {
//		                if(txthhmm[0] != "")
//		                {			           
//			                if(txthh > curhours && check == 0)
//			                {
//			                
//			                alert('Future time should not be allowed');
//			                txthh = curhours;
//			                txtmm = curminutes;
//			                //  txtid.value = curhours+"."+curminutes+"."+curseconds;
//			                //time.value = curhours+"."+curminutes+"."+curseconds;
//			            //    return false;
//			                }
//		                }		       
//		                else
//		                {
//			              //  txthh = "00";
//		                }
//		            }
//		        }
//		    }
//		    		
//		    var txtsec="00";
//		    if(txthhmm.length >2)
//		    {
//			    if(txthhmm[2] != "")
//			    {
//				    txtsec = parseInt(txthhmm[2],10);
//			    }
//			    else
//			    {
//				    txtsec = "00";
//			    }
//		    }
//		    //alert(txthh + ', ' + txtmm);
//		    if(txthh > 23)
//		    {	//alert('>23');
//			    txthh = 23;
//		    }
//		    else if(txthh < 10)
//		    {//alert('<10');
//			    txthh = "0" + txthh;
//		    }
//		    if(txtmm > 59)
//		    {//alert('>59');
//			    txtmm = 59;
//		    }
//		    else if(txtmm < 10)
//		    {//alert('<10');
//			    txtmm = "0" + txtmm;
//		    }
//		    if(txtsec > 59)
//		    {//alert('>59');
//			    txtsec = 59;
//		    }
//		    else if(txtsec < 10)
//		    {//alert('<10');
//			    if(txtsec <= "00")
//			    {
//				    txtsec = "00";
//			    }
//			    else
//			    {
//				    txtsec = "0" + txtsec;
//			    }
//		    }		
//		    //alert(txthh + ":" + txtmm);
//		    txtid.value = txthh + "." + txtmm + "." + txtsec ;
//	    }
//	    else
//	    {
//		    txtvalue = parseInt(txtvalue,10);
//		    if(txtvalue > 23)
//		    {
//			    txtid.value = "23:59:00";
//		    }
//		    else if((txtvalue <= 23)&&(txtvalue >= 10))
//		    {
//			    txtid.value = txtvalue +".00.00" ;
//		    }
//		    else if(txtvalue < 10)
//		    {
//			    txtid.value = "0" + txtvalue +"00.00";
//		    }
//	    }
//	}
//	else
//	{
//	    var txtvalue = time;
//	    //alert(txtid);
//	    if(txtvalue.indexOf(".") != -1)
//	    {		
//		    var txthhmm = txtvalue.split(".");		
//		    var txthh;
//		    if(txthhmm[0] != "")
//		    {
//			    txthh = parseInt(txthhmm[0],10);
//		    }
//		    else
//		    {
//			    txthh = "00";
//		    }
//		    var txtmm;
//		    if(txthhmm[1] != "")
//		    {
//			    txtmm = parseInt(txthhmm[1],10);
//		    }
//		    else
//		    {
//			    txtmm = "00";
//		    }		
//		    var txtsec="00";
//		    if(txthhmm.length >2)
//		    {
//			    if(txthhmm[2] != "")
//			    {
//				    txtsec = parseInt(txthhmm[2],10);
//			    }
//			    else
//			    {
//				    txtsec = "00";
//			    }
//		    }
//		    //alert(txthh + ', ' + txtmm);
//		    if(txthh > 23)
//		    {	//alert('>23');
//			    txthh = 23;
//		    }
//		    else if(txthh < 10)
//		    {//alert('<10');
//			    txthh = "0" + txthh;
//		    }
//		    if(txtmm > 59)
//		    {//alert('>59');
//			    txtmm = 59;
//		    }
//		    else if(txtmm < 10)
//		    {//alert('<10');
//			    txtmm = "0" + txtmm;
//		    }
//		    if(txtsec > 59)
//		    {//alert('>59');
//			    txtsec = 59;
//		    }
//		    else if(txtsec < 10)
//		    {//alert('<10');
//			    if(txtsec <= "00")
//			    {
//				    txtsec = "00";
//			    }
//			    else
//			    {
//				    txtsec = "0" + txtsec;
//			    }
//		    }		
//		    //alert(txthh + ":" + txtmm);
//		    txtid.value = txthh + "." + txtmm + "." + txtsec ;
//	    }
//	    else
//	    {
//		    txtvalue = parseInt(txtvalue,10);
//		    if(txtvalue > 23)
//		    {
//			    txtid.value = "23:59:00";
//		    }
//		    else if((txtvalue <= 23)&&(txtvalue >= 10))
//		    {
//			    txtid.value = txtvalue +".00.00" ;
//		    }
//		    else if(txtvalue < 10)
//		    {
//			    txtid.value = "0" + txtvalue +"00.00";
//		    }
//	    }

//	}
//}

function showhide(idx)
{	
	if (document.getElementById(idx).style.display == "none")
	{
		window.document.getElementById(idx).style.display = 'block';
		filter(("img"+idx),'imgin');
	//	document.getElementById('ddlempnam').focus();
	} 
	else 
	{				
		window.document.getElementById(idx).style.display = 'none';
		filter(("img"+idx),'imgout');						
	} 
}
		
function Back_click()
{
	history.go(-1);
}	
	
function DisplayDates()
{
	if(document.getElementById('chkdat').checked == true)
	{	
		document.getElementById('lbldtfrm').style.display = '';
		document.getElementById('lbldtto').style.display = '';
		document.getElementById('clend').style.display = '';
		document.getElementById('clend1').style.display = '';
		document.getElementById('DateFrm').style.display = '';
		document.getElementById('Dateto').style.display = '';
		return false;
	}
	else
	{	
		document.getElementById('lbldtfrm').style.display = 'none';
		document.getElementById('lbldtto').style.display = 'none';
		document.getElementById('clend').style.display = 'none';
		document.getElementById('clend1').style.display = 'none';
		document.getElementById('DateFrm').style.display = 'none';
		document.getElementById('Dateto').style.display = 'none';
		return false;
	}
}		
	
function DisplayCurrentDates()
{
	if(document.getElementById('chkdat1').checked == true)
	{
		document.getElementById('lbldtCurrfrm').style.display = '';
		document.getElementById('lbldtCurrto').style.display = '';
		document.getElementById('clendCurr').style.display = '';
		document.getElementById('clendCurr1').style.display = '';
		document.getElementById('DateCurrFrm').style.display = '';
		document.getElementById('DateCurrto').style.display = '';		
		return false;
	}
	else
	{	
		document.getElementById('lbldtCurrfrm').style.display = 'none';
		document.getElementById('lbldtCurrto').style.display = 'none';
		document.getElementById('clendCurr').style.display = 'none';
		document.getElementById('clendCurr1').style.display = 'none';
		document.getElementById('DateCurrFrm').style.display = 'none';
		document.getElementById('DateCurrto').style.display = 'none';		
		return false;
	}
}					

function cal_oo(stat)
{		
	if(stat ==2)
	{
        Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateFrm",button : "clend",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});                
        Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "Dateto",button : "clend1",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});		
	}
	else if(stat ==1)
	{
	    Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "bokdt",button : "calbok",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});		
	}	
	else if(stat ==3)
	{
	    Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "Delvcal",button : "Delvcal",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});		
	}
	else if(stat ==4)
	{
	    Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateCurrFrm",button : "clendCurr",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});                
	    Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateCurrto",button : "clendCurr1",ifFormat : "%d-%b-%Y",daFormat : "%d-%b-%Y"});		
	}          //// this line is added by gouthami 071003 
	if(stat == 5)
	{
	    Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateFrm",button : "clend",ifFormat : "%d/%mmm/%Y",daFormat : "%d/%mmm/%Y"});                
	    Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "Dateto",button : "clend1",ifFormat :"%d/%mmm/%Y",daFormat : "%d/%mmm/%Y"});		
	}
	else if(stat == 6)
	{
	    Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateCurrFrm",button : "clendCurr",ifFormat : "%d/%mmm/%Y",daFormat : "%d/%mmm/%Y"});                
	    Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "DateCurrto",button : "clendCurr1",ifFormat : "%d/%mmm/%Y",daFormat : "%d/%mmm/%Y"});		
	}	
	else if(stat == 7)
	{
        Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "txtFromDt",button : "calfm",ifFormat : "%d/%mmm/%Y",daFormat : "%d/%mmm/%Y"});                		    
	}
	else if(stat == 8)
	{	        
	    Zapatec.Calendar.setup({firstDay : 1,electric : false,inputField : "txtToDt",button : "calto",ifFormat : "%d/%mmm/%Y",daFormat : "%d/%mmm/%Y"});			
	}
}
		
function validHour()
{
	if(document.getElementById('txtHour').value > 12)
	{
		alert("Please enter valid Hours");
		return false;
	}
}

function validMin()
{
	if( document.getElementById('txtMin').value >59)
	{
		alert("Please enter valid minitues");
		return false;
	}
}
		
function filter(imagename,objectsrc)
{	
	if(objectsrc == 'imgin')
		{
			window.document.images[imagename].src = "Images/Collapse_icon.gif";
			window.document.images[imagename].title="Click to Collapse";
		}
	else if(objectsrc == 'imgout')
		{
			window.document.images[imagename].src = "Images/expand_icon.gif";
			window.document.images[imagename].title="Click to Expand";
		}
}	

function show_hide(idx,stat)
{	
	var image_name = "img" + idx;	
	if(stat == 1)
	{	
		
		window.document.getElementById(idx).style.display = 'block';
		window.document.images[image_name].src = "Images/Collapse_icon.gif";
		window.document.images[image_name].title="Click to Colapse";
	}
	else if (stat == 0)
	{		
		window.document.getElementById(idx).style.display = 'none';
		window.document.images[image_name].src = "Images/expand_icon.gif";
		window.document.images[image_name].title="Click to Expand";
	}			 
}	
		
function clear_ddl(ddlctl)
{
	//alert('clear');
	for(var i=0;i<document.getElementById(ddlctl).options.length;i++)
	{
		document.getElementById(ddlctl).options[i] = null;
	}
}
function clear_ddlDelPODYear(ddlYear) // By Mohana
{
    var count = document.getElementById(ddlYear).options.length;
    var j = 0;
    for(var i = 0; i< count ; i++)
    {
       if(document.getElementById(ddlYear)[document.getElementById(ddlYear).selectedIndex].value != 0 && document.getElementById(ddlYear)[document.getElementById(ddlYear).selectedIndex].value != "")
       {
          document.getElementById(ddlYear).options[j] = null;
       }
    } 
}
function ddl_select(ddl,dval)
{		
	/*var coun = document.getElementById(ddl).options.length;
	
	for(var i=0;i<coun;i++)
	{	
		if(document.getElementById(ddl).options[i].text == dval)
		{
			document.getElementById(ddl).options[i].selected = true;
		}
	}*/
	//document.getElementById(ddl).options.text = dval
}
	
function show_profile(scrid,scrfm)
{	
	var str1;
	var str2;
	// create an array with the values
		var winArgs = new Array(str1, str2);
		var winSettings = "center:yes;resizable:no;help:no;status:no;dialogWidth:700px;dialogHeight:450px";
		
		// return the dialog control values after passing them as a parameter
		winArgs = window.showModalDialog('DetView.aspx?src=' + scrid +'&scrfrm=' + scrfm, winArgs, winSettings);
}

// These functions are to Create,Read and Erase Cookies
function createCookie(name,value,days) 
{
	if (days) 
	{	
	    //alert('enter');
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else 
	var expires = "";
	var ck = name+"="+value+expires+"; path=/";				
	//if (days != -1) 
	//alert('Cookie\n' + ck + '\ncreated');
	document.cookie = ck;
}
	
function readCookie(name) 
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i<ca.length;i++) 
	{
		var c = ca[i];
		while (c.charAt(0)==' ') 
		c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) 
		return c.substring(nameEQ.length,c.length);
	}
	return null;
}
	
function eraseCookie(name) 
{
	createCookie(name,"",-1);
}

//	for current date in javascript

function GetMonth(intMonth)
{
	//var MonthArray = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	var MonthArray = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	return MonthArray[intMonth];
}

function getDateStr()
{
	var today = new Date();
	var year = today.getYear();
	if(year<1000)
	{year += 1900;}
	var todayStr = today.getDate() + "-" + GetMonth(today.getMonth()) + "-" + year;
	return todayStr;
}
    
function fill_ddl(ddl,vals)
{
	var i;
	var valus = vals.split(':');
	for (i=0;i<valus.length;i++)
		{
			
			var option = new Option(valus[0],i+1);
			document.getElementById('ddlbranch').options[i+1] = option;
			
			var option1 = new Option(dept_branch[1],i+1);
			document.getElementById('ddldept').options[i+1] = option1;
		}
}

//// Email formate validation
//function emailCheck (emailStr) 
//{
//	/* The following variable tells the rest of the function whether or not to verify that the address 
//	ends in a two-letter country or well-known TLD.  1 means check it, 0 means don't. */
//	var checkTLD=1;
//	/* The following is the list of known TLDs that an e-mail address must end with. */
//	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
//	/* The following pattern is used to check if the entered e-mail address fits the user@domain format.
//	 It also is used to separate the username from the domain. */
//	var emailPat=/^(.+)@(.+)$/;
//	/* The following string represents the pattern for matching all special characters.  We don't want 
//	to allow special characters in the address. These characters include ( ) < > @ , ; : \ " . [ ] */
//	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
//	/* The following string represents the range of characters allowed in a 
//	username or domainname.  It really states which chars aren't allowed.*/
//	var validChars="\[^\\s" + specialChars + "\]";
//	/* The following pattern applies if the "user" is a quoted string (in which case, there are 
//	no rules about which characters are allowed and which aren't; anything goes).  E.g. "jiminy 
//	cricket"@disney.com is a legal e-mail address. */
//	var quotedUser="(\"[^\"]*\")";
//	/* The following pattern applies for domains that are IP addresses,rather than symbolic names.  
//	E.g. joe@[123.124.233.4] is a legal e-mail address. NOTE: The square brackets are required. */
//	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
//	/* The following string represents an atom (basically a series of non-special characters.) */
//	var atom=validChars + '+';
//	/* The following string represents one word in the typical username. For example, in 
//	john.doe@somewhere.com, john and doe are words. Basically, a word is either an atom or quoted string. */
//	var word="(" + atom + "|" + quotedUser + ")";
//	// The following pattern describes the structure of the user
//	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
//	/* The following pattern describes the structure of a normal symbolic
//	domain, as opposed to ipDomainPat, shown above. */
//	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
//	/* Finally, let's start trying to figure out if the supplied address is valid. */
//	/* Begin with the coarse pattern to simply break up user@domain into
//	different pieces that are easy to analyze. */
//	var matchArray=emailStr.match(emailPat);
//	if (matchArray==null) 
//	{
//		/* Too many/few @'s or something; basically, this address doesn't
//		even fit the general mould of a valid e-mail address. */
//		alert("Email address seems incorrect (check @ and .'s)");
//		return false;
//	}
//	var user=matchArray[1];
//	var domain=matchArray[2];
//	// Start by checking that only basic ASCII characters are in the strings (0-127).
//	for (i=0; i<user.length; i++) 
//	{
//		if (user.charCodeAt(i)>127) 
//			{
//				alert("Ths username contains invalid characters.");
//				return false;
//			}
//	}
//	for (i=0; i<domain.length; i++) 
//	{
//		if (domain.charCodeAt(i)>127) 
//		{
//			alert("Ths domain name contains invalid characters.");
//			return false;
//		}
//	}
//	// See if "user" is valid 
//	if (user.match(userPat)==null) 
//	{
//		// user is not valid

//		alert("The username doesn't seem to be valid.");
//		return false;
//	}
//	/* if the e-mail address is at an IP address (as opposed to a symbolic
//	host name) make sure the IP address is valid. */
//	var IPArray=domain.match(ipDomainPat);
//	if (IPArray!=null) 
//	{
//		// this is an IP address
//		for (var i=1;i<=4;i++) 
//		{
//			if (IPArray[i]>255) 
//				{
//					alert("Destination IP address is invalid!");
//					return false;
//				}
//		}
//		return true;
//	}
//	// Domain is symbolic name.  Check if it's valid.	 
//	var atomPat=new RegExp("^" + atom + "$");
//	var domArr=domain.split(".");
//	var len=domArr.length;
//	for (i=0;i<len;i++) 
//	{
//		if (domArr[i].search(atomPat)==-1) 
//		{
//			alert("The domain name does not seem to be valid.");
//			return false;
//		}
//	}
//	/* domain name seems valid, but now make sure that it ends in a known top-level domain (like com, 
//	edu, gov) or a two-letter word, representing country (uk, nl), and that there's a hostname preceding 
//	the domain or country. */

//	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) 
//	{
//		alert("The address must end in a well-known domain or two letter " + "country.");
//		return false;
//	}
//	// Make sure there's a host name preceding the domain.
//	if (len<2) 
//	{
//		alert("This address is missing a hostname!");
//		return false;
//	}
//	// If we've gotten this far, everything's valid!
//	return true;
//}

/*function todisp_msg()
	{		
		
		if(divtag == "menu_div") 
			{document.getElementById("menu_div").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Loading...</font>';}
		if(divtag == "consinbokdiv") 
			{document.getElementById("consinbokdiv").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Processing...</font>';}
		if(divtag == "dumdiv") 
			{document.getElementById("dumdiv").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Processing...</font>';}
		if(divtag == "fullpoddet") 
			{document.getElementById("fullpoddet").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Loading...</font>';}
		if(divtag == "addcons") 
			{document.getElementById("addcons").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Processing...</font>';}
		if(divtag == "docdetdiv") 
			{document.getElementById("docdetdiv").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Processing...</font>';}
		if(divtag == "editdiv") 
			{document.getElementById("editdiv").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Loading...</font>';}	
		if(divtag == "statquerydiv") 
			{document.getElementById("statquerydiv").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Loading...</font>';}	
		if(divtag == "listdetdiv") 
			{document.getElementById("listdetdiv").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Loading...Please wait.</font>';}		
		if(divtag == "compregdiv") 
			{document.getElementById("compregdiv").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Loading...</font>';}		
		if(divtag == "complistdiv") 
			{document.getElementById("complistdiv").innerHTML = '<font size="2" style="FONT-WEIGHT: bold" color="#ff0000" face="verdana">&nbsp;&nbsp;Loading...</font>';}					
			
	}*/

//function Get_Branch_Details()
//{
//    //alert();
//	var x = document.getElementById('ddlcustcod');
//	var sel_custcode = x[x.selectedIndex].text;	
//	document.getElementById('ddlbranch').disabled = true;
//	document.getElementById('ddldept').disabled = true;	
//	if(sel_custcode=="[select]")
//	{
//		document.getElementById('ddlbranch').options.length = 0;
//		document.getElementById('ddldept').options.length = 0;			
//		var option01 = new Option("[select]","0");
//		document.getElementById('ddlbranch').options[0] = option01;
//		var option02 = new Option("[select]","0");
//		document.getElementById('ddldept').options[0] = option02;
//		return false;		
//	}
//	else
//	{				
//		boal = false;
//		divtag ="overDiv";
//		sendAjaxRequest('CourierAjax/RunSheet/Rtosheet_ajax.aspx?par=branch_dept&cust_code='+ sel_custcode);		
//		clear_ddl('ddlbranch');
//		clear_ddl('ddldept');		
//		var str_dept_branch=getvalfromajax();		
//		if(str_dept_branch != "")
//		{
//			document.getElementById('ddlbranch').disabled = false;
//			//document.getElementById('ddldept').disabled = false;
//			var branch_dept=str_dept_branch.split(':');
//			var option01 = new Option("[select]","0");
//			document.getElementById('ddlbranch').options[0] = option01;						
//			var i;		
//			for (i=0;i<branch_dept.length;i++)
//			{
//				var option = new Option(branch_dept[i],branch_dept[i]);
//				document.getElementById('ddlbranch').options[i+1] = option;
//			}
//			var option02 = new Option("[select]","0");
//			document.getElementById('ddldept').options[0] = option02;
//			str_dept_branch = "";
//		}
//	    else
//		{
//			document.getElementById('ddlbranch').options.length = 0;
//			document.getElementById('ddldept').options.length = 0;			
//			var option01 = new Option("[select]","0");
//			document.getElementById('ddlbranch').options[0] = option01;
//			var option02 = new Option("[select]","0");
//			document.getElementById('ddldept').options[0] = option02;
//			document.getElementById('ddlbranch').disabled = true;
//			document.getElementById('ddldept').disabled = true;
//			return false;		
//		}		
//	}		
//}

//function Get_Department_Details()
//{
//	var x = document.getElementById('ddlcustcod');
//	var sel_custcode = x[x.selectedIndex].text;		
//	var y =document.getElementById('ddlbranch');
//	var sel_branch = y[y.selectedIndex].text;		
//	var str_dept_branch="";
//	var branch_dept="";
//	document.getElementById('ddldept').options.length = 0;
//	if(sel_custcode=="[select]")
//	{
//		document.getElementById('ddldept').options.length = 0;
//		var option01 = new Option("[select]","0");
//		document.getElementById('ddldept').options[0] = option01;
//		return false;
//	}
//	if(sel_branch=="[select]")
//	{
//		document.getElementById('ddldept').options.length = 0;
//		var option02 = new Option("[select]","0");
//		document.getElementById('ddldept').options[0] = option02;
//		return false;		
//	}		
//	else
//	{	
//		boal = false;
//		divtag ="overDiv";
//		sendAjaxRequest('CourierAjax/General/General.aspx?par=getdepartments&cust_code='+ sel_custcode + '&cust_branch=' + sel_branch);	
//		str_dept_branch=getvalfromajax();
//		if(str_dept_branch !="")
//		{
//			document.getElementById('ddldept').disabled = false;
//			branch_dept=str_dept_branch.split(':');
//			var option01 = new Option("[select]","0");
//			document.getElementById('ddldept').options[0] = option01;					
//			var i;
//			for (i=0;i<branch_dept.length;i++)
//				{
//					var option = new Option(branch_dept[i],branch_dept[i]);
//					document.getElementById('ddldept').options[i+1] = option;
//				}
//		}
//		else
//		{
//			clear_ddl('ddldept');
//			document.getElementById('ddldept').disabled = true;
//		}
//	}		
//}
	
//function IsNumeric(sText)
//{
//   var ValidChars = "0123456789.";
//   var IsNumber=true;
//   var Char; 
//   for (i = 0; i < sText.length && IsNumber == true; i++) 
//   { 
//      Char = sText.charAt(i); 
//      if (ValidChars.indexOf(Char) == -1) 
//      {
//      IsNumber = false;
//      }
//   }
//   return IsNumber;   
//}

//function distinct_array(Varr)
//{		
//	var VarrNew = [];
//	var Temparr = {};
//	for(var i=0;i<Varr.length;i++) 
//	{
//		if (!Temparr[Varr[i]]) 
//		{
//			Temparr[Varr[i]]=true;
//			VarrNew.push(Varr[i]);
//		}
//	}
//	return VarrNew;
//}	
//	
//  Date Comparision Functions...
 function CheckDiffinDates(FromDate,ToDate)
{
	var frmdate;
	frmdate = FromDate;
	//alert(pdate.getMonth());
	var idate = ToDate;
	var POdmy = frmdate.split("-");
	var IVdmy =idate.split("-");
	if(parseInt(POdmy[2]) > parseInt(IVdmy[2]))
	{		
		return 1;
	}
	else if((parseInt(MonthNumber(POdmy[1]),10) > parseInt(MonthNumber(IVdmy[1]),10)) && (parseInt(POdmy[2]) == parseInt(IVdmy[2])) )
	{
		return 1;
	}
	else if( (parseInt(POdmy[0],10) > parseInt(IVdmy[0],10)) && (parseInt(MonthNumber(POdmy[1]),10) == parseInt(MonthNumber(IVdmy[1]),10)) && (parseInt(POdmy[2]) == parseInt(IVdmy[2])) )
	{
		return 1;
	}
	return 2;
}
	
function MonthNumber(mont)
{
	var month;
	switch(mont)
	{
		case "Jan":
		month = "0";
		break;
		case "Feb":
		month = "1";
		break;
		case "Mar":
		month = "2";
		break;
		case "Apr":
		month = "3";
		break;
		case "May":
		month = "4";
		break;
		case "Jun":
		month = "5";
		break;
		case "Jul":
		month = "6";
		break;
		case "Aug":
		month = "7";
		break;
		case "Sep":
		month = "8";
		break;
		case "Oct":
		month = "9";
		break;
		case "Nov":
		month = "10";
		break;
		case "Dec":
		month = "11";
		break;
	}
	return month;
}

function in_array(iobj,ival)
{
	for(var h=0;h<iobj.length;h++)
	{
		if(iobj[h]==ival)
		{
			return true;
		}		
	}
	return false;
}

//var Util = {};
//Util.GetLocationShortNames = function(ddlid,txtid,NssLoc)
//{      	
//    if(txtid.value == "0")
//	{
//	document.getElementById(ddlid).options.value = 0;
//	return false;
//	}
//	var LcnName = txtid.value.toUpperCase();
//	if(LcnName == "")
//	{
//		return false;
//	}
//	else
//	{
//		txtid.value = txtid.value.toUpperCase();	
//		document.getElementById(ddlid).options.value = txtid.value;		
//		if(document.getElementById(ddlid).options.value == "")
//		{
//			alert('No Location Exists with ' + LcnName + ' As Shortname.');
//			document.getElementById(txtid.id).value= ""; 
//			document.getElementById(txtid.id).focus(); 
//			document.getElementById(txtid.id).select(); 			
//			//document.getElementById(ddlid).options.value = 0;
//			return false;
//		}		
//		return false;	
//	 /*	boal = false;
//		divtag = "dupdiv";		
//		sendAjaxRequest('CourierAjax/General/General.aspx?par=Lcnshtname&Lcnname=' + LcnName+ '&NssLoc=' +NssLoc);
//		var Id = getvalfromajax();	
//		if(Id == "-1")
//		{
//			alert('No Location Exists with ' + LcnName + ' As Shortname.');
//			document.getElementById(txtid.id).focus(); 
//			document.getElementById(txtid.id).value= ""; 
//			return false;
//		}
//		else
//		{	
//			document.getElementById(ddlid).options.value = txtid.value;
//			return false;
//		}		*/
//	}	
//}
//// added by SC
//Util.GetEmpShortNames = function(ddlid,txtid)
//{	
//	var EmpName = txtid.value.toUpperCase();
//	if(EmpName  == "")
//	{
//		return false;
//	}
//	else
//	{
//		txtid.value = txtid.value.toUpperCase();	
//		document.getElementById(ddlid).options.value = txtid.value;		
//		if(document.getElementById(ddlid).options.value == "" || document.getElementById(ddlid).options.value == "0" )
//		{
//			alert('No Employee Exists with ' + EmpName + ' As Shortname.');
//			document.getElementById(txtid.id).focus(); 
//			document.getElementById(txtid.id).value= ""; 
//			return false;
//		}		
//		return false;		
//		/*boal = false;             //commented by GT
//		divtag = "dupdiv";		
//		sendAjaxRequest('CourierAjax/General/General.aspx?par=Empshtname&EmpName='+ EmpName);
//		var Id = getvalfromajax();	
//		
//		if(Id == "-1")
//		{
//			alert('No Employee Exists with ' + EmpName + ' As Shortname.');
//			document.getElementById(txtid.id).focus(); 
//			document.getElementById(txtid.id).value= ""; 
//			return false;
//		}
//		else
//		{	
//			document.getElementById(ddlid).options.value =txtid.value;
//			return false;
//		}	*/	
//	}		
//}

////added by SC
//Util.GetRouteShortNames = function(ddlid,txtid)
//{
//	var RouteName = txtid.value.toUpperCase();
//	if(RouteName  == "")
//	{
//		return false;
//	}
//	else
//	{
//		txtid.value = txtid.value.toUpperCase();		
//		document.getElementById(ddlid).options.value = txtid.value;		
//		if(document.getElementById(ddlid).options.value == "" || document.getElementById(ddlid).options.value == "0")
//		{
//			alert('No Route Exists with ' + RouteName + ' As Shortname.');
//			document.getElementById(txtid.id).focus(); 
//			document.getElementById(txtid.id).select(); 
//		    document.getElementById(txtid.id).value= ""; 
//			return false;
//		}		
//		return false;		
//		//commented by SC
//		/*boal = false;
//		divtag = "dupdiv";		
//		sendAjaxRequest('CourierAjax/General/General.aspx?par=Routeshtname&RouteName='+ RouteName);
//		var Id = getvalfromajax();	
//		
//		if(Id == "-1")
//		{
//			alert('No Route Exists with ' + RouteName + ' As Shortname.');
//			document.getElementById(txtid.id).focus(); 
//			document.getElementById(txtid.id).value= ""; 
//			return false;
//		}
//		else
//		{	
//			document.getElementById(ddlid).options.value = Id;
//			return false;
//		}	*/	
//	}		
//}

////added by cgs

//Util.GetLocationShortNames_Remote = function(ddlid,txtid)
//{	
//	var LcnName = txtid.value.toUpperCase();
//	if(LcnName == "")
//	{
//		return false;
//	}
//	else
//	{
//		txtid.value = txtid.value.toUpperCase();
//		
//		boal = false;
//		divtag = "dupdiv";
//		sendAjaxRequest('CourierAjax/General/General.aspx?par=LcnshtnameRem&Lcnname=' + LcnName);                                                                                                                   
//		var Id = getvalfromajax();
//		if(Id == "-1")
//		{
//			alert('No Location Exists with ' + LcnName + ' As Shortname.');
//			return false;
//		}
//		else
//		{	
//			document.getElementById(ddlid).options.value = txtid.value;
//			return false;
//		}
//	}
//}

////end 
//Util.FillLocationShortNames = function(ddlid,txtid)
//{	
//	var ID = ddlid.value;
//	/*boal = false;
//	divtag = "dupdiv";
//	sendAjaxRequest('CourierAjax/General/General.aspx?par=Fillshtname&LcnId='+ ID);
//	var SName = getvalfromajax();*/                  //Modified by Gouthami 071103 
//	document.getElementById(txtid).value = ID;
//	return false;
//}

////added by SC
//Util.FillEmployeeShortNames = function(ddlid,txtid)
//{ 

//	var ID = ddlid.value;
//	/*boal = false;
//	divtag = "dupdiv";
//	sendAjaxRequest('CourierAjax/General/General.aspx?par=FillEmpshtname&EmpId='+ ID);
//	var SName = getvalfromajax(); 
//	document.getElementById(txtid).value = SName.toUpperCase();*/	
//	if(ID == "0")
//			document.getElementById('txtEmpshort').value="";		 	
//	else 	  
//		document.getElementById(txtid).value = ID;
//	return false;
//}

////added by SC
//Util.FillRouteShortNames = function(ddlid,txtid)
//{
//	var ID = ddlid.value;
//	/*boal = false;
//	divtag = "dupdiv";
//	sendAjaxRequest('CourierAjax/General/General.aspx?par=FillRouteshtname&RouteId='+ ID);
//	var SName = getvalfromajax();*/
//	document.getElementById(txtid).value = ID ;// SName.toUpperCase();
//	return false;	
//}

//Util.GetCustoShtName = function(txtid)
//{
//	var ID = document.getElementById('ddlcustcod')[document.getElementById('ddlcustcod').selectedIndex].text;
//	boal = false;
//	divtag = "cusName";
//	sendAjaxRequest('CourierAjax/General/General.aspx?par=GetShtName&custid=' + ID);
//	var SName = getvalfromajax();
//	document.getElementById(txtid).value = SName.toUpperCase();
//	return false;
//}

//Util.GetCustomerName = function(ddlid,txtid)
//{
//	var CustShName = txtid.value;
//	if(CustShName == "")
//	{
//		return false;
//	}	
//	else
//	{
//		txtid.value = txtid.value.toUpperCase();
//		boal = false;
//		divtag = "cusName";
//		sendAjaxRequest('CourierAjax/General/General.aspx?par=CustShtName&CuShtname=' + CustShName);
//		var Id = getvalfromajax();		
//		if(Id == "-1")
//		{
//			alert('Customer is not Exists with ' + CustShName + ' As Shortname.');
//			document.getElementById(txtid.id).value= "";
//			document.getElementById(txtid.id).focus();
//			return false;
//		}
//		else
//		{			
//			//document.getElementById('ddlcustcod')[document.getElementById('ddlcustcod').selectedIndex].text = Id ;
//			document.getElementById(ddlid).options.value = Id;
//		return false;
//		 } 
//	}
//}

//Util.GetConsigneeName = function(ddlid,txtid)
//{
//	var CustShName = txtid.value;
//	if(CustShName == "")
//	{
//		return false;
//	}
//	else
//	{
//		txtid.value = txtid.value.toUpperCase();
//		
//		boal = false;
//		divtag = "cusName";
//		sendAjaxRequest('CourierAjax/General/General.aspx?par=CustShtName&CuShtname=' + CustShName);
//		var Id = getvalfromajax();
//		if(Id == "-1")
//		{
//			alert('Customer is not Exists with ' + CustShName + ' As Shortname.');
//			return false;
//		}
//		else
//		{
//			document.getElementById(ddlid).options.value = Id;
//			/*for(var i=0;i<document.getElementById(ddlid).options.length;i++)
//			{
//				if(document.getElementById(ddlid).options[i].value == Id)
//				{
//					document.getElementById(ddlid).options[i].selected = true;
//					return false;
//				}
//			}*/
//			return false;
//		}
//	}
//}

/**************************************************************************************/
/********  This function created on 27th Jan 2007 It is not Editable  ********/
/**************************************************************************************/

//Softpal.Dates.CurrentDate = function(){
//	var date = new Date();
//	var dat;
//	if(parseInt(date.getDate(),10) < 10)
//	{
//		dat = "0"  + date.getDate();
//	}
//	else
//	{
//		dat = date.getDate();
//	}
//	return dat + "-" + Softpal.Dates.getMonthname(date.getMonth()) + "-" + date.getYear();
//}
//Softpal.Dates.getMonthname = function(monthNo){
//	var monthName = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
//	return monthName[monthNo];
//}

/** Input : FromDate and ToDate in the format of "dd-MMM-yyyy"
    Output: This function(CompareDates) will return 1 if FromDate > ToDate
            This function(CompareDates) will return 2 if FromDate <= ToDate
**/
//Softpal.Dates.CompareDates = function(FromDate,ToDate){
//	
//	var POdmy = FromDate.split("-");
//	var INVdmy = ToDate.split("-");
//	//alert(POdmy[0] + ', ' + POdmy[1] + ', ' + POdmy[2] + ', ' + INVdmy[0] + ', ' + INVdmy[1] + ', ' + INVdmy[2]);
//	if(POdmy[2] > INVdmy[2])
//		{		//alert('y');
//			return 1;
//		}
//		else if((parseInt(Softpal.Dates.getMonthnumber(POdmy[1]),10) > parseInt(Softpal.Dates.getMonthnumber(INVdmy[1]),10)) && (POdmy[2] == INVdmy[2]) )
//		{		//alert('m');
//			return 1;
//		}
//		else if( (parseInt(POdmy[0],10) > parseInt(INVdmy[0],10)) && (parseInt(Softpal.Dates.getMonthnumber(POdmy[1]),10) == parseInt(Softpal.Dates.getMonthnumber(INVdmy[1]),10)) && (POdmy[2] == INVdmy[2]) )
//		{		//alert('d');
//			return 1;
//		}
//	
//		return 2;
//}

//Softpal.Dates.getMonthnumber = function(monthName){
//	var monthNumber = new Array("00","01","02","03","04","05","06","07","08","09","10","11")
//	return monthNumber[monthName];
//}
//						// This function addded by gouthami - 071003

//function getDateStr_new()
//{
//	var today = new Date();
//	var year = today.getYear();
//	if(year<1000)
//	 {year += 1900;}
//	 var dat1;
//	if(parseInt(today.getDate(),10) < 10)
//    {
//        dat1 = "0"  + today.getDate();
//    }
//    else
//    {
//        dat1 = today.getDate();
//    }
//	//var todayStr = today.getDate() + "/" + Softpal.Dates.getMonthnumber_new(today.getMonth()) + "/" + year;
//	var todayStr = dat1 + "/" + Softpal.Dates.getMonthnumber_new(today.getMonth()) + "/" + year;
//	return todayStr;
//}

//Softpal.Dates.getMonthnumber_new = function(monthName)
//{
//	var monthNumber = new Array("01","02","03","04","05","06","07","08","09","10","11","12")
//	return monthNumber[monthName];
//}  

//Softpal.Dates.CompareDates_new = function(FromDate,ToDate)
//{
//	
//	var POdmy = FromDate.split("/");
//	var INVdmy = ToDate.split("/");
//	//alert(POdmy[0] + ', ' + POdmy[1] + ', ' + POdmy[2] + ', ' + INVdmy[0] + ', ' + INVdmy[1] + ', ' + INVdmy[2]);
//	if(POdmy[2] > INVdmy[2])
//		{		//alert('y');
//			return 1;
//		}
//		else if((parseInt(Softpal.Dates.getMonthnumber_new(POdmy[1]),10) > parseInt(Softpal.Dates.getMonthnumber_new(INVdmy[1]),10)) && (POdmy[2] == INVdmy[2]) )
//		{		//alert('m');
//			return 1;
//		}
//		else if( (parseInt(POdmy[0],10) > parseInt(INVdmy[0],10)) && (parseInt(Softpal.Dates.getMonthnumber_new(POdmy[1]),10) == parseInt(Softpal.Dates.getMonthnumber_new(INVdmy[1]),10)) && (POdmy[2] == INVdmy[2]) )
//		{		//alert('d');
//			return 1;
//		}
//		return 2;
//}

//Util.GetCustomerName = function(txtid)
//{
//	var CustShName = txtid.value;
//	if(CustShName == "")
//	{
//		return false;
//	}	
//	else
//	{
//		txtid.value = txtid.value.toUpperCase();
//		boal = false;
//		divtag = "cusName";
//		sendAjaxRequest('CourierAjax/General/General.aspx?par=CustShtName&CuShtname=' + CustShName);
//		var Id = getvalfromajax();
//		
//		if(Id == "-1")
//		{
//			alert('Customer is not Exists with ' + CustShName + ' As Shortname.');
//			document.getElementById(txtid.id).value= "";
//			document.getElementById(txtid.id).focus();
//			return false;
//		}
//		else
//		{			
//			//document.getElementById('ddlcustcod')[document.getElementById('ddlcustcod').selectedIndex].text = Id ;
//			document.getElementById('ddlcustcod').options.value = Id;
//		return false;
//		} 
//	}
//}	
//function ValidateDate(MaxDate, EnteredDate)
//{
//        var IsValidDate = 0;
//        var EnteredDate1 = EnteredDate.split("/");
//        var MaxDate1 = MaxDate.split("/");
//        if(parseInt(EnteredDate1[2],10) >= parseInt(MaxDate1[2],10))
//        {
//            if(parseInt(EnteredDate1[2],10) > parseInt(MaxDate1[2],10))
//            {
//                IsValidDate = 1;
//            }
//            else
//            {
//                if(parseInt(EnteredDate1[1],10) >= parseInt(MaxDate1[1],10))
//                {
//                   if(parseInt(EnteredDate1[1],10) > parseInt(MaxDate1[1],10))
//                   {
//                      IsValidDate = 1;
//                   }
//                   else if(parseInt(EnteredDate1[0],10) > parseInt(MaxDate1[0],10))
//                   {
//                      IsValidDate = 1;
//                   }
//                }
//            }
//        }
//        return IsValidDate;
//    }
    function isGood_Number(ival) {
        var GoodChars, idotCount, iminusCount;
        idotCount = 0; iminusCount = 0;
        GoodChars = "0123456789";
        if (ival == "") { return false; }
        for (i = 0; i <= ival.length - 1; i++) {
            if (GoodChars.indexOf(ival.charAt(i)) > -1) {

            }
            else {
                return false;
            }
        }
        return true;
    }
    function PagenoDecision(Status, PageNo, NoOfRecords, PageSize) {
        switch (Status) {
            case 1:
                PageNo = 1;
                break;
            case 2:
                PageNo = parseInt(PageNo) - 1;
                break;
            case 3:
                PageNo = parseInt(PageNo) + 1;
                break;
            case 4:
                PageNo = Math.ceil(NoOfRecords / PageSize);
                break;
            case 5:
                PageNo = parseInt(PageNo);
                break;
        }
        if (PageNo > Math.ceil(NoOfRecords / PageSize))
            PageNo = Math.ceil(NoOfRecords / PageSize);
        else if (PageNo == 0) {
            PageNo = 1;
        }
        var ZeroPageNo = 1;

        PageSize = parseInt(PageSize) > parseInt(NoOfRecords) ? NoOfRecords : PageSize;
        PrePageSize = parseInt(PrePageSize) > parseInt(NoOfRecords) ? NoOfRecords : PrePageSize;

        ZeroPageNo = (PrePageNo == PageNo && PrePageSize == PageSize) || (Math.ceil(NoOfRecords / PageSize) == 1 && PrePageSize == PageSize) ? 0 : ZeroPageNo;

        if (PageNo == Math.ceil(NoOfRecords / PageSize) && document.getElementById('txtPageNo') != null) {
            document.getElementById('txtPageNo').value = PageNo
        }

         PrePageNo = PageNo;
        PrePageSize = PageSize;

        PageNo = ZeroPageNo == 0 ? ZeroPageNo : PageNo;
        return PageNo;
    }
//    function MASK_Integer_P(oEvent, oThis, oMaxLenght) {
//        var GoodChars = "0123456789";
//        return MASK_NUMERIC(oEvent, oThis, oMaxLenght, GoodChars);
//    }
//    function MASK_NUMERIC(oEvent, oThis, oMaxLenght, GoodChars) {
//        var strKey, iKeyCode, strPVal;
//        iKeyCode = oEvent.charCode == 0 || oEvent.keyCode == 13 || oEvent.charCode == null ? oEvent.keyCode : oEvent.charCode;
//        strKey = String.fromCharCode(iKeyCode);
//        strPVal = oThis.value;
//        if (!Local_Maxlength(strPVal, oMaxLenght))
//            return false;
//        return isGood_MASK_Numeric(GoodChars, strPVal, strKey);
//    }
//    function Local_Maxlength(oValue, oMaxlength) {
//        if (oValue == null || oValue == "")
//            return true;
//        else if (oValue.length >= oMaxlength)
//            return false;

//        return true;
//    }

//    function isGood_MASK_Numeric(GoodChars, strPVal, ival) {
//        if (ival == "") {
//            return false;
//        }
//        //alert(GoodChars.indexOf(ival));
//        if (GoodChars.indexOf(ival) == -1) {
//            return false;
//        }
//        else {
//            if (strPVal != "") {
//                if (ival == "." && strPVal.indexOf(".") != -1)
//                    return false;
//                else if (ival == "-" && strPVal.indexOf("-") != -1)
//                    return false;
//            }
//        }

//        return true;
//    }

    function DisableControls(IsEnable) {
        if (IsEnable) {
            if (window.document.getElementById('btnMainProcess') != null)
                StartProcessing();
        }
        else {
            if (window.document.getElementById('btnMainCancel') != null)
                StopProcessing();
        }
    }
    
   
    
    function StartProcessing() {
    window.document.getElementById('btnMainProcess').click();
    }
    function StopProcessing() {
    window.document.getElementById('btnMainCancel').click();
}
function days_between(f, f1, msg) {
    var fromDate = document.getElementById(f).value;
    var toDate = document.getElementById(f1).value;
    var FDt = fromDate.split("/");
    var TDt = toDate.split("/");
    li_arr = new Array(13)
    li_arr[0] = "TST";
    li_arr[1] = "01";
    li_arr[2] = "02";
    li_arr[3] = "03";
    li_arr[4] = "04";
    li_arr[5] = "05";
    li_arr[6] = "06";
    li_arr[7] = "07";
    li_arr[8] = "08";
    li_arr[9] = "09";
    li_arr[10] = "10";
    li_arr[11] = "11";
    li_arr[12] = "12";
    ld_date1 = fromDate.toUpperCase();
    ld_date1 = ld_date1.split("/");
    fld_day = ld_date1[0];
    fld_mon = ld_date1[1];
    fld_year = ld_date1[2];
    ld_date2 = toDate.toUpperCase();
    ld_date2 = ld_date2.split("/");
    tld_day = ld_date2[0];
    tld_mon = ld_date2[1];
    tld_year = ld_date2[2];
    var a, b;
    for (i = 1; i < 13; i++) {
        if (parseInt(fld_mon) == parseInt(li_arr[i])) {
            a = i;
            break;
        }
    }
    for (i = 0; i < 13; i++) {
        if (parseInt(tld_mon) == parseInt(li_arr[i])) {
            b = i;
            break;
        }
    }
    var d1 = new Date(FDt[2], a - 1, FDt[0]);
    var d2 = new Date(TDt[2], b - 1, TDt[0]);
    var day = 1000 * 60 * 60 * 24;
    var diff = Math.ceil((d2.getTime() - d1.getTime()) / (day));
    var ValidationMsg = '';
    if (parseInt(diff) > parseInt(Enumarations.SurfaceReportsDateRange.ReportsDays)) {
        ValidationMsg = " Duration between the " + msg + " range should be maximum 31 days.\n";

    }

    return ValidationMsg;
}
function Logout() {
   parent.showFrame();
  
    window.open('top.html', 'frmTop');
    window.open('content/Main.html', 'frmMain');
    window.open('side_menu.aspx', 'frmSideMenu');
//    parent.showFrame();
//    document.getElementById('Show').style.display = "none";
//    document.getElementById('Hide').style.display = "block";
}

