var req;
function Initialize1()
{
    var req; 
    try {  req= new ActiveXObject('Msxml2.XMLHTTP');   }
    catch (e) 
    {
        try {   req= new ActiveXObject('Microsoft.XMLHTTP');    }
        catch (e2) 
        {
          try {  req= new XMLHttpRequest();     }
          catch (e3) {  req = false;   }
        }
     }
     return req;

 }
 function Initialize()
{
	var req; 
	 try
    {
        req=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
        try
        {
            req=new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch(oc)
        {
            req=null;
        }
    }

    if(!req && typeof XMLHttpRequest!="undefined")
    {
        req= new XMLHttpRequest();

    }
    
    return req;
} 
 function getDataFromAJAX(url)
 {
   req=Initialize();
   if(req!=null)
   {
	   req.open("GET", url,  false); 
	   req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	   req.send(null); 
	   var msg=req.responseText;
	   return msg;
   }
 
} 
function populateStates(url)
{
	req=Initialize();
	
	if(req!=null)
	{
		//req.onreadystatechange = Process;
		req.open("GET", url, false);
		//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send(null);
		var msg=req.responseText;
		//alert(msg);
		msg=msg.replace(/^\s+|\s+$/g,"");
		
		//msg=msg.substring(4,msg.length);
		//alert(msg);
		document.getElementById("State").options.length=0;
		document.getElementById("State").innerHTML = "";
		
		document.getElementById("State").options[0]=new Option("Select State","Select"); 
		if(msg!="No values") 
		{ 
			var clist=msg.split("~"); 
			for(i=0;i<clist.length-1;i++) 
			{ 
				var myclist=clist[i].split("#"); 				
				document.getElementById("State").options[i+1]=new Option(myclist[1],myclist[0]); 
			}				 
		} 
	}
}

function populateUniversity(url,elementName)
{
	req=Initialize();
	if(req!=null)
	{
		req.open("GET", url, false);
		req.send(null);
		var msg=req.responseText;
		//alert(msg);
		msg=msg.replace(/^\s+|\s+$/g,"");
		//alert(msg);
		//document.getElementById(elementName).options.length=0;
		///document.getElementById(elementName).remove(optgroup);
		
		document.getElementById(elementName).innerHTML = "";
		document.getElementById(elementName).options[0]=new Option("Select ","Select"); 
        countVal=0;
		if(msg!="No values") 
		{ 
			var myclist=msg.split("#");
			var space1="          ";
			
			for(i=0;i<myclist.length-1;i++)
			{ 				
			/*	var StateUniversity = myclist[i].split("-");
				var StateName = StateUniversity[0];
				
				if(StateUniversity[1]=="State")
				{
					//document.getElementById(elementName).options[i+1]=new Option(StateName,StateName); 
					//document.getElementById(elementName).options[i+1].className="statesName";
					//document.getElementById(elementName).options[i+1].style.color="#AFCE5A";
					
					var list = document.createElement('optgroup');
					list.label =StateName;
					list.innerHTML = StateName;
					document.getElementById(elementName).appendChild(list);		
				}
				else
				{	
					//document.getElementById(elementName).options[i+1]=new Option(StateName,StateName);
					var list = document.createElement('option');
					list.value =StateName;
					list.innerHTML = StateName;
					list.className=(StateName=="Others")?("others"):("");
					list.style.fontWeight = (StateName=="Others")?("900"):("");
					document.getElementById(elementName).appendChild(list);	
				}	 */
				
		       if(myclist[i].match(":") == ":")
			   {
				 var list = document.createElement('optgroup');
					list.label =myclist[i];
					list.innerHTML = myclist[i];
					document.getElementById(elementName).appendChild(list);	  
				   
			   }
			   else
			   {
				   var list = document.createElement('option');
					list.value =myclist[i];
					list.innerHTML = myclist[i];
					document.getElementById(elementName).appendChild(list);	
			   }
		
				
				
				
			}
	
		} 
	}
}
//--------------------------------------------------------------------

function populateUniversityAjax1(url,elementName,data)
{
	document.getElementById(elementName).innerHTML = "";
	document.getElementById(elementName).options[0]=new Option("Select","Select"); 
    ajaxRequest(url,data,'GET');
    var responseData= ajaxRequest(url,data,'GET');
	msg=responseData.replace(/^\s+|\s+$/g,"");   	
	
	if(msg!="No values") 
	{ 
		var myclist=msg.split("#");
		var space1="          ";
		
		for(i=0;i<myclist.length-1;i++)
		{ 				
			var StateUniversity = myclist[i].split("-");
			var StateName = StateUniversity[0];
			
			if(StateUniversity[1]=="State")
			{
				//document.getElementById(elementName).options[i+1]=new Option(StateName,StateName); 
				//document.getElementById(elementName).options[i+1].className="statesName";
				//document.getElementById(elementName).options[i+1].style.color="#AFCE5A";
				
				var list = document.createElement('optgroup');
				list.label =StateName;
				list.innerHTML = StateName;
				document.getElementById(elementName).appendChild(list);		
			}
			else
			{	
				//document.getElementById(elementName).options[i+1]=new Option(StateName,StateName);
				var list = document.createElement('option');
				list.value =StateName;
				list.innerHTML = StateName;
				list.className=(StateName=="Others")?("others"):("");
				list.style.fontWeight = (StateName=="Others")?("900"):("");
				document.getElementById(elementName).appendChild(list);	
			}	
			
		}//end of for

	} // end of if	
		
	/*var responseMsg= new Ajax.Request(url, 
	{
		method: 'POST',
		onComplete: function(transport)
		{
			var responseData= transport.responseText;
			msg=responseData.replace(/^\s+|\s+$/g,"");
			
			if(msg!="No values") 
			{ 
				var myclist=msg.split("#");
				
				for(i=0;i<myclist.length-1;i++)
				{ 				
					var StateUniversity = myclist[i].split("-");
					var StateName = StateUniversity[0];
					
					if(StateUniversity[1]=="State")
					{
						var list = document.createElement('optgroup');
						list.label =StateName;
						list.innerHTML = StateName;
						document.getElementById(elementName).appendChild(list);	
					}
					else
					{	
						var list = document.createElement('option');
						list.value =StateName;
						list.innerHTML = StateName;
						list.className=(StateName=="Others")?("others"):("");
						list.style.fontWeight = (StateName=="Others")?("900"):("");
						document.getElementById(elementName).appendChild(list);
					}	
					
				}// end of for loop
	
			} // end of if loop
		} // end of onComplete
		,
		onFailure: function() 
		{ 
	     var acode="There was an error with the connection";
	     document.getElementById('responseMsg').style.display="inline";
         document.getElementById('responseMsg').innerHTML = acode;									
		} // end of onFailure
	 }// Ajax.Request
	); //Ajax.Request
	*/
}
 
function ajaxRequest(url,data,methodType) 
{     
	var retValue="";
	var aj = new Ajax.Request(     
		url, 
		{      
			method:methodType,   
			async:false, 
			parameters: data,       
			onComplete: function(oReq)
			{
				var retval = getResponse(oReq);
				retValue=retval;
				//alert(ret+"\n"+temp);					
			},		  
			onFailure: function() 
			{ 
		     var acode="There was an error with the connection";
		     response=acode;									
			} // end of onFailure  
		}
	);   
	
	//alert(retValue);
	return retValue;
}  
/* ajax.Response */ 
 function getResponse(oReq) 
{     
 return oReq.responseText;   
}    
//--------------------------------------------------------------------

function populateUniversityAjax(url,elementName)
{
	document.getElementById(elementName).innerHTML = "";
	document.getElementById(elementName).options[0]=new Option("Select","Select"); 
       		
	var responseMsg= new Ajax.Request(url, 
	{
		method: 'GET',
		async:true,
		onSuccess: function(transport)
		{
			var responseData= transport.responseText;
			msg=responseData.replace(/^\s+|\s+$/g,"");
			
			if(msg!="No values") 
			{ 
				var myclist=msg.split("#");
				
				for(i=0;i<myclist.length-1;i++)
				{ 				
					var StateUniversity = myclist[i].split("-");
					var StateName = StateUniversity[0];
					
					if(StateUniversity[1]=="State")
					{
						var list = document.createElement('optgroup');
						list.label =StateName;
						list.innerHTML = StateName;
						document.getElementById(elementName).appendChild(list);	
					}
					else
					{	
						var list = document.createElement('option');
						list.value =StateName;
						list.innerHTML = StateName;
						list.className=(StateName=="Others")?("others"):("");
						list.style.fontWeight = (StateName=="Others")?("900"):("");
						document.getElementById(elementName).appendChild(list);
					}	
					
				}// end of for loop
	
			} // end of if loop
		} // end of onComplete
		,
		onFailure: function() 
		{ 
	     var acode="There was an error with the connection";
	     document.getElementById('responseMsg').style.display="inline";
         document.getElementById('responseMsg').innerHTML = acode;									
		} // end of onFailure
	 }// Ajax.Request
	); //Ajax.Request

}
//--------------------------------------------------------------------

function populateData(url,elementName)
{
	req=Initialize();
	
	if(req!=null)
	{
		//req.onreadystatechange = Process;
		req.open("GET", url, false);
		req.send(null);
		var msg=req.responseText;
		//return msg;
		msg=msg.replace(/^\s+|\s+$/g,"");
		//alert(msg);
		msg=msg.substring(4,msg.length);
		//alert(msg);
		
		document.getElementById(elementName).options.length=0;
		document.getElementById(elementName).options[0]=new Option("Select AreaCode","Select");
		
		if(msg!="No values") 
		{ 
			var clist=msg.split("~"); 
			
			for(i=0;i<clist.length-1;i++) 
			{ 
				var myclist=clist[i].split("#"); 
				var AreaCodeData=myclist[1]+" "+myclist[0];
				document.getElementById(elementName).options[i+1]=new Option(AreaCodeData,myclist[0]); 
			}				 
		} 

	}
}

//--------------------------------------------------------------------

function checkMobileLength(eleValue,errorId)
{
  var notoneof= new Array('0000000000', '000000000','00000000','0000000');
  var flag=true;
  var acode="Enter only digits (0-9)<br />Mobile number should be 10 digits";
  document.getElementById(errorId).style.display="none";
  if(eleValue != "")
  {
	  if((isNaN(parseInt(eleValue)))||(String(eleValue).length < 10))
	  {
		document.getElementById(errorId).style.display="inline";
		document.getElementById(errorId).innerHTML = acode;			
		flag=false;	
	  }	
	  else
	  {
		for(var i=0;i<notoneof.length;i++)
		{
		    if(parseInt(eleValue) == notoneof[i])
		    {
				document.getElementById(errorId).style.display="inline";
				document.getElementById(errorId).innerHTML = acode;			
				flag=false;	
		    }
		}
	  }
  }
  else
  {
	  document.getElementById(errorId).style.display="inline";
	  document.getElementById(errorId).innerHTML = "&nbsp;&nbsp;Please enter mobile number";			
 	  flag=false;	
  }
  
  return flag;
}
//------------------------------------------------------------------

function checkMobileLength2(eleValue,errorId)
{
  var notoneof= new Array('0000000000', '000000000','00000000','0000000');
  var flag=true;
  var acode="Enter only digits (0-9)<br />Mobile number should be 10 digits";
  document.getElementById(errorId).style.display="none";
  if(eleValue != "")
  {
	  if((isNaN(parseInt(eleValue)))||(String(parseInt(eleValue)).length < 10))
	  {
		document.getElementById(errorId).style.display="inline";
		document.getElementById(errorId).innerHTML = acode;			
		flag=false;	
	  }	
	  else
	  {
		for(var i=0;i<notoneof.length;i++)
		{
		    if(parseInt(eleValue) == notoneof[i])
		    {
				document.getElementById(errorId).style.display="inline";
				document.getElementById(errorId).innerHTML = acode;			
				flag=false;	
		    }
		}
	  }
  }
  return flag;
}

///------------------------------------
function checkCountryCode(eleValue,errorId)
{
	flag=true;
	var acode="Please enter the country code.";
	 if(eleValue=='')
	 {
		document.getElementById(errorId).style.display="inline";
		document.getElementById(errorId).innerHTML = acode;			
		flag=false;	
	 }
	 acode="Enter only digits (0-9)";
	 if(isNaN(parseInt(eleValue)) && flag==true)
	 {
		document.getElementById(errorId).style.display="inline";
		document.getElementById(errorId).innerHTML = acode;			
		flag=false;	 
	 }
	 if(flag==true)
	 document.getElementById(errorId).innerHTML = "";
	 return flag;
}
//--------------------------------------------------------------------

function validateDate(dateVal,errorId,errorMsg,required)
{
    var flag=true;
	var dataUrl="../controller/PersonalController.php?action=Checkdate&DOB="+dateVal;
	var responseData=getDataFromAJAX(dataUrl);
	responseData=responseData.replace(/^\s+|\s+$/g,"");
   // document.getElementById(errorId).style.display="none";
	var acode=errorMsg+"should not be Future Date";
	if(dateVal!=""){
		if(document.getElementById('advice-required-FromDate'))
		document.getElementById('advice-required-FromDate').innerHTML="";
	}
	if(responseData.match("error"))
	{
		document.getElementById(errorId).style.display="inline";
		document.getElementById(errorId).innerHTML = acode;
		flag=false;	
	}
	else
	{
		if((required=="true")&&(dateVal==""))
		{
	        //var reqMsg="This is a required Field";
			//document.getElementById(errorId).style.display="inline";
			//document.getElementById(errorId).innerHTML = reqMsg;
		}
		else
		{
			document.getElementById(errorId).style.display="none";
		}
	}
  return flag;
}


//--------------------------------------------------------------------

function validateDateReq(dateVal,errorId,errorMsg,count)
{
    var flag=true;
	var dataUrl="../controller/PersonalController.php?action=Checkdate&DOB="+dateVal;
	var responseData=getDataFromAJAX(dataUrl);
	responseData=responseData.replace(/^\s+|\s+$/g,"");
    document.getElementById(errorId).style.display="none";
	var acode=errorMsg+"should not be Future Date";
	if(responseData.match("error"))
	{
		document.getElementById(errorId).style.display="inline";
		document.getElementById(errorId).innerHTML = acode;
		flag=false;	
	}
	else
	{
		if((parseInt(count)>0)&&(dateVal==""))
		{
	        var reqMsg="This is a required Field";
			document.getElementById(errorId).style.display="inline";
			document.getElementById(errorId).innerHTML = reqMsg;
		}
		else
		{
			document.getElementById(errorId).style.display="none";
		}
	}
  return flag;
}
//--------------------------------------------------------------------

  function validateDateDifference(fromDate,toDate,errorId)
  {
     var flag=true;
     document.getElementById(errorId).style.display="none";
     var alertReason = 'To Date must be greater than From Date.'
     var TO_DATE = new Date(toDate); 
     var FROM_DATE = new Date(fromDate);
 	 if(toDate!=""){
		if(document.getElementById('advice-required-ToDate'))
		document.getElementById('advice-required-ToDate').innerHTML="";
	 }
     if(FROM_DATE  != '' && TO_DATE  != '' && FROM_DATE  >= TO_DATE) 
     {	 
          document.getElementById(errorId).style.display="inline";
          document.getElementById(errorId).innerHTML = alertReason;	
          //document.getElementById("ToDate").value = "";	  
          flag=false;  
     }
     return flag;  
  }//end of validateDate function
  
//--------------------------------------------------------------------

function logOff(url)
{
	var flag=false;
	flag = window.confirm('Your information has been saved. Are you sure you want to exit?');
	//alert(flag);
	if(flag) 
	{	
		var response=getDataFromAJAX("../controller/RegisterController.php?action=invalidateSession");
		//alert(response);
		//document.forms[0].action=url;
		//document.forms[0].submit();
		location.href=url;
	}	
	
	return flag;
}
//--------------------------------------------------------------------

function SIBM_logOff(url)
{
	var flag=false;
	flag = window.confirm('Your information has been saved. Are you sure you want to exit?');
	//alert(flag);
	if(flag) 
	{	
		var response=getDataFromAJAX("../../controller/RegisterController.php?action=invalidateSession");
		//alert(response);
		document.forms[0].action=url;
		document.forms[0].submit();
	}	
	//return flag;
}

//--------------------------------------------------------------------

function SIBM_logOut(url)
{
	var flag=false;
	flag = window.confirm('Are you sure, you want to Log out?');
	//alert(flag);
	if(flag) 
	{	
		var response=getDataFromAJAX("../../controller/RegisterController.php?action=invalidateSession");
		//alert(response);
		document.forms[0].action=url;
		document.forms[0].submit();
	}	
	//return flag;
}


//--------------------------------------------------------------------
function logOut(url)
{
	var flag=false;
	flag = window.confirm('Are you sure, you want to Log out?');
	//alert(flag);
	if(flag) 
	{	
		var response=getDataFromAJAX("../controller/RegisterController.php?action=invalidateSession");
		//alert(response);
		document.forms[0].action=url;
		document.forms[0].submit();		
	}	
	//return flag;
}

//--------------------------------------------------------------------

//--------------------------------------------------------------------

function admin_LogOut(url)
{
	var flag=false;
	flag = window.confirm('Are you sure, you want to Log out?');
 //	alert(flag);
	if(flag) 
	{	
		var response=getDataFromAJAX("../../SIBM/controller/adminLoginController.php?action=invalidateSession");
		//alert(response);
		//document.forms[0].action=url;
		//document.forms[0].submit();	
		location.href=url;

			
	}	
	//return flag;
}

//--------------------------------------------------------------------


function testIsValidObject(objToTest) 
{
	if (objToTest == null || objToTest == undefined) 
	{
		return false;
	}
	return true;
}
//--------------------------------------------------------------------

function testIsValidObject1(objToTest) 
{
	//alert(typeof(objToTest));
	if (null == objToTest) 
	{
		return false;
	}
	if ("undefined" == typeof(objToTest) ) 
	{
		return false;
	}
	return true;
	
}
// global variable 
var _arrWin = new Array(); 

//--------------------------------------------------------------------
var suggestionsWin;
function openSuggestionsWindow(URLStr)
{
  //alert("openSuggestionsWindow");
 
  if(suggestionsWin)
  {
    if(!suggestionsWin.closed) suggestionsWin.close();
  }
  suggestionsWin= open(URLStr, 'suggestionsWin', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=850, height=450");
  suggestionsWin.focus();
  //_arrWin[_arrWin.length] = window.open(URLStr, 'suggestionsWin', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=850, height=450");;
}	
//--------------------------------------------------------------------

var contactWin=0;
function openContactusWindow(URLStr)
{ 
  if(contactWin)
  {
    if(!contactWin.closed) contactWin.close();
  }
  contactWin= open(URLStr, 'contactWin', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=850, height=550");
  contactWin.focus();  
}	
//--------------------------------------------------------------------

var faqsWin=0;
function openfaqWindow(URLStr)
{
  if(faqsWin)
  {
    if(!faqsWin.closed) faqsWin.close();
  }
  faqsWin= open(URLStr, 'faqsWin', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=1,status=1,copyhistory=0,width=1024");
  faqsWin.focus();
}	
//--------------------------------------------------------------------

var forgotPass;
function forgotPasswordWindow()
{
  var URLStr="view/forgotPassword.php?refreshFlag=true";

  if(forgotPass)
  {
    if(!forgotPass.closed) forgotPass.close();
  }
 forgotPass= open(URLStr, 'forgotPass', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=445,height=266");
 forgotPass.focus();
 
 //_arrWin[_arrWin.length] = window.open(URLStr, 'forgotPass', "screenX=50,screenY=50,left=50,top=50,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=445,height=266");
}

//--------------------------------------------------------------------
var catInfo;
function CategoryInfo()
{
 var URLStr="categoryinfo.php";
 
 if(catInfo)
 {
	   if(!catInfo.closed) catInfo.close();
 }
 
 catInfo= open(URLStr, 'catInfo', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=500,height=445");
 catInfo.focus();
 

}
//------------------------------------------------------------------------

//------------------------------------------------------------------------

var FormatInfo;
function FormatForStatement()
{
 var URLStr="FormatForState.php";
 
 if(FormatInfo)
 {
	   if(!FormatInfo.closed) FormatInfo.close();
 }
 
 FormatInfo= open(URLStr, 'FormatInfo', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=445,height=250");
 FormatInfo.focus();
 

}
//---
function paymentIns()
{
 var URLStr="../../Payment_Instructions.htm";
 window.open(URLStr, 'paymentIns', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=630,height=500");
}
// -----------------------------------------------------------------------

var Resume;
function ResumeInfo()
{
 var URLStr1="Resumeinfo.php";
 //alert("Hi ....."+ URLStr1);
// if(ResumeInfo)
 //{
	//   if(!ResumeInfo.closed) ResumeInfo.close();
 //}
 
 Resume = open(URLStr1, 'Resume', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=445,height=650");

Resume.focus();
 

}
// -----------------------------------------------------------------------
var finishInfo;
function FinishInfo()
{
 var URLStr="finishinfo.php";
 
 if(finishInfo)
 {
	   if(!finishInfo.closed) finishInfo.close();
 }
 
 finishInfo= open(URLStr, 'catInfo', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=445,height=245");
 finishInfo.focus();
 
}

//--------------------------------------------------------------------

var recoInfo;
function RecoInfo()
{
 var URLStr="recoinfo.php";
 
 if(recoInfo)
 {
	   if(!recoInfo.closed) recoInfo.close();
 }
 
 recoInfo= open(URLStr, 'catInfo', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=445,height=245");
 recoInfo.focus();
 
}




//--------------------------------------------------------------------
var applicationWin;
function openApplication(URLStr)
{
  //alert("openSuggestionsWindow");
  //var URL=URLStr+"?AppId="+appId+"&SFID="+SFID;
  if(applicationWin)
  {
    if(!applicationWin.closed) applicationWin.close();
  }
  applicationWin= open(URLStr, 'applicationWin', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=yes,toolbar=0,menubar=1,location=1,scrollbars=1,status=1,copyhistory=0,width=1004, height=1300");
  applicationWin.focus();
}	

//--------------------------------------------------------------------
var downloadWin;
function downloadWindow(URLStr)
{
  if(downloadWin)
  {
    if(!downloadWin.closed) downloadWin.close();
  }
  downloadWin= open(URLStr, 'downloadWin', "alwaysRaised=true,resizable=yes,toolbar=0,menubar=1,location=0,scrollbars=0,status=0,copyhistory=0");
  downloadWin.focus();
}	
//----------------------------------------------------------------------
var DocInfo;
function downloadWindow1()
{
 var URLStr="filenotfound.php";
 
 if(DocInfo)
 {
	   if(!DocInfo.closed) DocInfo.close();
 }
 
 DocInfo= open(URLStr, 'DocInfo', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=445,height=445");
 catInfo.focus();
 

}
//----------------------------------------------------------------------

var challanWindow;
function openChallanWindow(URLStr)
{
  if(challanWindow)
  {
    if(!challanWindow.closed) challanWindow.close(); 
  }
  challanWindow= open(URLStr, "challanWindow", "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=yes,toolbar=0,menubar=1,location=1,scrollbars=1,status=1,copyhistory=0,width=1004, height=1300");
  challanWindow.focus();
}	

//--------------------------------------------------------------------
function closeWindow() 
{

	/*
	window.open('','_parent','');

	window.close();
*/

	var flag=false;
	var flag  = confirm("Are you sure you want to exit?\nYour information will not be saved.");
//alert(r);

	//flag = window.confirm('Are you sure, you want to Exit?');
	//alert(flag);
	if(flag) 
	{	
		if(suggestionsWin)
		{
			if(!suggestionsWin.closed) suggestionsWin.close();
		}	
		if(contactWin)
		{
			if(!contactWin.closed) contactWin.close();
		}	  
		if(faqsWin)
		{
			if(!faqsWin.closed) faqsWin.close();
		}
		if(forgotPass)
		{
			if(!forgotPass.closed) forgotPass.close();
		}
		if(applicationWin)
		{
			if(!applicationWin.closed) applicationWin.close();
		}
		if(challanWindow)
		{
			if(!challanWindow.closed) challanWindow.close();
		}
		if(downloadWin)
		{
			if(!downloadWin.closed) downloadWin.close();
		}		
		/*var win1; 
		for (var i=0;i<_arrWin.length;i++) 
		{ 
			win1 = _arrWin[i]; 
			alert(win1);
		// check if window wasn't already closed 
			if(win1) 
			{ 
				if(!win1.closed) win1.close(); 
			} 	
		}
		
		for (var i_tem = 0; i_tem < _arrWin.length; i_tem++)
		{
			if(_arrWin[i_tem]&&!_arrWin[i_tem].closed)
			{
				try
				{
					_arrWin[i_tem].close();
				}
				catch(e){alert("error"+e);}
			}
		}
		*/
		var response=getDataFromAJAX("../controller/RegisterController.php?action=invalidateSession");
		var win=window.open("about:blank","_parent");
		win.close();
	}	
}

//--------------------------------------------------------------------------------------------------
function closeChildWindows()
{
	if(suggestionsWin)
	{
		if(!suggestionsWin.closed) suggestionsWin.close();
	}	
	if(contactWin)
	{
		if(!contactWin.closed) contactWin.close();
	}	  
	if(faqsWin)
	{
		if(!faqsWin.closed) faqsWin.close();
	}
	if(forgotPass)
	{
		if(!forgotPass.closed) forgotPass.close();
	}
	if(applicationWin)
	{
		if(!applicationWin.closed) applicationWin.close();
	}
	if(challanWindow)
	{
		if(!challanWindow.closed) challanWindow.close();
	}
	if(downloadWin)
	{
		if(!downloadWin.closed) downloadWin.close();
	}
}

//--------------------------------------------------------------------------------------------------

function get_cookie(Name) 
{
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) 
	{
		offset = document.cookie.indexOf(search)
		// if cookie exists
		if (offset != -1) 
		{ 
		offset += search.length
		// set index of beginning of value
		end = document.cookie.indexOf(";", offset);
		// set index of end of cookie value
		if (end == -1) end = document.cookie.length;
		returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
}
//--------------------------------------------------------------------

function are_cookies_enabled()
{
	var cookieEnabled = (navigator.cookieEnabled) ? true : false;

	if (typeof navigator.cookieEnabled == "undefined" && !cookieEnabled)
	{ 
		document.cookie="testcookie";
		cookieEnabled = (document.cookie.indexOf("testcookie") != -1) ? true : false;
	}
	return (cookieEnabled);
}

//--------------------------------------------------------------------

function validateSession(url)
{	
	var flag=true;
	var response=getDataFromAJAX("../controller/RegisterController.php?action=validateSession");
	response=response.replace(/^\s+|\s+$/g,"");
    if(response.match("true"))
    {	
		flag=false;
		alert("Session has been Expired")
		location.href=url;
    } else if(response.match("logout"))
    {
    	flag=false;
    	var response=getDataFromAJAX("../controller/RegisterController.php?action=invalidateSession");
    	alert("Another User has logged in with same Login details\nHence you'll be logged out");
    	window.location.href=url;
    }
    return flag;
}
//--------------------------------------------------------------------

function validateSIBMSession(url)
{	
	var flag=true;
	var response=getDataFromAJAX("../../controller/RegisterController.php?action=validateSession");
	response=response.replace(/^\s+|\s+$/g,"");
	//alert(response);		
    if(response.match("true"))
    {	
		flag=false;
		alert("Session has been Expired")
		location.href=url;
    }
    return flag;
}

//--------------------------------------------------------------------
function validateAdminSession(url)
{	
	var flag=true;
	var response=getDataFromAJAX("../../../controller/RegisterController.php?action=validateSession");
	response=response.replace(/^\s+|\s+$/g,"");
    if(response.match("true"))
    {	
		flag=false;
		alert("Session has been Expired")
		location.href=url;
    } else if(response.match("logout"))
    {
    	flag=false;
    	var response=getDataFromAJAX("../controller/RegisterController.php?action=invalidateSession");
    	alert("Another User has logged in with same Login details\nHence you'll be logged out");
    	window.location.href=url;
    }
    return flag;

}
//--------------------------------------------------------------------
var helpWindow;
function openHelp(URLStr)
{
  if(helpWindow)
  {
    if(!helpWindow.closed) helpWindow.close();
  }
  helpWindow= open(URLStr, 'helpWindow', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=0,toolbar=0,menubar=1,location=1,scrollbars=1,status=1,copyhistory=0,width=1025, height=758");
  helpWindow.focus();
}	
function openPaymentWindow(URLStr)
{
 window.open(URLStr, 'helpWindow', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=0,toolbar=0,menubar=0,location=0,scrollbars=1,status=1,copyhistory=0,width=1025, height=758");

}	
function openHelpEvaluate(URLStr)
{
	var win= window.open(URLStr, 'helpWindow', "screenX=0,screenY=0,left=100,top=0,alwaysRaised=true,resizable=0,toolbar=0,menubar=0,location=0,scrollbars=1,status=1,copyhistory=0,width=750, height=700");
	win.focus();
}	
function openRequiredDocs(URLStr)
{
	var win= window.open(URLStr, 'reqdoc', "screenX=0,screenY=0,left=100,top=150,alwaysRaised=true,resizable=0,toolbar=0,menubar=0,location=0,scrollbars=1,status=1,copyhistory=0,width=700, height=350");
	win.focus();
}	
function gotoPage(url)
	{
		location.href=url;
	}
var emailSmsWin;
function openEmailSmsWindow(URLStr)
{
  if(emailSmsWin)
  {
    if(!emailSmsWin.closed) emailSmsWin.close();
  }
  emailSmsWin= open(URLStr, 'emailSmsWin', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=1,status=1,copyhistory=0,width=1020, height=630");
  emailSmsWin.focus();
  //_arrWin[_arrWin.length] = window.open(URLStr, 'suggestionsWin', "screenX=0,screenY=0,left=0,top=0,alwaysRaised=true,resizable=no,toolbar=0,menubar=0,location=0,scrollbars=0,status=1,copyhistory=0,width=850, height=450");;
}	
