<!--
window.onerror = "return true";
function myopen(i) {
var i;
width=420;
height=280;
    x = (640 - width)/2, y = (480 - height)/2;
    if (screen) {
        y = (screen.availHeight - height)/2;
        x = (screen.availWidth - width)/2;
    }
	if (screen.availWidth > 1800) { 
	x = ((screen.availWidth/2) - width)/2; 
    }
window.open(i,'newWin','width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x+',scrollbars=1');
}

function setf() {     
     document.Franchise.txt_login.focus();
}


function ValidateFranchise(){
var user=document.Franchise.txt_login.value;
var pass=document.Franchise.txt_pass.value;
if(user=='' && pass=='')
    {
    	alert('Invalid login id/password.');
	     document.Franchise.txt_login.focus();
    	return false;
    }
	else if(user=='')
		{
			alert('Please enter login id.');
		    document.Franchise.txt_login.focus();
			return false;
    	}
else
	{
	alert('Invalid login id.');
	document.Franchise.txt_login.focus();
	return true;
	}
}
/*
function checkIt() {
if (window.event.keyCode==13)
	ValidateFranchise();return true;
}
*/


function ForgotPassword() {
var user=document.Franchise.txt_login.value;
if(user=='')
    {
    	alert('Please enter a valid login id to proceed.');
	    document.Franchise.txt_login.focus();
    	return false;
    }
else
	{
		alert('Invalid login id.');
		document.Franchise.txt_login.focus();
		return true;
	}
}
function junk(fieldValue){
junkChars="\\\"<>~`!#$%^&*/?;";
	//return true if any junk character found in given value otherwise false
	if(fieldValue!=""){
		for(i=0;i<junkChars.length;i++)
			if(fieldValue.indexOf(junkChars.charAt(i))!=-1)
				return true;
	}
	return false;
}
function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}
function xmlhttpPost(strURL,callerFunction) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('get', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            switch(callerFunction)
			{
				case 1 : upd_newsletter(self.xmlHttpReq.responseText); break;
			}	
        }
    }
    self.xmlHttpReq.send(null);
}
function upd_newsletter(val)
{
	document.Newsletter.txt_email.value="";
	alert('Thank you for signing up for our newsletter. You now will be included in our regular newsletter dispatches.');
	 return false;
}
function ValidateNewsletter() {
var user=document.Newsletter.txt_email.value;
if(user=='')
    {
    	alert('Please enter a valid email id.');
	    document.Newsletter.txt_email.focus();
    	return false;
    }
	else if(junk(document.Newsletter.txt_email.value))
	{
		alert("Please avoid to enter \\\"<>~`!#$%^&*/?; in Email Id");
	    document.Newsletter.txt_email.focus();
    	return false;
	}
	else if(!isEmailAddr(document.Newsletter.txt_email.value))
	{
    	alert('Please enter a valid email id.');
	    document.Newsletter.txt_email.focus();
    	return false;
	}
	else
	{
		val=document.Newsletter.txt_email.value;
		xmlhttpPost("mod/newsletter/getAjaxResult.php?type=1&value="+val, 1);
	}
}
function ValidatorElearning() {
if(document.frm.name.value=='')
    {
    	alert('Please enter name.');
	    document.frm.name.focus();
    	return false;
    }
	
	if(junk(document.frm.name.value))
	{
		alert("Please avoid to enter \\\"<>~`!#$%^&*/?; in Name");
	    document.frm.name.focus();
    	return false;
	}
	if(document.frm.phone.value=='')
    {
    	alert('Please enter phone.');
	    document.frm.phone.focus();
    	return false;
    }
	if(isNaN(document.frm.phone.value)==true)
    {
    	alert('Please enter numeric value in phone.');
	    document.frm.phone.focus();
    	return false;
    }
	if(document.frm.email.value=='')
    {
    	alert('Please enter a valid email id');
	    document.frm.email.focus();
    	return false;
    }
	if(junk(document.frm.email.value))
	{
		alert("Please avoid to enter \\\"<>~`!#$%^&*/?; in Email Id");
	    document.frm.email.focus();
    	return false;
	}
	if(!isEmailAddr(document.frm.email.value))
	{
    	alert('Please enter a valid email id.');
	    document.frm.email.focus();
    	return false;
	}
	
	if(junk(document.frm.company.value))
	{
		alert("Please avoid to enter \\\"<>~`!#$%^&*/?; in Company");
	    document.frm.company.focus();
    	return false;
	}
	if(junk(document.frm.address.value))
	{
		alert("Please avoid to enter \\\"<>~`!#$%^&*/?; in Address");
	    document.frm.address.focus();
    	return false;
	}
	if(document.frm.address.value.length>255)
	{
		alert("Please enter characters less than 255 in address.");
	    document.frm.address.focus();
    	return false;
	}

	if(junk(document.frm.url.value))
	{
		alert("Please avoid to enter \\\"<>~`!#$%^&*/?; in Website url");
	    document.frm.url.focus();
    	return false;
	}
	if(isNaN(document.frm.employees.value)==true)
	{
		alert("Please enter numeric value in No of Employees");
	    document.frm.employees.focus();
    	return false;
	}
	if(isNaN(document.frm.offices.value)==true)
	{
		alert("Please enter numeric value in No of Offices");
	    document.frm.offices.focus();
    	return false;
	}
	if(junk(document.frm.details.value))
	{
		alert("Please avoid to enter \\\"<>~`!#$%^&*/?; in Details");
	    document.frm.details.focus();
    	return false;
	}
	if(document.frm.details.value.length>255)
	{
		alert("Please enter characters less than 255 in details.");
	    document.frm.details.focus();
    	return false;
	}
	if(junk(document.frm.time.value))
	{
		alert("Please avoid to enter \\\"<>~`!#$%^&*/?; in Time to Call");
	    document.frm.time.focus();
    	return false;
	}
}
function SaveRecords()
{
		if (document.frmInfo.TxtCompanyName.value=="")
		{
			alert('Please enter company Name');
			document.frmInfo.TxtCompanyName.focus();
			return false;
		}
		
		if (document.frmInfo.TxtFormationDt.value=="")
		{
			alert('Please enter formation date.');
			document.frmInfo.TxtFormationDt.focus();
			return false;
		}
		
		if (document.frmInfo.TxtCompRegNo.value=="")
		{
			alert('Please enter company registration number.');
			document.frmInfo.TxtCompRegNo.focus();
			return false;
		}
		
		if (document.frmInfo.TxtVat.value=="")
		{
			alert('Please enter vat number.');
			document.frmInfo.TxtVat.focus();
			return false;
		}

		if (document.frmInfo.TxtShareHolders.value=="")
		{
			alert('Please enter number of shareholders.');
			document.frmInfo.TxtShareHolders.focus();
			return false;
		}
		else
		{
			if(CheckNumericValue(document.frmInfo.TxtShareHolders.value)==false)
			{
				alert('Please enter Numeric value in shareholders.');
				document.frmInfo.TxtShareHolders.focus();
				return false;
			}

		}

		if (document.frmInfo.TxtAddress.value=="")
		{
			alert('Please enter address.');
			document.frmInfo.TxtAddress.focus();
			return false;
		}

		if (document.frmInfo.TxtCity.value=="")
		{
			alert('Please enter city.');
			document.frmInfo.TxtCity.focus();
			return false;
		}
		if (document.frmInfo.TxtPostCode.value!="")
		{
			if(CheckNumericValue(document.frmInfo.TxtPostCode.value)==false)
			{
				alert('Please enter Numeric value in post code.');
				document.frmInfo.TxtPostCode.focus();
				return false;
			}
		}

		if (document.frmInfo.TxtPhoneCountry.value=="")
		{
			alert('Please enter country code of Phone.');
			document.frmInfo.TxtPhoneCountry.focus();
			return false;
		}
		else
		{
			if (CheckNumericValue(document.frmInfo.TxtPhoneCountry.value)==false)
			{
				alert('Please enter Numeric value in country code of Phone.');
				document.frmInfo.TxtPhoneCountry.focus();
				return false;
			}
		}
		
		if (document.frmInfo.txtPhoneArea.value!="")
		{
			if (CheckNumericValue(document.frmInfo.txtPhoneArea.value)==false)
			{
				alert('Please enter Numeric value in area code of Phone.');
				document.frmInfo.txtPhoneArea.focus();
				return false;
			}
		}
		
		if (document.frmInfo.TxtPhoneNumber.value=="")
		{
			alert('Please enter Phone number.');
			document.frmInfo.TxtPhoneNumber.focus();
			return false;
		}
		else
		{
			if (CheckNumericValue(document.frmInfo.TxtPhoneNumber.value)==false)
			{
				alert('Please enter Numeric value in Phone.');
				document.frmInfo.TxtPhoneNumber.focus();
				return false;
			}
		}
		
		if (document.frmInfo.TxtFaxCountry.value!="")
		{
			if (CheckNumericValue(document.frmInfo.TxtFaxCountry.value)==false)
			{
				alert('Please enter Numeric value in country code of Fax.');
				document.frmInfo.TxtFaxCountry.focus();
				return false;
			}
		}
		
		if (document.frmInfo.txtFaxArea.value!="")
		{
			if (CheckNumericValue(document.frmInfo.txtFaxArea.value)==false)
			{
				alert('Please enter Numeric value in area code Fax.');
				document.frmInfo.txtFaxArea.focus();
				return false;
			}
		}
		
		if (document.frmInfo.TxtFaxNumber.value!="")
		{
			if (CheckNumericValue(document.frmInfo.TxtFaxNumber.value)==false)
			{
				alert('Please enter Numeric value in Fax.');
				document.frmInfo.TxtFaxNumber.focus();
				return false;
			}
		}
		
		if (document.frmInfo.TxtMobileCountry.value!="")
		{
			if (CheckNumericValue(document.frmInfo.TxtMobileCountry.value)==false)
			{
				alert('Please enter Numeric value in country code of Mobile.');
				document.frmInfo.TxtMobileCountry.focus();
				return false;
			}
		}
		
		if (document.frmInfo.txtMobileArea.value!="")
		{
			if (CheckNumericValue(document.frmInfo.txtMobileArea.value)==false)
			{
				alert('Please enter Numeric value in area code of Mobile.');
				document.frmInfo.txtMobileArea.focus();
				return false;
			}
		}
		
		if (document.frmInfo.TxtMobileNumber.value=="")
		{
			if (CheckNumericValue(document.frmInfo.TxtMobileNumber.value)==false)
			{
				alert('Please enter Numeric value in Mobile.');
				document.frmInfo.TxtMobileNumber.focus();
				return false;
			}
		}
		
			
		if (document.frmInfo.TxtEmailId.value=="")
		{
			alert('Please enter Email ID.');
			document.frmInfo.TxtEmailId.focus();
			return false;
		}
		else
		{
			if (!isEmailAddr(document.frmInfo.TxtEmailId.value))
			{
				alert('Please enter valid Email ID.');
				document.frmInfo.TxtEmailId.focus();
				return false;
			}
		}
		
		if (document.frmInfo.TxtTurnOver05.value!="")
		{
			if (CheckNumericValue(document.frmInfo.TxtTurnOver05.value)==false)
			{
				alert('Please enter Numeric value in Business Turnover in 2005.');
				document.frmInfo.TxtTurnOver05.focus();
				return false;
			}
		}
	if (document.frmInfo.TxtExpectTurnover.value!="")
		{
			if (CheckNumericValue(document.frmInfo.TxtExpectTurnover.value)==false)
			{
				alert('Please enter Numeric value in Expected Business Turnover in 2006.');
				document.frmInfo.TxtExpectTurnover.focus();
				return false;
			}
		}
if (document.frmInfo.TxtNoOfEmployee.value!="")
		{
			if (CheckNumericValue(document.frmInfo.TxtNoOfEmployee.value)==false)
			{
				alert('Please enter Numeric value in Total number of employees.');
				document.frmInfo.TxtNoOfEmployee.focus();
				return false;
			}
		}


if (document.frmInfo.RoleNo_0.value!="")
		{
			if (CheckNumericValue(document.frmInfo.RoleNo_0.value)==false)
			{
				alert('Please enter Numeric value in # of employees.');
				document.frmInfo.RoleNo_0.focus();
				return false;
			}
		}
if (document.frmInfo.RoleNo_1.value!="")
		{
			if (CheckNumericValue(document.frmInfo.RoleNo_1.value)==false)
			{
				alert('Please enter Numeric value in # of employees.');
				document.frmInfo.RoleNo_1.focus();
				return false;
			}
		}
if (document.frmInfo.RoleNo_2.value!="")
		{
			if (CheckNumericValue(document.frmInfo.RoleNo_2.value)==false)
			{
				alert('Please enter Numeric value in # of employees.');
				document.frmInfo.RoleNo_2.focus();
				return false;
			}
		}
if (document.frmInfo.RoleNo_3.value!="")
		{
			if (CheckNumericValue(document.frmInfo.RoleNo_3.value)==false)
			{
				alert('Please enter Numeric value in # of employees.');
				document.frmInfo.RoleNo_3.focus();
				return false;
			}
		}
if (document.frmInfo.RoleNo_4.value!="")
		{
			if (CheckNumericValue(document.frmInfo.RoleNo_4.value)==false)
			{
				alert('Please enter Numeric value in # of employees.');
				document.frmInfo.RoleNo_4.focus();
				return false;
			}
		}

document.frmInfo.submit();
}
function CheckNumericValue(strValue)
{
	var objRegExp  = /^\d*$/;
	return objRegExp.test(strValue);
}
function EnableTextArea(val)
{
	if(val.checked==true)
	{
		document.frmInfo.TxtOTHERDESCRIPTION.disabled=false;
	}
	else
	{
		document.frmInfo.TxtOTHERDESCRIPTION.disabled=true;
	}
}
function SaveRecords5()
{
	if (document.frmInfo.AmountSpent_0.value!="")
		{
			if (CheckNumericValue(document.frmInfo.AmountSpent_0.value)==false)
			{
				alert('Please enter Numeric value in AmountSpent.');
				document.frmInfo.AmountSpent_0.focus();
				return false;
			}
		}
	if (document.frmInfo.AmountSpent_1.value!="")
		{
			if (CheckNumericValue(document.frmInfo.AmountSpent_1.value)==false)
			{
				alert('Please enter Numeric value in AmountSpent.');
				document.frmInfo.AmountSpent_1.focus();
				return false;
			}
		}
	if (document.frmInfo.AmountSpent_2.value!="")
		{
			if (CheckNumericValue(document.frmInfo.AmountSpent_2.value)==false)
			{
				alert('Please enter Numeric value in AmountSpent.');
				document.frmInfo.AmountSpent_2.focus();
				return false;
			}
		}

	if (document.frmInfo.AmountSpent_3.value!="")
		{
			if (CheckNumericValue(document.frmInfo.AmountSpent_3.value)==false)
			{
				alert('Please enter Numeric value in AmountSpent.');
				document.frmInfo.AmountSpent_3.focus();
				return false;
			}
		}
if (document.frmInfo.AmountSpent_4.value!="")
		{
			if (CheckNumericValue(document.frmInfo.AmountSpent_4.value)==false)
			{
				alert('Please enter Numeric value in AmountSpent.');
				document.frmInfo.AmountSpent_4.focus();
				return false;
			}
		}
document.frmInfo.submit();
}
function saveinfo6()
{
		for(i=1;i<9;i++)
		{
			obj="";
			obj=eval("document.frmInfo.TxtBsprospects"+i);
			if (CheckNumericValue(obj.value)==false)
			{
				alert('Please enter Numeric value in Number of prospects.');
				obj.focus();
				return false;
			}

			objTxtBsclosures=eval("document.frmInfo.TxtBsclosures"+i);
			if (CheckNumericValue(objTxtBsclosures.value)==false)
			{
				alert('Please enter Numeric value in Number of closures.');
				objTxtBsclosures.focus();
				return false;
			}
			objTxtBsAvg=eval("document.frmInfo.TxtBsAvg"+i);
			if (CheckNumericValue(objTxtBsAvg.value)==false)
			{
				alert('Please enter Numeric value in Average value.');
				objTxtBsAvg.focus();
				return false;
			}
		}
			if (CheckNumericValue(document.frmInfo.TxtInetSeats.value)==false)
			{
				alert('Please enter Numeric value in Number of Licences.');
				document.frmInfo.TxtInetSeats.focus();
				return false;
			}
		if (CheckNumericValue(document.frmInfo.TxtInetTotalSize.value)==false)
			{
				alert('Please enter Numeric value in Total Storage Size.');
				document.frmInfo.TxtInetTotalSize.focus();
				return false;
			}

		for(i=1;i<8;i++)
		{
			obj="";
			obj=eval("document.frmInfo.TxtRemProspects"+i);
			
			if (CheckNumericValue(obj.value)==false)
			{
				alert('Please enter Numeric value in Number of prospects.');
				obj.focus();
				return false;
			}

			objTxtRemClosures=eval("document.frmInfo.TxtRemClosures"+i);
			if (CheckNumericValue(objTxtRemClosures.value)==false)
			{
				alert('Please enter Numeric value in Number of closures.');
				objTxtRemClosures.focus();
				return false;
			}
			
		}
document.frmInfo.submit();
}
/*
function checkIt1() {
if (window.event.keyCode==13)
	ValidateNewsletter();return true;
}
*/
//-->
