//Common Functions for Form Validations
/*
NS4 = (document.layers);
IE4 = (document.all);
ver4 = (NS4 || IE4);
IE5 = (IE4 && navigator.appVersion.indexOf("5.")!=-1);
isMac = (navigator.appVersion.indexOf("Mac") != -1);
isMenu = (NS4 || (IE4 && !isMac) || (IE5 && isMac));
function popUp(){return};
function popDown(){return};
if (!ver4) event=null;
if (isMenu) 
{
	menuVersion = 3;
	menuWidth = 120;
	childOverlap = 10;
	childOffset = -1;
	perCentOver = null;
	secondsVisible = .2;
	fntCol = "blue";
	fntSiz = "8";
	fntBold = true;
	fntItal = false;
	fntFam = "verdana";
	backCol = "#EFF7FF";
	overCol = "#EFF7FF";
	overFnt = "purple";
	borWid = 1;
	borCol = "yellow";
	borSty = "solid";
	itemPad = 3;
	imgSrc = "../images/spacer.gif";
	imgSiz = 10;
	separator = 1;
	separatorCol = "#ffffff";
	isFrames = false;
	navFrLoc = "left";
	keepHilite = true;
	NSfontOver = true;
	clickStart = false;
	clickKill = false;
}

if (isMenu) 	
{
	document.write("<SCRIPT LANGUAGE='JavaScript1.2' SRC='http://sys11/roi/common/hierArrays.js'><\/SCRIPT>");
}

if (isMenu) 
{
	document.write("<SCRIPT LANGUAGE='JavaScript1.2' SRC='http://sys11/roi/common/hierMenus.js'><\/SCRIPT>");
}
*/
function isEMail(sMail)
{
	var epat =/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	return epat.test(sMail);	
}
function isIP(nNum)
{
	var nNum1, nNum2;
	nNum1 = 0;
	for(nNum2=0;nNum2<nNum.length;nNum2++)
	{
		if ((nNum.charCodeAt(nNum2) >= 48) && (nNum.charCodeAt(nNum2) <= 57))
		{
			nNum1++;
		}
		else if (nNum.charCodeAt(nNum2) == 46)
		{
			nNum1++;
		}
	}
	if (nNum1 == nNum2)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function isNumber(nNum)
{
	var nNum1, nNum2;
	nNum1 = 0;
	for(nNum2=0;nNum2<nNum.length;nNum2++)
	{
		if ((nNum.charCodeAt(nNum2) >= 48) && (nNum.charCodeAt(nNum2) <= 57))
		{				
			nNum1++;
		}
	}
	if (nNum1 == nNum2)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function isFloat(nFloat)
{
	var nFloat1, nFloat2, nFloat3;
	nFloat1 = 0;
	nFloat3 = 0;
	for(nFloat2=0;nFloat2<nFloat.length;nFloat2++)
	{
		if ((nFloat.charCodeAt(nFloat2) >= 48) && (nFloat.charCodeAt(nFloat2) <= 57))
		{				
			nFloat1++;
		}
		else if (nFloat.charCodeAt(nFloat2) == 46)
		{
			nFloat1++;
			nFloat3++;
		}
	}
	if (nFloat3 == 0)
	{
		nFloat3 = 10;
	}
	if ((nFloat1 == nFloat2) && (nFloat3 == 1))
	{
		return true;
	}
	else
	{
		return false;
	}
}
function isString(sString)
{
	var sString1, sString2;
	sString1 = 0;
	for(sString2=0;sString2<sString.length;sString2++)
	{
		if (((sString.charCodeAt(sString2) >= 65) && (sString.charCodeAt(sString2) <= 90)) || ((sString.charCodeAt(sString2) >= 97) && (sString.charCodeAt(sString2) <= 122)) || (sString.charCodeAt(sString2) == 32))
		{
			sString1++;
		}
	}
	if (sString1 == sString2)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function isString1(sString)
{
	var sString1, sString2;
	sString1 = 0;
	for(sString2=0;sString2<sString.length;sString2++)
	{
		if (((sString.charCodeAt(sString2) >= 65) && (sString.charCodeAt(sString2) <= 90)) || ((sString.charCodeAt(sString2) >= 97) && (sString.charCodeAt(sString2) <= 122)))
		{
			sString1++;
		}
		else if ((sString.charCodeAt(sString2) >= 48) && (sString.charCodeAt(sString2) <= 57))
		{
			sString1++;
		}
	}
	if (sString1 == sString2)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function isAlphaNumeric(sString)
{
	var sString1, sString2;
	sString1 = 0;
	for(sString2=0;sString2<sString.length;sString2++)
	{
		if (((sString.charCodeAt(sString2) >= 97) && (sString.charCodeAt(sString2) <= 122)) || ((sString.charCodeAt(sString2) >= 30) && (sString.charCodeAt(sString2) <= 96)))
		{
			sString1++;
		}
		else
		{
		}
	}
	if (sString1 == sString2)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function isEmpty(sEmpty)
{
	var sEmp1, sEmp2;
	sEmp1 = 0;
	for(sEmp2=0;sEmp2<sEmpty.length;sEmp2++)
	{
		if (sEmpty.charAt(sEmp2) == " ")
		{
			sEmp1++;
		}
	}
	if (sEmp1 == sEmp2)
	{
		return true;
	}
	else
	{
		return false;
	}	
}
function dvalidate(nParam)
{
	if (nParam == 40) // View Summary Results Page
	{
		if (document.frm.tid[document.frm.tid.selectedIndex].value == "*")
		{
			alert("Please Select a Campaign");
			document.frm.tid.focus();
			return false;
		}
		else
		{
			document.frm.action = "dvres1.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
}
function validate(nParam)
{
	if (nParam == 5) // Signup Form
	{
		if ((isEmpty(document.frmsign.cname.value)) || (!isAlphaNumeric(document.frmsign.cname.value)))
		{
			alert("Please Enter the Company Name");
			document.frmsign.cname.value = "";
			document.frmsign.cname.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.addr1.value)) || (!isAlphaNumeric(document.frmsign.addr1.value)))
		{
			alert("Please Enter the Company Address");
			document.frmsign.addr1.value = "";
			document.frmsign.addr1.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.city.value)) || (!isString(document.frmsign.city.value)))
		{
			alert("Please Enter the City Name");
			document.frmsign.city.value = "";
			document.frmsign.city.focus();
			return false;
		}
		else if (document.frmsign.state[document.frmsign.state.selectedIndex].value == "*")
		{
			alert("Please Select a State/Province");
			document.frmsign.state.focus();
			return false;
		}
		else if ((document.frmsign.state[document.frmsign.state.selectedIndex].value == "Others") && ((isEmpty(document.frmsign.ostate.value)) || (!isString(document.frmsign.ostate.value))))
		{
			alert("Please Enter the State Name");
			document.frmsign.ostate.value = "";
			document.frmsign.ostate.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.fname.value)) || (!isString(document.frmsign.fname.value)))
		{
			alert("Please Enter the Contact First Name");
			document.frmsign.fname.value = "";
			document.frmsign.fname.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.ph.value)) || (!isNumber(document.frmsign.ph.value)))
		{
			alert("Please Enter the Phone Number");
			document.frmsign.ph.value = "";
			document.frmsign.ph.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.eid.value)) || (!isEMail(document.frmsign.eid.value)))
		{
			alert("Please Enter Valid Email Address");
			document.frmsign.eid.value = "";
			document.frmsign.eid.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.una.value)) || (!isString1(document.frmsign.una.value)))
		{
			alert("Please Enter the User Name");
			document.frmsign.una.value = "";
			document.frmsign.una.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.pwd.value)) || (!isString1(document.frmsign.pwd.value)))
		{
			alert("Please Enter the Password");
			document.frmsign.pwd.value = "";
			document.frmsign.pwd.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.cpd.value)) || (!isString1(document.frmsign.cpd.value)))
		{
			alert("Please Enter the Confirmation Password");
			document.frmsign.cpd.value = "";
			document.frmsign.cpd.focus();
			return false;
		}
		else if (document.frmsign.pwd.value != document.frmsign.cpd.value)
		{
			alert("Password and the Confirmation Password Must be Same");
			document.frmsign.pwd.value = "";
			document.frmsign.cpd.value = "";
			document.frmsign.pwd.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.cfname.value)) || (!isAlphaNumeric(document.frmsign.cfname.value)))
		{
			alert("Please Enter Credit Card Holder\'s First Name");
			document.frmsign.cfname.value = "";
			document.frmsign.cfname.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.clname.value)) || (!isAlphaNumeric(document.frmsign.clname.value)))
		{
			alert("Please Enter Credit Card Holder\'s Last Name");
			document.frmsign.clname.value = "";
			document.frmsign.clname.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.ccno.value)) || (isNaN(document.frmsign.ccno.value)) || (document.frmsign.ccno.value.length < 16))
		{
			alert("Please Enter the Credit Card No.");
			document.frmsign.ccno.value = "";
			document.frmsign.ccno.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.ccna.value)) || (!isAlphaNumeric(document.frmsign.ccna.value)))
		{
			alert("Please Enter the Name as in Credit Card");
			document.frmsign.ccna.value = "";
			document.frmsign.ccna.focus();
			return false;
		}
		else
		{
			document.frmsign.action = "roisignact.php";
			document.frmsign.method = "POST";
			document.frmsign.submit();
		}
	}
	else if (nParam == 6) // Trial Signup Form
	{
		if ((isEmpty(document.frmsign.cname.value)) || (!isAlphaNumeric(document.frmsign.cname.value)))
		{
			alert("Please Enter the Company Name");
			document.frmsign.cname.value = "";
			document.frmsign.cname.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.addr1.value)) || (!isAlphaNumeric(document.frmsign.addr1.value)))
		{
			alert("Please Enter the Company Address");
			document.frmsign.addr1.value = "";
			document.frmsign.addr1.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.city.value)) || (!isString(document.frmsign.city.value)))
		{
			alert("Please Enter the City Name");
			document.frmsign.city.value = "";
			document.frmsign.city.focus();
			return false;
		}
		else if (document.frmsign.state[document.frmsign.state.selectedIndex].value == "*")
		{
			alert("Please Select a State/Province");
			document.frmsign.state.focus();
			return false;
		}
		else if ((document.frmsign.state[document.frmsign.state.selectedIndex].value == "Others") && ((isEmpty(document.frmsign.ostate.value)) || (!isString(document.frmsign.ostate.value))))
		{
			alert("Please Enter the State Name");
			document.frmsign.ostate.value = "";
			document.frmsign.ostate.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.fname.value)) || (!isString(document.frmsign.fname.value)))
		{
			alert("Please Enter the Contact First Name");
			document.frmsign.fname.value = "";
			document.frmsign.fname.focus();
			return false;
		}
		/*else if ((isEmpty(document.frmsign.ph.value)) || (!isNumber(document.frmsign.ph.value)))
		{
			alert("Please Enter the Phone Number");
			document.frmsign.ph.value = "";
			document.frmsign.ph.focus();
			return false;
		}*/
		else if ((isEmpty(document.frmsign.eid.value)) || (!isEMail(document.frmsign.eid.value)))
		{
			alert("Please Enter Valid Email Address");
			document.frmsign.eid.value = "";
			document.frmsign.eid.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.una.value)) || (!isString1(document.frmsign.una.value)))
		{
			alert("Please Enter the User Name");
			document.frmsign.una.value = "";
			document.frmsign.una.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.pwd.value)) || (!isString1(document.frmsign.pwd.value)))
		{
			alert("Please Enter the Password");
			document.frmsign.pwd.value = "";
			document.frmsign.pwd.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.cpd.value)) || (!isString1(document.frmsign.cpd.value)))
		{
			alert("Please Enter the Confirmation Password");
			document.frmsign.cpd.value = "";
			document.frmsign.cpd.focus();
			return false;
		}
		else if (document.frmsign.pwd.value != document.frmsign.cpd.value)
		{
			alert("Password and the Confirmation Password Must be Same");
			document.frmsign.pwd.value = "";
			document.frmsign.cpd.value = "";
			document.frmsign.pwd.focus();
			return false;
		}
		else
		{
			document.frmsign.action = "tsignact.php";
			document.frmsign.method = "POST";
			document.frmsign.submit();
		}
	}
	else if (nParam == 7) // Trial Upgrade Form
	{
		if ((isEmpty(document.frmsign.cname.value)) || (!isAlphaNumeric(document.frmsign.cname.value)))
		{
			alert("Please Enter the Company Name");
			document.frmsign.cname.value = "";
			document.frmsign.cname.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.addr1.value)) || (!isAlphaNumeric(document.frmsign.addr1.value)))
		{
			alert("Please Enter the Company Address");
			document.frmsign.addr1.value = "";
			document.frmsign.addr1.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.city.value)) || (!isString(document.frmsign.city.value)))
		{
			alert("Please Enter the City Name");
			document.frmsign.city.value = "";
			document.frmsign.city.focus();
			return false;
		}
		else if (document.frmsign.state[document.frmsign.state.selectedIndex].value == "*")
		{
			alert("Please Select a State/Province");
			document.frmsign.state.focus();
			return false;
		}
		else if ((document.frmsign.state[document.frmsign.state.selectedIndex].value == "Others") && ((isEmpty(document.frmsign.ostate.value)) || (!isString(document.frmsign.ostate.value))))
		{
			alert("Please Enter the State Name");
			document.frmsign.ostate.value = "";
			document.frmsign.ostate.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.fname.value)) || (!isString(document.frmsign.fname.value)))
		{
			alert("Please Enter the Contact First Name");
			document.frmsign.fname.value = "";
			document.frmsign.fname.focus();
			return false;
		}
		/*else if ((isEmpty(document.frmsign.ph.value)) || (!isNumber(document.frmsign.ph.value)))
		{
			alert("Please Enter the Phone Number");
			document.frmsign.ph.value = "";
			document.frmsign.ph.focus();
			return false;
		}*/
		else if ((isEmpty(document.frmsign.eid.value)) || (!isEMail(document.frmsign.eid.value)))
		{
			alert("Please Enter Valid Email Address");
			document.frmsign.eid.value = "";
			document.frmsign.eid.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.cfname.value)) || (!isAlphaNumeric(document.frmsign.cfname.value)))
		{
			alert("Please Enter Credit Card Holder\'s First Name");
			document.frmsign.cfname.value = "";
			document.frmsign.cfname.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.clname.value)) || (!isAlphaNumeric(document.frmsign.clname.value)))
		{
			alert("Please Enter Credit Card Holder\'s Last Name");
			document.frmsign.clname.value = "";
			document.frmsign.clname.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.ccno.value)) || (isNaN(document.frmsign.ccno.value)) || (document.frmsign.ccno.value.length < 16))
		{
			alert("Please Enter the Credit Card No.");
			document.frmsign.ccno.value = "";
			document.frmsign.ccno.focus();
			return false;
		}
		else if ((isEmpty(document.frmsign.ccna.value)) || (!isAlphaNumeric(document.frmsign.ccna.value)))
		{
			alert("Please Enter the Name as in Credit Card");
			document.frmsign.ccna.value = "";
			document.frmsign.ccna.focus();
			return false;
		}
		else
		{
			document.frmsign.action = "upact.php";
			document.frmsign.method = "POST";
			document.frmsign.submit();
		}
	}
	else if (nParam == 10) // Forgot Password
	{
		if ((isEmpty(document.frmpass.una.value)) || (!isString1(document.frmpass.una.value)))
		{
			alert("Please Enter the User Name");
			document.frmpass.una.value = "";
			document.frmpass.una.focus();
			return false;
		}
		else
		{
			document.frmpass.nFrom.value = 5;
			document.frmpass.action = "fpact.php";
			document.frmpass.method = "POST";
			document.frmpass.submit();
		}
	}
	else if (nParam == 11) // Forgot Password
	{
		if ((isEmpty(document.frmpass.eid.value)) || (!isEMail(document.frmpass.eid.value)))
		{
			alert("Please Enter the Email Address");
			document.frmpass.eid.value = "";
			document.frmpass.eid.focus();
			return false;
		}
		else
		{
			document.frmpass.nFrom.value = 10;
			document.frmpass.action = "fpact.php";
			document.frmpass.method = "POST";
			document.frmpass.submit();
		}
	}
	else if (nParam == 15) // Change Password
	{
		if ((isEmpty(document.frmpass.pwd1.value)) || (!isString1(document.frmpass.pwd1.value)))
		{
			alert("Please Enter the Current Password");
			document.frmpass.pwd1.value = "";
			document.frmpass.pwd1.focus();
			return false;
		}
		else if ((isEmpty(document.frmpass.pwd2.value)) || (!isString1(document.frmpass.pwd2.value)))
		{
			alert("Please Enter the New Password");
			document.frmpass.pwd2.value = "";
			document.frmpass.pwd2.focus();
			return false;
		}
		else if ((isEmpty(document.frmpass.pwd3.value)) || (!isString1(document.frmpass.pwd3.value)))
		{
			alert("Please Enter the Confirmation Password");
			document.frmpass.pwd3.value = "";
			document.frmpass.pwd3.focus();
			return false;
		}
		else if (document.frmpass.pwd2.value != document.frmpass.pwd3.value)
		{
			alert("New Password and the Confirmation Password must be same");
			document.frmpass.pwd2.value = "";
			document.frmpass.pwd3.value = "";
			document.frmpass.pwd2.focus();
			return false;
		}
		else
		{
			document.frmpass.action = "cpact.php";
			document.frmpass.method = "POST";
			document.frmpass.submit();
		}
	}
	else if (nParam == 20) // My Information
	{
		if ((isEmpty(document.frminfo.cname.value)) || (!isAlphaNumeric(document.frminfo.cname.value)))
		{
			alert("Please Enter the Company Name");
			document.frminfo.cname.value = "";
			document.frminfo.cname.focus();
			return false;
		}
		else if ((isEmpty(document.frminfo.addr1.value)) || (!isAlphaNumeric(document.frminfo.addr1.value)))
		{
			alert("Please Enter the Company Address");
			document.frminfo.addr1.value = "";
			document.frminfo.addr1.focus();
			return false;
		}
		else if ((isEmpty(document.frminfo.city.value)) || (!isString(document.frminfo.city.value)))
		{
			alert("Please Enter the City Name");
			document.frminfo.city.value = "";
			document.frminfo.city.focus();
			return false;
		}
		else if (document.frminfo.state[document.frminfo.state.selectedIndex].value == "*")
		{
			alert("Please Select a State/Province");
			document.frminfo.state.focus();
			return false;
		}
		else if ((document.frminfo.state[document.frminfo.state.selectedIndex].value == "Others") && ((isEmpty(document.frminfo.ostate.value)) || (!isString(document.frminfo.ostate.value))))
		{
			alert("Please Enter the State Name");
			document.frminfo.ostate.value = "";
			document.frminfo.ostate.focus();
			return false;
		}
		else if ((isEmpty(document.frminfo.fname.value)) || (!isString(document.frminfo.fname.value)))
		{
			alert("Please Enter the Contact First Name");
			document.frminfo.fname.value = "";
			document.frminfo.fname.focus();
			return false;
		}
		else if ((isEmpty(document.frminfo.fname.value)) || (!isString(document.frminfo.fname.value)))
		{
			alert("Please Enter the Contact First Name");
			document.frminfo.fname.value = "";
			document.frminfo.fname.focus();
			return false;
		}
		else if ((isEmpty(document.frminfo.ph.value)) || (!isNumber(document.frminfo.ph.value)))
		{
			alert("Please Enter the Phone Number");
			document.frminfo.ph.value = "";
			document.frminfo.ph.focus();
			return false;
		}
		else if ((isEmpty(document.frminfo.eid.value)) || (!isEMail(document.frminfo.eid.value)))
		{
			alert("Please Enter Valid Email Address");
			document.frminfo.eid.value = "";
			document.frminfo.eid.focus();
			return false;
		}
		else
		{
			document.frminfo.action = "myinfact.php";
			document.frminfo.method = "POST";
			document.frminfo.submit();
		}
	}
	else if (nParam == 25) // ROI Track Page 1 
	{
		if ((isEmpty(document.frmtrk.cname.value)) || (!isAlphaNumeric(document.frmtrk.cname.value)))
		{
			alert("Please Enter Name of Your ROI Campaign");
			document.frmtrk.cname.value = "";
			document.frmtrk.cname.focus();
			return false;
		}
		else if (document.frmtrk.top[document.frmtrk.top.selectedIndex].value == "*")
		{
			alert("Please Select a Campaign Type");
			document.frmtrk.top.focus();
			return false;
		}
		else
		{
			document.frmtrk.action = "track1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
	else if (nParam == 30)
	{
		if (document.frmpay.pop[document.frmpay.pop.selectedIndex].value == "*")
		{
			alert("Please Select a Payment Option");
			document.frmpay.pop.focus();
			return false;
		}
		else if ((isEmpty(document.frmpay.fname.value)) || (!isAlphaNumeric(document.frmpay.fname.value)))
		{
			alert("Please Enter the First Name");
			document.frmpay.fname.value = "";
			document.frmpay.fname.focus();
			return false;
		}
		else if ((isEmpty(document.frmpay.lname.value)) || (!isAlphaNumeric(document.frmpay.lname.value)))
		{
			alert("Please Enter the Last Name");
			document.frmpay.lname.value = "";
			document.frmpay.lname.focus();
			return false;
		}
		else if ((isEmpty(document.frmpay.ccno.value)) || (isNaN(document.frmpay.ccno.value)) || (document.frmpay.ccno.value.length < 16))
		{
			alert("Please Enter the Credit Card No.");
			document.frmpay.ccno.value = "";
			document.frmpay.ccno.focus();
			return false;
		}
		else if ((isEmpty(document.frmpay.ccna.value)) || (!isAlphaNumeric(document.frmpay.ccna.value)))
		{
			alert("Please Enter the Name as in Credit Card");
			document.frmpay.ccna.value = "";
			document.frmpay.ccna.focus();
			return false;
		}
		else
		{
			if (confirm("Want to proceed?"))
			{
				document.frmpay.action = "tpay1.php";
				document.frmpay.method = "POST";
				document.frmpay.submit();
			}
		}
	}
	else if (nParam == 35)
	{
		if ((isEmpty(document.frmpay.fname.value)) || (!isAlphaNumeric(document.frmpay.fname.value)))
		{
			alert("Please Enter the First Name");
			document.frmpay.fname.value = "";
			document.frmpay.fname.focus();
			return false;
		}
		else if ((isEmpty(document.frmpay.lname.value)) || (!isAlphaNumeric(document.frmpay.lname.value)))
		{
			alert("Please Enter the Last Name");
			document.frmpay.lname.value = "";
			document.frmpay.lname.focus();
			return false;
		}
		else if ((isEmpty(document.frmpay.ccno.value)) || (isNaN(document.frmpay.ccno.value)) || (document.frmpay.ccno.value.length < 16))
		{
			alert("Please Enter the Credit Card No.");
			document.frmpay.ccno.value = "";
			document.frmpay.ccno.focus();
			return false;
		}
		else if ((isEmpty(document.frmpay.ccna.value)) || (!isAlphaNumeric(document.frmpay.ccna.value)))
		{
			alert("Please Enter the Name as in Credit Card");
			document.frmpay.ccna.value = "";
			document.frmpay.ccna.focus();
			return false;
		}
		else
		{
			if (confirm("Want to proceed?"))
			{
				document.frmpay.action = "cpay1.php";
				document.frmpay.method = "POST";
				document.frmpay.submit();
			}
		}
	}
	else if (nParam == 40) // View Summary Results Page
	{
		if (document.frm.tid[document.frm.tid.selectedIndex].value == "*")
		{
			alert("Please Select a Campaign");
			document.frm.tid.focus();
			return false;
		}
		else
		{
			document.frm.action = "vres1.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
	else if (nParam == 45) //Analyze Results Page
	{
	}
	else if (nParam == 50)
	{
		if ((isEmpty(document.frm.cname.value)) || (!isAlphaNumeric(document.frm.cname.value)))
		{
			alert("Please Enter Your Name");
			document.frm.cname.value = "";
			document.frm.cname.focus();
			return false;
		}
		else if ((isEmpty(document.frm.ceid.value)) || (!isEMail(document.frm.ceid.value)))
		{
			alert("Please Enter Valid Email Address");
			document.frm.ceid.value = "";
			document.frm.ceid.focus();
			return false;
		}
		else if ((isEmpty(document.frm.csub.value)) || (!isAlphaNumeric(document.frm.csub.value)))
		{
			alert("Please Enter Your Message Subject");
			document.frm.csub.value = "";
			document.frm.csub.focus();
			return false;
		}
		else if (isEmpty(document.frm.cmsg.value))
		{
			alert("Please Enter Your Message");
			document.frm.cmsg.value = "";
			document.frm.cmsg.focus();
			return false;
		}
		else
		{
			document.frm.action = "contact.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
	else if (nParam == 55)
	{
		nLength = document.frm.tip.length;
		sVals = "";
		if (nLength != 0)
		{
			nCount = 0;
			for(i=0;i<nLength;i++)
			{
				if (nCount == 0)
				{
					sVals = document.frm.tip[i].value;
				}
				else
				{
					sVals += ","+document.frm.tip[i].value;
				}
				nCount++;
			}
		}
		document.frm.nSubmitted.value = 5;
		document.frm.sSelected.value = sVals;
		document.frm.action = "banip.php";
		document.frm.method = "POST";
		document.frm.submit();
	}
	else if (nParam == 60)
	{
		if (isEmpty(document.frm.r1.value) || isNaN(document.frm.r1.value))
		{
			alert("Please Enter the Value for 0 - 1000 Clicks Rate");
			document.frm.r1.value = "";
			document.frm.r1.focus();
			return false;
		}
		else if (isEmpty(document.frm.r2.value) || isNaN(document.frm.r2.value))
		{
			alert("Please Enter the Value for 1001 - 10000 Clicks Rate");
			document.frm.r2.value = "";
			document.frm.r2.focus();
			return false;
		}
		else if (isEmpty(document.frm.r3.value) || isNaN(document.frm.r3.value))
		{
			alert("Please Enter the Value for 10001 - 25000 Clicks Rate");
			document.frm.r3.value = "";
			document.frm.r3.focus();
			return false;
		}
		else if (isEmpty(document.frm.r4.value) || isNaN(document.frm.r4.value))
		{
			alert("Please Enter the Value for 25001 - 50000 Clicks Rate");
			document.frm.r4.value = "";
			document.frm.r4.focus();
			return false;
		}
		else if (isEmpty(document.frm.r5.value) || isNaN(document.frm.r5.value))
		{
			alert("Please Enter the Value for 25001 - 50000 Clicks Rate");
			document.frm.r5.value = "";
			document.frm.r5.focus();
			return false;
		}
		else if (isEmpty(document.frm.r6.value) || isNaN(document.frm.r6.value))
		{
			alert("Please Enter the Value for 75001 - 100000 Clicks Rate");
			document.frm.r6.value = "";
			document.frm.r6.focus();
			return false;
		}
		else
		{
			document.frm.nSubmitted.value = 5;
			document.frm.action = "crate.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
	else if (nParam == 65)
	{
		if (isEmpty(document.frm.prate.value) || isNaN(document.frm.prate.value))
		{
			alert("Please Enter the Value for Premium User Signup Rate");
			document.frm.prate.value = "";
			document.frm.prate.focus();
			return false;
		}
		else if (isEmpty(document.frm.brate.value) || isNaN(document.frm.brate.value))
		{
			alert("Please Enter the Value for Basic User Signup Rate");
			document.frm.brate.value = "";
			document.frm.brate.focus();
			return false;
		}
		else
		{
			document.frm.nSubmitted.value = 5;
			document.frm.action = "srate.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
}

function validate1(nParam)
{
	if (nParam == 5) // Validation for eMail Lists
	{
		if ((isEmpty(document.frmtrk.aname.value)) || (!isAlphaNumeric(document.frmtrk.aname.value)))
		{
			alert("Please Enter the Advertiser Name");
			document.frmtrk.aname.value = "";
			document.frmtrk.aname.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.aeid.value)) || (!isEMail(document.frmtrk.aeid.value)))
		{
			alert("Please Enter Valid Email Address");
			document.frmtrk.aeid.value = "";
			document.frmtrk.aeid.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.aurl.value)) || (!isAlphaNumeric(document.frmtrk.aurl.value)))
		{
			alert("Please Enter the Advertiser URL");
			document.frmtrk.aurl.value = "";
			document.frmtrk.aurl.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.mfile.value)) || (!isAlphaNumeric(document.frmtrk.mfile.value)))
		{
			alert("Please attach eMail Message File");
			document.frmtrk.mfile.value = "";
			document.frmtrk.mfile.focus();
			return false;
		}
		else if ((!(document.frmtrk.mfile.value.substring(document.frmtrk.mfile.value.lastIndexOf(".")+1,document.frmtrk.mfile.value.length) == "htm")) && (!(document.frmtrk.mfile.value.substring(document.frmtrk.mfile.value.lastIndexOf(".")+1,document.frmtrk.mfile.value.length) == "html")))
		{
			alert("Your eMail Message File must be in HTML format");
			document.frmtrk.mfile.value = "";
			document.frmtrk.mfile.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.total.value)) || (isNaN(document.frmtrk.total.value)))
		{
			alert("Please Enter No. of eMail Lists");
			document.frmtrk.total.value = "";
			document.frmtrk.total.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.amt.value)) || (isNaN(document.frmtrk.amt.value)))
		{
			alert("Please Enter Amount Spent");
			document.frmtrk.amt.value = "";
			document.frmtrk.amt.focus();
			return false;
		}
		else
		{
			document.frmtrk.nOption.value = 10;
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.enctype = "multipart/form-data";
			document.frmtrk.submit();
		}
	}
	else if (nParam == 10) // Validation for Search Engines
	{
		if ((isEmpty(document.frmtrk.surl.value)) || (!isAlphaNumeric(document.frmtrk.surl.value)))
		{
			alert("Please Enter the Search Engine URL");
			document.frmtrk.surl.value = "";
			document.frmtrk.surl.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.kwd.value)) || (!isAlphaNumeric(document.frmtrk.kwd.value)))
		{
			alert("Please Enter the Keywords to Track");
			document.frmtrk.kwd.value = "";
			document.frmtrk.kwd.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.amt.value)) || (isNaN(document.frmtrk.amt.value)))
		{
			alert("Please Enter Amount Spent");
			document.frmtrk.amt.value = "";
			document.frmtrk.amt.focus();
			return false;
		}
		else
		{
			document.frmtrk.nOption.value = 20;
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
	else if (nParam == 15) // Validation for Partner News Letters
	{
		if ((isEmpty(document.frmtrk.aname.value)) || (!isAlphaNumeric(document.frmtrk.aname.value)))
		{
			alert("Please Enter the Partner Name");
			document.frmtrk.aname.value = "";
			document.frmtrk.aname.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.aeid.value)) || (!isEMail(document.frmtrk.aeid.value)))
		{
			alert("Please Enter Valid Email Address");
			document.frmtrk.aeid.value = "";
			document.frmtrk.aeid.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.aurl.value)) || (!isAlphaNumeric(document.frmtrk.aurl.value)))
		{
			alert("Please Enter the Partner Website URL");
			document.frmtrk.aurl.value = "";
			document.frmtrk.aurl.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.total.value)) || (isNaN(document.frmtrk.total.value)))
		{
			alert("Please Enter No. of Newsletter Recipients");
			document.frmtrk.total.value = "";
			document.frmtrk.total.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.amt.value)) || (isNaN(document.frmtrk.amt.value)))
		{
			alert("Please Enter Amount Spent");
			document.frmtrk.amt.value = "";
			document.frmtrk.amt.focus();
			return false;
		}
		else
		{
			document.frmtrk.nOption.value = 15;
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
	else if (nParam == 25) // Validation for Banners
	{
		if ((isEmpty(document.frmtrk.aname.value)) || (!isAlphaNumeric(document.frmtrk.aname.value)))
		{
			alert("Please Enter the Advertiser Name");
			document.frmtrk.aname.value = "";
			document.frmtrk.aname.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.aeid.value)) || (!isEMail(document.frmtrk.aeid.value)))
		{
			alert("Please Enter Valid Email Address");
			document.frmtrk.aeid.value = "";
			document.frmtrk.aeid.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.aurl.value)) || (!isAlphaNumeric(document.frmtrk.aurl.value)))
		{
			alert("Please Enter the Advertiser Website URL");
			document.frmtrk.aurl.value = "";
			document.frmtrk.aurl.focus();
			return false;
		}
		else
		{
			document.frmtrk.nOption.value = 25;
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
	else if (nParam == 30) // Validation for Banners Option Value is set to 5
	{
		if ((isEmpty(document.frmtrk.wurl.value)) || (!isAlphaNumeric(document.frmtrk.wurl.value)))
		{
			alert("Please Enter the Website URL");
			document.frmtrk.wurl.value = "";
			document.frmtrk.wurl.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.iwidth.value)) || (isNaN(document.frmtrk.iwidth.value)))
		{
			alert("Please Enter the Banner Image Width in pixels");
			document.frmtrk.iwidth.value = "";
			document.frmtrk.iwidth.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.iheight.value)) || (isNaN(document.frmtrk.iheight.value)))
		{
			alert("Please Enter the Banner Image Height in pixels");
			document.frmtrk.iheight.value = "";
			document.frmtrk.iheight.focus();
			return false;
		}
		else
		{
			document.frmtrk.nOption.value = nParam;
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
}

function validate2(nParam)
{
	if ((nParam == 5) || (nParam == 6))// eMail Lists Link Details
	{
		if ((isEmpty(document.frmtrk.lname.value)) || (!isAlphaNumeric(document.frmtrk.lname.value)))
		{
			alert("Please Enter the Link Caption");
			document.frmtrk.lname.value = "";
			document.frmtrk.lname.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.lurl.value)) || (!isAlphaNumeric(document.frmtrk.lurl.value)))
		{
			alert("Please Enter the Link URL");
			document.frmtrk.lurl.value = "";
			document.frmtrk.lurl.focus();
			return false;
		}
		else
		{
			if (nParam == 5)
			{
				document.frmtrk.nOption.value = 11;
			}
			else
			{
				document.frmtrk.nOption.value = 12;
			}
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
	else if (nParam == 10) // Search Engine
	{
		if ((isEmpty(document.frmtrk.surl.value)) || (!isAlphaNumeric(document.frmtrk.surl.value)))
		{
			alert("Please Enter the Search Engine URL");
			document.frmtrk.surl.value = "";
			document.frmtrk.surl.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.kwd.value)) || (!isAlphaNumeric(document.frmtrk.kwd.value)))
		{
			alert("Please Enter the Keywords to Track");
			document.frmtrk.kwd.value = "";
			document.frmtrk.kwd.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.amt.value)) || (isNaN(document.frmtrk.amt.value)))
		{
			alert("Please Enter Amount Spent");
			document.frmtrk.amt.value = "";
			document.frmtrk.amt.focus();
			return false;
		}
		else
		{
			document.frmtrk.nOption.value = 21;
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
	else if ((nParam == 15) || (nParam == 16)) // Partner Newsletters Link
	{
		if ((isEmpty(document.frmtrk.lname.value)) || (!isAlphaNumeric(document.frmtrk.lname.value)))
		{
			alert("Please Enter the Link Caption");
			document.frmtrk.lname.value = "";
			document.frmtrk.lname.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.lurl.value)) || (!isAlphaNumeric(document.frmtrk.lurl.value)))
		{
			alert("Please Enter the Link URL");
			document.frmtrk.lurl.value = "";
			document.frmtrk.lurl.focus();
			return false;
		}
		else
		{
			if (nParam == 15)
			{
				document.frmtrk.nOption.value = 16;
			}
			else
			{
				document.frmtrk.nOption.value = 17;
			}
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
	else if (nParam == 19) // Newsletter Upload
	{
		if ((isEmpty(document.frmtrk.mfile.value)) || (!isAlphaNumeric(document.frmtrk.mfile.value)))
		{
			alert("Please attach eMail Message File");
			document.frmtrk.mfile.value = "";
			document.frmtrk.mfile.focus();
			return false;
		}
		else if ((!(document.frmtrk.mfile.value.substring(document.frmtrk.mfile.value.lastIndexOf(".")+1,document.frmtrk.mfile.value.length) == "htm")) && (!(document.frmtrk.mfile.value.substring(document.frmtrk.mfile.value.lastIndexOf(".")+1,document.frmtrk.mfile.value.length) == "html")))
		{
			alert("Your eMail Message File must be in HTML format");
			document.frmtrk.mfile.value = "";
			document.frmtrk.mfile.focus();
			return false;
		}
		else
		{
			document.frmtrk.nOption.value = 19;
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.enctype = "multipart/form-data";
			document.frmtrk.submit();
		}
	}
	else if ((nParam == 25) || (nParam == 26)) // Banner Details
	{
		if ((isEmpty(document.frmtrk.bname.value)) || (!isAlphaNumeric(document.frmtrk.bname.value)))
		{
			alert("Please Enter the Banner Name");
			document.frmtrk.bname.value = "";
			document.frmtrk.bname.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.burl.value)) || (!isAlphaNumeric(document.frmtrk.burl.value)))
		{
			alert("Please Enter the Banner Image URL");
			document.frmtrk.burl.value = "";
			document.frmtrk.burl.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.turl.value)) || (!isAlphaNumeric(document.frmtrk.turl.value)))
		{
			alert("Please Enter the Banner Target URL");
			document.frmtrk.turl.value = "";
			document.frmtrk.turl.focus();
			return false;
		}
		/*
		else if ((isEmpty(document.frmtrk.purl.value)) || (!isAlphaNumeric(document.frmtrk.purl.value)))
		{
			alert("Please Enter the Banner Display Page URL");
			document.frmtrk.purl.value = "";
			document.frmtrk.purl.focus();
			return false;
		}
		*/
		else if ((isEmpty(document.frmtrk.amt.value)) || (isNaN(document.frmtrk.amt.value)))
		{
			alert("Please Enter Amount Spent");
			document.frmtrk.amt.value = "";
			document.frmtrk.amt.focus();
			return false;
		}
		else
		{
			if (nParam == 25)
			{
				document.frmtrk.nOption.value = 26;
			}
			else
			{
				document.frmtrk.nOption.value = 27;
			}
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
	else if ((nParam == 31) || (nParam == 32)) // Banner Option 5 Details
	{
		if ((isEmpty(document.frmtrk.bname.value)) || (!isAlphaNumeric(document.frmtrk.bname.value)))
		{
			alert("Please Enter the Banner Name");
			document.frmtrk.bname.value = "";
			document.frmtrk.bname.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.burl.value)) || (!isAlphaNumeric(document.frmtrk.burl.value)))
		{
			alert("Please Enter the Banner Image URL");
			document.frmtrk.burl.value = "";
			document.frmtrk.burl.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.turl.value)) || (!isAlphaNumeric(document.frmtrk.turl.value)))
		{
			alert("Please Enter the Banner Target URL");
			document.frmtrk.turl.value = "";
			document.frmtrk.turl.focus();
			return false;
		}
		else if ((isEmpty(document.frmtrk.amt.value)) || (isNaN(document.frmtrk.amt.value)))
		{
			alert("Please Enter Value for Amount Spent");
			document.frmtrk.amt.value = "";
			document.frmtrk.amt.focus();
			return false;
		}
		else
		{
			document.frmtrk.nOption.value = nParam;
			document.frmtrk.action = "tdet1.php";
			document.frmtrk.method = "POST";
			document.frmtrk.submit();
		}
	}
}

function butSkip1() // Skip & Go Next
{
	document.frmtrk.action = "tres.php";
	document.frmtrk.method = "POST";
	document.frmtrk.submit();
}

function butCancel(nParam) // Cancel Action from Details Page
{
	//document.frmtrk.nOption.value = nParam;
	document.frmtrk.nOption.value = 5;
	document.frmtrk.action = "tdet1.php";
	document.frmtrk.method = "POST";
	document.frmtrk.submit();
}

function butCancel1(nParam) // Cancel Action from Payment Page
{
	document.frmpay.nOption.value = 5;
	document.frmpay.action = "tdet1.php";
	document.frmpay.method = "POST";
	document.frmpay.submit();
}

function delLink(nParam) // eMail Lists
{
	document.frmtrk.nOption.value = 13;
	document.frmtrk.aid.value = nParam;
	document.frmtrk.action = "tdet1.php";
	document.frmtrk.method = "POST";
	document.frmtrk.submit();
}

function delLink1(nParam) // Partner Newsletter
{
	document.frmtrk.nOption.value = 18;
	document.frmtrk.aid.value = nParam;
	document.frmtrk.action = "tdet1.php";
	document.frmtrk.method = "POST";
	document.frmtrk.submit();
}

function delLink2(nParam) // Search Engine
{
	document.frmtrk.nOption.value = 22;
	document.frmtrk.aid.value = nParam;
	document.frmtrk.action = "tdet1.php";
	document.frmtrk.method = "POST";
	document.frmtrk.submit();
}

function delLink3(nParam) // Banners
{
	document.frmtrk.nOption.value = 28;
	document.frmtrk.aid.value = nParam;
	document.frmtrk.action = "tdet1.php";
	document.frmtrk.method = "POST";
	document.frmtrk.submit();
}

function delLink4(nParam) // Banners Option 5
{
	document.frmtrk.nOption.value = 33;
	document.frmtrk.aid.value = nParam;
	document.frmtrk.action = "tdet1.php";
	document.frmtrk.method = "POST";
	document.frmtrk.submit();
}

function vewContent(nRecID)
{
	window.open("vmsg.php?id="+nRecID,null,"height=300,width=416,toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=yes,top=0,left=0");
}

function butBack() // View Results Page "vres2.php"
{
	document.frm.action = "vres1.php";
	document.frm.method = "POST";
	document.frm.submit();
}
function butBack1() // View Results Page "dvres2.php"
{
	document.frm.action = "dvres1.php";
	document.frm.method = "POST";
	document.frm.submit();
}
function AValidate(nParam)
{
	if (nParam == 5) // Admin Login Validation
	{
		if (isEmpty(document.frm.una.value))
		{
			alert("Please Enter the User Name");
			document.frm.una.value = "";
			document.frm.una.focus();
			return false;
		}
		else if (isEmpty(document.frm.pwd.value))
		{
			alert("Please Enter the Password");
			document.frm.pwd.value = "";
			document.frm.pwd.focus();
			return false;
		}
		else
		{
			document.frm.action = "login.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
	else if (nParam == 10) // Create Administrator
	{
		if ((isEmpty(document.frm.una.value)) || (!isString1(document.frm.una.value)))
		{
			alert("Please Enter the User Name");
			document.frm.una.value = "";
			document.frm.una.focus();
			return false;
		}
		else if ((isEmpty(document.frm.pd1.value)) || (!isString1(document.frm.pd1.value)))
		{
			alert("Please Enter the Password");
			document.frm.pd1.value = "";
			document.frm.pd1.focus();
			return false;
		}
		else if ((isEmpty(document.frm.pd2.value)) || (!isString1(document.frm.pd2.value)))
		{
			alert("Please Enter the Confirmation Password");
			document.frm.pd2.value = "";
			document.frm.pd2.focus();
			return false;
		}
		else if (document.frm.pd1.value != document.frm.pd2.value)
		{
			alert("Password and the Confirmation Password Must be Same");
			document.frm.pd1.value = "";
			document.frm.pd2.value = "";
			document.frm.pd1.focus();
			return false;
		}
		else
		{
			document.frm.action = "nadmin1.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
	else if (nParam == 15) // Manage Administrator - Delete Action
	{
		document.frm.nfrom.value = 5;
		document.frm.action = "madmin.php";
		document.frm.method = "POST";
		document.frm.submit();
	}
	else if (nParam == 16) // Manage Administrator - Activate Action
	{
		document.frm.nfrom.value = 10;
		document.frm.action = "madmin.php";
		document.frm.method = "POST";
		document.frm.submit();
	}
	else if (nParam == 17) // Manage Administrator - Deactivate Action
	{
		document.frm.nfrom.value = 15;
		document.frm.action = "madmin.php";
		document.frm.method = "POST";
		document.frm.submit();
	}
	else if (nParam == 20) // Manage Users - Activate Action
	{
		document.frm.action = "muser.php";
		document.frm.method = "POST";
		document.frm.submit();
	}
	else if (nParam == 21) // Manage Users - Deactivate Action
	{
		document.frm.action = "muser.php";
		document.frm.method = "POST";
		document.frm.submit();
	}
	else if (nParam == 25) // View Campaign
	{
		if (document.frm.uid[document.frm.uid.selectedIndex].value == "*")
		{
			alert("Please Select a User");
			document.frm.uid.focus();
			return false;
		}
		else
		{
			document.frm.action = "vcamp.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
	else if (nParam == 30) // View Payment History
	{
		if (document.frm.uid[document.frm.uid.selectedIndex].value == "*")
		{
			alert("Please Select a User");
			document.frm.uid.focus();
			return false;
		}
		else if (document.frm.tid[document.frm.tid.selectedIndex].value == "*")
		{
			alert("Please Select a Campaign");
			document.frm.tid.focus();
			return false;
		}		
		else
		{
			document.frm.action = "vphis.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
	else if (nParam == 35) // Change Password
	{
		if ((isEmpty(document.frm.pd1.value)) || (!isString1(document.frm.pd1.value)))
		{
			alert("Please Enter the Current Password");
			document.frm.pd1.value = "";
			document.frm.pd1.focus();
			return false;
		}
		else if ((isEmpty(document.frm.pd2.value)) || (!isString1(document.frm.pd2.value)))
		{
			alert("Please Enter the New Password");
			document.frm.pd2.value = "";
			document.frm.pd2.focus();
			return false;
		}
		else if ((isEmpty(document.frm.pd3.value)) || (!isString1(document.frm.pd3.value)))
		{
			alert("Please Enter the Confirmation Password");
			document.frm.pd3.value = "";
			document.frm.pd3.focus();
			return false;
		}
		else if (document.frm.pd2.value != document.frm.pd3.value)
		{
			alert("New Password and the Confirmation Password Must be Same");
			document.frm.pd2.value = "";
			document.frm.pd3.value = "";
			document.frm.pd2.focus();
			return false;
		}
		else
		{
			document.frm.nSubmitted.value = 5;
			document.frm.action = "cpass.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
	else if (nParam == 40) // View Reports - Daywise & Monthwise (Page from admin.php)
	{
		document.frm.action = "admin.php";
		document.frm.method = "POST";
		document.frm.submit();
	}
	else if (nParam == 41) // View Reports - Daywise & Monthwise (Page from reports.php)
	{
		document.frm.nfrom.value = 0;
		document.frm.action = "reports.php";
		document.frm.method = "POST";
		document.frm.submit();
	}
	else if (nParam == 42) // Daywise & Monthwise Reports - Submit
	{
		if (document.frm.type[document.frm.type.selectedIndex].value == "*")
		{
			alert("Please Select a User Type");
			document.frm.type.focus();
			return false;
		}
		else
		{
			document.frm.action = "reports.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
	else if (nParam == 43) // View Reports - Results
	{
		document.frm.dd.value = "";
		document.frm.mm.value = "";
		document.frm.yy.value = "";
		document.frm.type.value = "";
		document.frm.action = "reports.php";
		document.frm.method = "POST";
		document.frm.submit();
	}
	else if (nParam == 45) // View Campaign Results - Summary
	{
		if (document.frm.uid[document.frm.uid.selectedIndex].value == "*")
		{
			alert("Please Select a User");
			document.frm.uid.focus();
			return false;
		}
		else if (document.frm.top[document.frm.top.selectedIndex].value == "*")
		{
			alert("Please Select a Campaign Type");
			document.frm.top.focus();
			return false;
		}
		else if (document.frm.tid[document.frm.tid.selectedIndex].value == "*")
		{
			alert("Please Select a Campaign");
			document.frm.tid.focus();
			return false;
		}
		else
		{
			document.frm.action = "vres1.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
	}
}

function ViewUser(nParam)
{
	document.frm.uid.value = nParam;
	document.frm.action = "vuser.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function ViewReport(nParam)
{
	document.frm.nfrom.value = nParam;
	document.frm.action = "reports.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function butBackToVewReport()
{
	document.frm.action = "reports.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function ShowCampaign(nParam)
{
	document.frm.uid.value = nParam;
	document.frm.action = "vcamp.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function ShowPayHistory(nParam)
{
	document.frm.uid.value = nParam;
	document.frm.action = "vphis.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function butBackToManageUsers()
{
	document.frm.action = "muser.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function butBackToVewCamp()
{
	document.frm.action = "vcamp.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function butBackToVewPayHis()
{
	document.frm.action = "vphis.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function ShowPay(nParam1, nParam2)
{
	document.frm.tid.value = nParam1;
	document.frm.uid.value = nParam2;
	document.frm.action = "vphis.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function FillCampaign()
{
	var MainVar, MainArr, OptNum;
	OptNum = 0;
	for(i=document.frm.tid.options.length;i>=0;i--)
	{
		document.frm.tid.options[i] = null;
	}
	if (document.frm.uid[document.frm.uid.selectedIndex].value != "*" && document.frm.top[document.frm.top.selectedIndex].value != "*")
	{
		for(i=0;i<CampArray.length;i++)
		{
			MainVar = CampArray[i];
			MainArr = MainVar.split("#");
			if (MainArr.length > 3)
			{
				if (MainArr[0] == document.frm.uid[document.frm.uid.selectedIndex].value && MainArr[2] == document.frm.top[document.frm.top.selectedIndex].value)
				{
					document.frm.tid.options[OptNum] = new Option("----- Select -----","*");
					OptNum = 1;
					for(j=3;j<MainArr.length;j += 2)
					{
						document.frm.tid.options[OptNum] = new Option(MainArr[j+1],MainArr[j]);
						OptNum++;	
					}
					document.frm.tid.selectedIndex = 0;
					break;
				}				
			}
			else if (MainArr[0] == document.frm.uid[document.frm.uid.selectedIndex].value && MainArr[2] == document.frm.top[document.frm.top.selectedIndex].value)
			{
				document.frm.tid.options[0] = new Option("----- Select -----","*");
				document.frm.tid.selectedIndex = 0;
				break;
			}
		}
	}
	else
	{
		document.frm.tid.options[0] = new Option("----- Select -----","*");
		document.frm.tid.selectedIndex = 0;
	}
}

function butAddIP()
{
	nLength = document.frm.fip.length;
	for(i=0;i<nLength;i++)
	{
		if (document.frm.fip[i].selected)
		{
			var isNew = true;
			if (document.frm.tip.length != 0)
			{
				for(j=0;j<document.frm.tip.length;j++)
				{
					if (document.frm.fip[i].value == document.frm.tip[j].value)
					{
						isNew = false;
						break;
					}
				}
			}
			if (isNew)
			{
				document.frm.tip.options[document.frm.tip.options.length] = new Option(document.frm.fip[i].text,document.frm.fip[i].value);
			}
		}
	}
}
function butRemIP()
{
	nLength = document.frm.tip.options.length;
	arrSelected = new Array();
	var count = 0;
	for(i=0;i<nLength;i++)
	{
		if (document.frm.tip[i].selected)
		{
			arrSelected[count] = document.frm.tip.options[i].value;
		}
		count++;
	}
	var x;
	for(i=0;i<nLength;i++)
	{
		for(x=0;x<arrSelected.length;x++)
		{
			if (document.frm.tip.options[i].value == arrSelected[x])
			{
				document.frm.tip.options[i] = null;
			}
		}
		nLength = document.frm.tip.length;
	}
}
function addIP()
{
	if (isEmpty(document.frm.ipa.value) || (isIP(document.frm.ipa.value) == false))
	{
		alert("Please Enter the IP Address to Add");
		document.frm.ipa.value = "";
		document.frm.ipa.focus();
	}
	else
	{
		nCnt = 0;
		ipArr = document.frm.ipa.value.split(".");
		for(i=0;i<ipArr.length;i++)
		{
			if (ipArr[i] > 255)
			{
				nCnt++;
			}
		}
		if (nCnt > 0)
		{
			alert("Please Enter Valid IP Address.\nIP Address must be between 0.0.0.0 to 255.255.255.255");
			document.frm.ipa.value = "";
			document.frm.ipa.focus();
		}
		else
		{
			nLength = document.frm.fip.length;
			isExist = false;
			isNew = true;
			nIPValue = 0;
			for(i=0;i<nLength;i++)
			{
				if (document.frm.ipa.value == document.frm.fip[i].text)
				{
					nIPValue = document.frm.fip[i].value;
					isExist = true;
					break;
				}
			}
			if (isExist)
			{
				nLength = document.frm.tip.length;
				for(i=0;i<nLength;i++)
				{	
					if (document.frm.tip[i].text == document.frm.ipa.value)
					{
						isNew = false;
						break;
					}
				}
				if (isNew)
				{
					document.frm.tip.options[document.frm.tip.options.length] = new Option(document.frm.ipa.value,nIPValue);
				}
			}
			else
			{
				alert("Sorry! But the IP Address entered by you is not in the list");
				document.frm.ipa.value = "";
				document.frm.ipa.focus();
			}
		}
	}
}
function submitForm(sParam,nMax)
{	
	if (isEmpty(document.frm.nShowRec.value) || (isNumber(document.frm.nShowRec.value) == false))
	{
		alert("Please Enter Valid Value");
		document.frm.nShowRec.focus();	
	}
	else
	{
		if (parseInt(document.frm.nShowRec.value) > parseInt(nMax))
		{
			window.location = sParam+"&nRowEnd="+nMax;			
		}
		else
		{
			window.location = sParam+"&nRowEnd="+document.frm.nShowRec.value;
		}
	}
}

function sortRec(nBy)
{
	document.frm.nSortBy.value = nBy;
	document.frm.action = "vres1.php";
	document.frm.method = "POST";
	document.frm.submit();
}

function updAmt(nParam,nParam1)
{
	if (nParam1 == 5)
	{
		amt = RatesArray[nParam];
		mths = document.frmpay.nmths[document.frmpay.nmths.selectedIndex].value;
		document.frmpay.pamt.value = (amt*mths);
	}
	else
	{
		amt = 0;
		for(i=0;i<document.frmpay.cstype.length;i++)
		{
			if (document.frmpay.cstype[i].checked)
			{
				amt = RatesArray[i];
			}
		}
		mths = document.frmpay.nmths[document.frmpay.nmths.selectedIndex].value;
		document.frmpay.pamt.value = (amt*mths);
	}	
}
function updAmt1(nParam,nParam1)
{
	if (nParam1 == 5)
	{
		amt = RatesArray[nParam];
		mths = document.frmsign.nmths[document.frmsign.nmths.selectedIndex].value;
		document.frmsign.pamt.value = (amt*mths);
	}
	else
	{
		amt = 0;
		for(i=0;i<document.frmsign.cstype.length;i++)
		{
			if (document.frmsign.cstype[i].checked)
			{
				amt = RatesArray[i];
			}
		}
		mths = document.frmsign.nmths[document.frmsign.nmths.selectedIndex].value;
		document.frmsign.pamt.value = (amt*mths);
	}	
}

function showAmt()
{
	if (document.frmpay.pop[document.frmpay.pop.selectedIndex].value == "*")
	{
		alert("Please Select a Payment Option");
		document.frmpay.pop.focus();
	}
	else
	{
		sItems = document.frmpay.pop[document.frmpay.pop.selectedIndex].value.split("#");
		document.frmpay.nmths.value = sItems[0];
		document.frmpay.pamt.value = sItems[1];
	}
}

function visitDay(nParam,nParam1)
{
	document.dvform.tid.value = nParam;
	document.dvform.uid.value = nParam1;
	document.dvform.action = "vres1.php";
	document.dvform.method = "POST";
	document.dvform.submit();
}
function visitDay1(nParam,nParam1)
{
	document.dvform.tid.value = nParam;
	document.dvform.uid.value = nParam1;
	document.dvform.action = "dvres1.php";
	document.dvform.method = "POST";
	document.dvform.submit();
}
function fillCamp()
{
	var MainVar, MainArr, OptNum;
	OptNum = 0;
	for(i=document.frm.tid.options.length;i>=0;i--)
	{
		document.frm.tid.options[i] = null;
	}
	if (document.frm.top[document.frm.top.selectedIndex].value != "*")
	{
		for(i=0;i<CampArray.length;i++)
		{
			MainVar = CampArray[i];
			MainArr = MainVar.split("#");
			if (MainArr.length > 1)
			{
				if (MainArr[0] == document.frm.top[document.frm.top.selectedIndex].value)
				{
					document.frm.tid.options[OptNum] = new Option("----- Select -----","*");
					OptNum = 1;
					for(j=1;j<MainArr.length;j += 2)
					{
						document.frm.tid.options[OptNum] = new Option(MainArr[j+1],MainArr[j]);
						OptNum++;	
					}
					document.frm.tid.selectedIndex = 0;
					break;
				}				
			}
			else if (MainArr[0] == document.frm.top[document.frm.top.selectedIndex].value)
			{
				document.frm.tid.options[0] = new Option("----- Select -----","*");
				document.frm.tid.selectedIndex = 0;
				break;
			}
		}
	}
	else
	{
		document.frm.tid.options[0] = new Option("----- Select -----","*");
		document.frm.tid.selectedIndex = 0;
	}
}
function submitSepa()
{
	var i,j,k;
	if (isEmpty(document.frm.url.value))
	{
		alert("Please Enter the Domain Name");
		document.frm.url.focus();
		return false;
	}
	else if (isEmpty(document.frm.kwd.value))
	{
		alert("Please Enter the Keyword");
		document.frm.kwd.focus();
		return false;
	}
	else
	{
		j = "";
		for(i=0;i<document.frm.se.length;i++)
		{
			if (document.frm.se[i].checked)
			{
				j += document.frm.se[i].value+",";
			}		
		}
		if (j.length > 0)
		{
			j = j.substr(0,j.length-1);
			document.frm.se1.value = j;
			document.frm.action = "sepa.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
		else
		{
			alert("Please Select atleast one search engine");
			return false;
		}
	}
}
function submitURL()
{
	var i,j,k;
	if (isEmpty(document.frm.url.value))
	{
		alert("Please Enter the Website URL");
		document.frm.url.focus();
		return false;
	}
	else if (isEmpty(document.frm.uname.value))
	{
		alert("Please Enter Your Name");
		document.frm.uname.focus();
		return false;
	}
	else if (!isEMail(document.frm.eid.value))
	{
		alert("Please Enter Your EMail Address");
		document.frm.eid.focus();
		return false;
	}
	else
	{
		j = "";
		for(i=0;i<document.frm.se.length;i++)
		{
			if (document.frm.se[i].checked)
			{
				j += document.frm.se[i].value+",";
			}		
		}
		if (j.length > 0)
		{
			j = j.substr(0,j.length-1);
			document.frm.se1.value = j;
			document.frm.action = "addurl.php";
			document.frm.method = "POST";
			document.frm.submit();
		}
		else
		{
			alert("Please Select atleast one search engine");
			return false;
		}
	}
}
function chkAll()
{
	for(i=0;i<document.frm.se.length;i++)
	{
		document.frm.se[i].checked = true;
	}
}
function clrAll()
{
	for(i=0;i<document.frm.se.length;i++)
	{
		document.frm.se[i].checked = false;
	}
}