var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var calunits=document.layers? "" : "px"

var bouncelimit=32 //(must be divisible by 8)
var direction="up"
var lpos


function initbox()
{
	if (!dom&&!ie&&!ns4)
	return
	crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
	crossobj.top=scroll_top-250+calunits
	crossobj.visibility=(dom||ie)? "visible" : "show"
	dropstart=setInterval("dropin()",50)
}



function dropin()
{
	scroll_top=(ie)? truebody().scrollTop : window.pageYOffset

	if (parseInt(crossobj.top)<lpos)
	crossobj.top=parseInt(crossobj.top)+25+calunits
	else
	{
		clearInterval(dropstart)
		bouncestart=setInterval("bouncein()",50)
	}
}

function bouncein()
{
	crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
	if (bouncelimit<0)
		bouncelimit+=8

		bouncelimit=bouncelimit*-1
	if (bouncelimit==0)
	{
		clearInterval(bouncestart)
	}
}


function dismissvideobox()
{
	if (window.bouncestart)
		clearInterval(bouncestart)

	crossobj.visibility="hidden"

	var contentVideo = document.getElementById("player");
//    alert("hi there");
//    contentVideo.innerHTML = "";
}


//function startVideoWindow( strBrowser )
//{
//	var contentVideo = document.getElementById("player");
//
//	if( strBrowser == "Microsoft Internet Explorer" )
//	{
//		// ie
//		contentVideo.innerHTML = "<table id='Table1' cellSpacing='3' cellPadding='3' width='320' align='center' bgColor='#ffffff' border='2'>" +
//		"<tr>" +
//			"<td bgcolor='#ffffff' width='320' height='240' valign='middle' align='center'>" +
//				"<OBJECT ID='mediaPlayer' CLASSID='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902' STANDBY='Loading Microsoft Windows Media Player components...' TYPE='application/x-oleobject' VIEWASTEXT>" +
//					"<PARAM NAME='fileName' VALUE='http://wmstream.libertyleague.com/lli/beyondfreedom_large.wmv'>" +
//					"<PARAM NAME='animationatStart' VALUE='true'>" +
//					"<PARAM NAME='transparentatStart' VALUE='true'>" +
//					"<PARAM NAME='autoStart' VALUE='true'>" +
//					"<PARAM NAME='showControls' VALUE='true'>" +
//					"<PARAM NAME='bgcolor' value='#000000'>" +
//					"<EMBED type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' SRC='http://wmstream.libertyleague.com/lli/beyondfreedom_large.wmv' name='MediaPlayer1' width='320' height='240' AutoStart='true'></EMBED>" +
//				"</OBJECT>" +
//			"</td>" +
//		"</tr>" +
//		"</table>";
//
//	}
//	else
//	{
// 		// anything other than ie
//   		contentVideo.innerHTML = "<table id='Table1' cellSpacing='3' cellPadding='3' width='320' align='center' bgColor='#ffffff' border='2'>" +
//		"<tr>" +
//			"<td bgcolor='#000000' width='320' height='260' valign='top'>" +
//			"<OBJECT CLASSID='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' WIDTH='320' HEIGHT='260' CODEBASE='http://www.apple.com/qtactivex/qtplugin.cab' ID='Qtactivexplugin1' VIEWASTEXT>" +
//			"<PARAM name='SRC' VALUE='http://stream.libertyleague.com/beyondfreedom_large.mov'>" +
//			"<PARAM name='AUTOPLAY' VALUE='true'>" +
//			"<PARAM name='CONTROLLER' VALUE='true'>" +
//			"<PARAM name='LOOP' VALUE='false'>" +
//			"<EMBED SRC='http://stream.libertyleague.com/beyondfreedom_large.mov' WIDTH='320' HEIGHT='260' AUTOPLAY='true' CONTROLLER='true' LOOP='false' BGCOLOR='#000000' PLUGINSPAGE='http://www.apple.com/quicktime/download/'></EMBED>" +
//			"</OBJECT> " +
//			"</td>" +
//		"</tr>" +
//		"</table>";	
//	}
//}


function dismissbox()
{
	if (window.bouncestart)
		clearInterval(bouncestart)

	crossobj.visibility="hidden"
}

function truebody()
{
	return (document.compatMode!="BackCompat")? document.documentElement : document.body
}

function delay(x)
{
	var d=new Date()
	d=d.getSeconds()+x
	if (d>=60) d=d-60
	while (true)
	{
		var d1=new Date()
		if(d==d1.getSeconds())
			break;
	}	
}
function SetCooKie(name,value)
{
	var argv=SetCooKie.arguments;
	var argc=SetCooKie.arguments.length
	var expires=(argc>2) ? argv[2] : null
	var path=(argc>3) ? argv[3] : null
	var domain=(argc>4) ? argv[4] : null
	var secure=(argc>5) ? argv[5] : false
	document.cookie=name + "=" +escape(value) + 
	((expires==null) ? "" :( ";expires=" + expires.toGMTString())) +
	((path==null) ? "" :( ";path=" + path)) +
	((domain==null) ? "" :( ";domain=" + domain)) +
	((secure==true) ? "; secure " : "")
}

function GetCookie(name)
{	
	var arg=name + "=" 
	var alen=arg.length
	var clen=document.cookie.length
	var i=0
	while(i<clen)
	{
		var j=i+alen
		if (document.cookie.substring(i,j)==arg)
		{
			//getCookieVal(j)
			return true;
		}
		i=document.cookie.indexOf(" ", i) + i;
		if ( i==0) break;
	}
	return false;
}
function getCookieVal(offset)
{
	var endstr=document.cookie.indexOf(";",offset)
	if(endstr==-1)
	{
		endstr=document.cookie.length;
	}
	return unescape(document.cookie.substring(offset,endstr));

}
function Delaynew()
{
	if (!ns4)
	{	
		document.getElementById("dropin").style.visibility="visible";
			
	}	
	else
		document.dropin.visibility="show";
	
	return;
}


function DropIn(main_bgcolor,main_texttype,main_textsize,main_textcolor,textbar,height,width,top,left,bordercolor,borderstyle,borderwidth,sec,showeverytime)
{
	lpos = top
	ans="no"
	//delay(sec)
	var chkshow=false;
	if (!showeverytime)
	{
		chkshow=GetCookie('popDropin');
		if (chkshow)
		{
			SetCooKie('popDropin','added')
		}
	}
	
	if(!chkshow)
	{ 
		if (ns4)
		{
			templayer=document.layers[0]				
			templayer.left=left				
			templayer.top=top
			templayer.width=width
			templayer.height=height
		}
		else if (ns6)
		{
			document.getElementById("tbl").style.border = bordercolor+' '+borderwidth+'px '+borderstyle
			document.getElementById("dragtext").innerHTML=textbar
				
			document.getElementById("dropin").style.height=height +'px'
			document.getElementById("dropin").style.width =width +'px'
			document.getElementById("dropin").style.left =left +'px'
			document.getElementById("dropin").style.top =top +'px'
			document.getElementById("dragtext").style.backgroundColor=main_bgcolor
			document.getElementById("dragtext").style.color = main_textcolor
			document.getElementById("dragtext").style.fontFamily = main_texttype
			document.getElementById("dragtext").style.fontSize = main_textsize+'px'
		}
		else 
		{
			document.getElementById("tbl").style.border = bordercolor+' '+borderwidth+'px '+borderstyle
			document.getElementById("dragtext").innerHTML=textbar
				
			document.getElementById("dropin").style.height=height +'px'
			document.getElementById("dropin").style.width =width +'px'
			document.getElementById("dropin").style.left =left +'px'
			document.getElementById("dropin").style.top =top +'px'
			document.getElementById("dragtext").style.backgroundColor=main_bgcolor
			document.getElementById("dragtext").style.color = main_textcolor
			document.getElementById("dragtext").style.fontFamily = main_texttype
			document.getElementById("dragtext").style.fontSize = main_textsize+'px'
		}
		setTimeout("initbox()",(sec*1000));	
	}
}
////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"MISCELLANEOUS"
//
//
////////////////////////////////////////////////////////////////////////////////////////

// this script determines whether the user's browser
// is IE3, IE4, or Netscape 4, and loads a different
// style sheet for each; for other browsers,
// it does nothing
var browser = navigator.appName;
var version = navigator.appVersion;
var ver1 = version.substring(0, 1);
var ver2 = version.lastIndexOf("MSIE");
var ver3 = version.substring((ver2 + 5), (ver2 + 6));

function itsNetscape()
{
    document.write('<link rel="StyleSheet" href="../styles/default_ns.css" type="text/css">');
    document.write('<link rel="StyleSheet" href="../../styles/default_ns.css" type="text/css">');
}

function itsMsie()
{
    if( browser == "Microsoft Internet Explorer" )
    {
    	ieVersion();
    }
}

function ieVersion()
{
    if( ver1 >= 4 )
    {
	document.write('<link rel="StyleSheet" href="../styles/default_ie.css" type="text/css">');
	document.write('<link rel="StyleSheet" href="../../styles/default_ie.css" type="text/css">');
    }

    if (ver3 == 3)
    {
	document.write('<link rel="StyleSheet" href="../styles/default_ie.css" type="text/css">');
	document.write('<link rel="StyleSheet" href="../../styles/default_ie.css" type="text/css">');
    }
}

function jsTrim(TXT)
{
    return TXT.replace(/(^\s+)|(\s+$)/g,"");
}

function isCharsOk(sFirstName, sList)
{
	var i,c;
	for (i = 0; i < sFirstName.length; i++)
	{
		c = sFirstName.charAt(i);
		if (sList.indexOf(c) == -1)
		{
			return false;
		}
	}
	return true;
}


////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"AUTORESPONDER"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function submitAR()
{
	document.ar.action = "http://www.mcssl.com/app/contactsave.asp";
	document.ar.submit();
}


////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"NEW ASSOCIATE"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function initializeNewAssociatePage()
{
	document.newassociate.txtFname.focus();
	document.newassociate.txtFname.select();
}

function initializeEditContactPage()
{
	document.editContact.txtFname.focus();
	document.editContact.txtFname.select();
}

function validateNewAssociatePage()
{
	if( validateNewAssociate() == true)
	{
		document.newassociate.action = "processNewAssociate.asp?txtUserName=" + document.newassociate.hContactID.value + "&txtPassword=" + document.newassociate.hPassword.value;
		document.newassociate.submit();	
	}
}

function validateEditContactPage()
{
	if( validateEditContact() == true)
	{
		document.editContact.action = "processEditItems.asp?txtUserName=" + document.editContact.hContactID.value + "&txtPassword=" + document.editContact.hPassword.value + "&strQuery=" + document.editContact.hstrQuery.value;
		document.editContact.submit();	
	}
}


function validateNewAssociate()
{
	vFname = document.newassociate.txtFname.value;
	vLname = document.newassociate.txtLname.value;
	vEmail = document.newassociate.txtEmail.value;
	vPhone = document.newassociate.txtPhone.value;
	v800Num = document.newassociate.txt800num.value;
	// Validate First Name

	if(jsTrim(vFname) == '')
	{
		alert("Please enter your first name.");
		document.newassociate.txtFname.focus();
		document.newassociate.txtFname.select();
		return false;
	}
	else if( containsQuotes( vFname ) )
	{
		alert("Your first name cannot contain quotation marks.");
		document.newassociate.txtFname.focus();
		document.newassociate.txtFname.select();
		return false;
	}
	else if(jsTrim(vLname) == '') // last name
	{
		alert("Please enter your last name.");
		document.newassociate.txtLname.focus();
		document.newassociate.txtLname.select();
		return false;
	}
	else if( containsQuotes( vLname ) )
	{
		alert("Your last name cannot contain quotation marks.");
		document.newassociate.txtLname.focus();
		document.newassociate.txtLname.select();
		return false;
	}	
	else if(jsTrim(vEmail) == '')
	{
		alert("Please enter your email address.");
		document.newassociate.txtEmail.focus();
		document.newassociate.txtEmail.select();
		return false;
	}
	else if( containsQuotes( vEmail ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.newassociate.txtEmail.focus();
		document.newassociate.txtEmail.select();
		return false;
	}
	else if(ValidEmail02()!= true)
	{
		alert("You have entered a bad email address.");	
		document.newassociate.txtEmail.focus();
		document.newassociate.txtEmail.select();
		return false;
	}
	else if(jsTrim(vPhone) == '')
	{
		alert("Please enter phone number.");
		document.newassociate.txtPhone.focus();
		document.newassociate.txtPhone.select();
		return false;
	}
	else if ( !isCharsOk( vPhone, "0123456789-"))
	{
		alert("Phone number should not contain any special characters");
		document.newassociate.txtPhone.focus();
		document.newassociate.txtPhone.select();
		return false;
	}
	else if( containsQuotes( vPhone ) )
	{
		alert("800 number cannot contain quotation marks.");
		document.newassociate.txtPhone.focus();
		document.newassociate.txtPhone.select();
		return false;
	}
	else if(jsTrim(v800Num) == '')
	{
		alert("Please enter 800  number.");
		document.newassociate.txt800num.focus();
		document.newassociate.txt800num.select();
		return false;
	}
	else if ( !isCharsOk( v800Num, "0123456789-"))
	{
		alert("800 number should not contain any special characters");
		document.newassociate.txt800num.focus();
		document.newassociate.txt800num.select();
		return false;
	}
	else if( containsQuotes( v800Num ) )
	{
		alert("800 number cannot contain quotation marks.");
		document.newassociate.txt800num.focus();
		document.newassociate.txt800num.select();
		return false;
	}

	document.newassociate.hfirstname.value = vFname;
	document.newassociate.hlastname.value = vLname;
	document.newassociate.hemail.value = vEmail;
	document.newassociate.hphone.value = vPhone;
	document.newassociate.h800number.value = v800Num;

	return true;
}

function validateEditContact()
{
	vFname = document.editContact.txtFname.value;
	vLname = document.editContact.txtLname.value;
	vEmail = document.editContact.txtEmail.value;
	vPhone = document.editContact.txtPhone.value;
	v800Num = document.editContact.txt800num.value;
	vContactType = document.editContact.txtContactType.value;
	// Validate First Name

	if(jsTrim(vFname) == '')
	{
		alert("Please enter your first name.");
		document.editContact.txtFname.focus();
		document.editContact.txtFname.select();
		return false;
	}
	else if( containsQuotes( vFname ) )
	{
		alert("Your first name cannot contain quotation marks.");
		document.editContact.txtFname.focus();
		document.editContact.txtFname.select();
		return false;
	}
	else if(jsTrim(vLname) == '') // last name
	{
		alert("Please enter your last name.");
		document.editContact.txtLname.focus();
		document.editContact.txtLname.select();
		return false;
	}
	else if( containsQuotes( vLname ) )
	{
		alert("Your last name cannot contain quotation marks.");
		document.editContact.txtLname.focus();
		document.editContact.txtLname.select();
		return false;
	}	
	else if(jsTrim(vEmail) == '')
	{
		alert("Please enter your email address.");
		document.editContact.txtEmail.focus();
		document.editContact.txtEmail.select();
		return false;
	}
	else if( containsQuotes( vEmail ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.editContact.txtEmail.focus();
		document.editContact.txtEmail.select();
		return false;
	}
	else if(ValidEmail03()!= true)
	{
		alert("You have entered a bad email address.");	
		document.editContact.txtEmail.focus();
		document.editContact.txtEmail.select();
		return false;
	}
	else if(jsTrim(vPhone) == '')
	{
		alert("Please enter phone number.");
		document.editContact.txtPhone.focus();
		document.editContact.txtPhone.select();
		return false;
	}
	else if ( !isCharsOk( vPhone, "0123456789-"))
	{
		alert("Phone number should not contain any special characters");
		document.editContact.txtPhone.focus();
		document.editContact.txtPhone.select();
		return false;
	}
	else if( containsQuotes( vPhone ) )
	{
		alert("Phone number cannot contain quotation marks.");
		document.editContact.txtPhone.focus();
		document.editContact.txtPhone.select();
		return false;
	}
	else if(jsTrim(v800Num) == '')
	{
		alert("Please enter 800  number.");
		document.editContact.txt800num.focus();
		document.editContact.txt800num.select();
		return false;
	}
	else if ( !isCharsOk( v800Num, "0123456789-"))
	{
		alert("800 number should not contain any special characters");
		document.editContact.txt800num.focus();
		document.editContact.txt800num.select();
		return false;
	}
	else if( containsQuotes( v800Num ) )
	{
		alert("800 number cannot contain quotation marks.");
		document.editContact.txt800num.focus();
		document.editContact.txt800num.select();
		return false;
	}
	else if(jsTrim(vContactType) == '')
	{
		alert("Please enter contact type - PROSPECT or ASSOCIATE.");
		document.editContact.txtContactType.focus();
		document.editContact.txtContactType.select();
		return false;
	}
	else if( containsQuotes( vFname ) )
	{
		alert("Contact type cannot contain quotes");
		document.editContact.txtContactType.focus();
		document.editContact.txtContactType.select();
		return false;
	}

	vContactType = vContactType.toUpperCase();
	if( vContactType != "ASSOCIATE" && vContactType != "PROSPECT" )
	{
		alert("Please enter contact type - PROSPECT or ASSOCIATE.");
		document.editContact.txtContactType.focus();
		document.editContact.txtContactType.select();
		return false;
	}
	
	
	document.editContact.hfirstname.value = vFname;
	document.editContact.hlastname.value = vLname;
	document.editContact.hemail.value = vEmail;
	document.editContact.hphone.value = vPhone;
	document.editContact.h800number.value = v800Num;
	document.editContact.hContactType.value = vContactType;
	return true;
}


function ValidEmail03()	// email validation
{	
	var email1,atemail,atoccurance,splitter;
	email1 = document.editContact.txtEmail.value;
	atemail=email1.indexOf("@");
	
	if (atemail==-1)
	{
		return false;
	}
	else
	{
		atoccurence=email1.indexOf("@");
		dotcheck=email1.indexOf(".",atoccurence);
				
		 if (dotcheck==-1)
		{
			return false;
		}	
				
		splitter=email1.substring(atoccurence+1,2);
		if (splitter==".")
		{
					return false;
		}
		if(email1.indexOf("@.")!=-1)
		{
			return false;
		}
								
		len=email1.length-1;
		if(email1.substr(len,1)==".")
		{
			return false;
		}									
					
		checky = email1.substr(len,1);
		if ((checky=="~")||(checky=="!")||(checky=="#")||(checky=="$")||(checky=="$")||(checky=="%")||(checky=="^")||(checky=="&")||(checky=="*")||(checky=="(")||(checky==")")||(checky=="_")||(checky=="+")||(checky=="|")||(checky=="-")||(checky=="?")||(checky==">")||(checky=="<")||(checky=="/")||(checky=="{")||(checky=="}")||(checky=="[")||(checky=="]")||(checky=="'")||(checky==":")||(checky==";")||(checky==",")||(checky=="`"))
		{
			return false;
		}
											
		if(email1.substr(0,1)=="@")
		{
			return false;
		}
		if(email1.substr(0,1)==".")
		{
			return false;
		}
		var speChar=0;
		for(i=0;i<email1.length;i++)
		{
			if(email1.substr(i,1)=="@")
			{
				speChar+=1;
			}
		}
		if(speChar>1)
		{
			return false;
		}
	}
	return true;
}

function ValidEmail02()	// email validation
{	
	var email1,atemail,atoccurance,splitter;
	email1 = document.newassociate.txtEmail.value;
	atemail=email1.indexOf("@");
	
	if (atemail==-1)
	{
		return false;
	}
	else
	{

		atoccurence=email1.indexOf("@");
		dotcheck=email1.indexOf(".",atoccurence);
				
		 if (dotcheck==-1)
			{
				return false;
			}	
				
			splitter=email1.substring(atoccurence+1,2);
		if (splitter==".")
		{
					return false;
		}
		if(email1.indexOf("@.")!=-1)
		{
			return false;
		}
								
		len=email1.length-1;
		if(email1.substr(len,1)==".")
		{
			return false;
		}									
					
		checky = email1.substr(len,1);
		if ((checky=="~")||(checky=="!")||(checky=="#")||(checky=="$")||(checky=="$")||(checky=="%")||(checky=="^")||(checky=="&")||(checky=="*")||(checky=="(")||(checky==")")||(checky=="_")||(checky=="+")||(checky=="|")||(checky=="-")||(checky=="?")||(checky==">")||(checky=="<")||(checky=="/")||(checky=="{")||(checky=="}")||(checky=="[")||(checky=="]")||(checky=="'")||(checky==":")||(checky==";")||(checky==",")||(checky=="`"))
		{
			return false;
		}
											
		if(email1.substr(0,1)=="@")
		{
			return false;
		}
		if(email1.substr(0,1)==".")
		{
			return false;
		}
		var speChar=0;
		for(i=0;i<email1.length;i++)
		{
			if(email1.substr(i,1)=="@")
			{
				speChar+=1;
			}
		}
		if(speChar>1)
		{
			return false;
		}
	}
	return true;
}



////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"INDEX"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function validateDataEntryPage()
{
	document.index01.hEmail.value = document.index01.txtEmail.value;
	document.index01.hFname.value = document.index01.txtFname.value;
	document.index01.hLname.value = document.index01.txtLname.value;
		
	document.index01.action = "processDataEntry.asp"
	document.index01.submit();	
}

function validateIndexPage( strVal )
{
	if( validateIndex01() == true)
	{
		document.index01.action = "processIndex.php?" + strVal
		document.index01.submit();	
	}
}


function validateIndex01()
{
	vEmail = document.index01.txtEmail.value;
	vFname = document.index01.txtFname.value;
	vLname = document.index01.txtLname.value;
	vDayPhone = document.index01.txtDayPhone.value;

	if(jsTrim(vFname) == '')
	{
		alert("Please enter your first name.");
		document.index01.txtFname.focus();
		document.index01.txtFname.select();
		return false;
	}
	else if( containsQuotes( vFname ) )
	{
		alert("Your first name cannot contain quotation marks.");
		document.index01.txtFname.focus();
		document.index01.txtFname.select();
		return false;
	}
	else if(jsTrim(vLname) == '') // last name
	{
		alert("Please enter your last name.");
		document.index01.txtLname.focus();
		document.index01.txtLname.select();
		return false;
	}
	else if( containsQuotes( vLname ) )
	{
		alert("Your last name cannot contain quotation marks.");
		document.index01.txtLname.focus();
		document.index01.txtLname.select();
		return false;
	}
	else if(jsTrim(vEmail) == '')
	{
		alert("Please enter your email address.");
		document.index01.txtEmail.focus();
		document.index01.txtEmail.select();
		return false;
	}
	else if( containsQuotes( vEmail ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.index01.txtEmail.focus();
		document.index01.txtEmail.select();
		return false;
	}
	else if(ValidEmail01()!= true)
	{
		alert("You have entered a bad email address.");	
		document.index01.txtEmail.focus();
		document.index01.txtEmail.select();
		return false;
	}
	else if( jsTrim(document.index01.txtDayPhone.value) == '' )
	{
		alert("Please enter your phone number.");
		document.index01.txtDayPhone.focus();
		document.index01.txtDayPhone.select();
		return false;	
	}
	else if( containsQuotes( document.index01.txtDayPhone.value ) )
	{
		alert("Phone number cannot contain quotation marks.");
		document.index01.txtDayPhone.focus();
		document.index01.txtDayPhone.select();
		return false;
	}
	else if ( !isCharsOk( vDayPhone, "0123456789-"))
	{
		alert("Phone number should not contain any special characters");
		document.index01.txtDayPhone.focus();
		document.index01.txtDayPhone.select();
		return false;
	}
	else if(document.index01.cboTimeZone.options[document.index01.cboTimeZone.selectedIndex].value == '-1')
	{
		alert("Please select a Time Zone.");
		document.index01.cboTimeZone.focus();
		return false;
	}
	else
	{
		// set these now before submitting to pass them on to the next page...
		document.index01.hEmail.value = vEmail;
		document.index01.hFname.value = vFname;
		document.index01.hLname.value = vLname;
		document.index01.hDayPhone.value = vDayPhone;
		document.index01.hTimezone.value = document.index01.cboTimeZone.options[document.index01.cboTimeZone.selectedIndex].text;
		return true;
	}
}

function ValidEmail01()	// email validation
{	
	var email1,atemail,atoccurance,splitter;
	email1 = document.index01.txtEmail.value;
	atemail=email1.indexOf("@");
	
	if (atemail==-1)
	{
		return false;
	}
	else
	{

		atoccurence=email1.indexOf("@");
		dotcheck=email1.indexOf(".",atoccurence);
				
		 if (dotcheck==-1)
			{
				return false;
			}	
				
			splitter=email1.substring(atoccurence+1,2);
		if (splitter==".")
		{
					return false;
		}
		if(email1.indexOf("@.")!=-1)
		{
			return false;
		}
								
		len=email1.length-1;
		if(email1.substr(len,1)==".")
		{
			return false;
		}									
					
		checky = email1.substr(len,1);
		if ((checky=="~")||(checky=="!")||(checky=="#")||(checky=="$")||(checky=="$")||(checky=="%")||(checky=="^")||(checky=="&")||(checky=="*")||(checky=="(")||(checky==")")||(checky=="_")||(checky=="+")||(checky=="|")||(checky=="-")||(checky=="?")||(checky==">")||(checky=="<")||(checky=="/")||(checky=="{")||(checky=="}")||(checky=="[")||(checky=="]")||(checky=="'")||(checky==":")||(checky==";")||(checky==",")||(checky=="`"))
		{
			return false;
		}
											
		if(email1.substr(0,1)=="@")
		{
			return false;
		}
		if(email1.substr(0,1)==".")
		{
			return false;
		}
		var speChar=0;
		for(i=0;i<email1.length;i++)
		{
			if(email1.substr(i,1)=="@")
			{
				speChar+=1;
			}
		}
		if(speChar>1)
		{
			return false;
		}
	}
	return true;
}
////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"PERSONAL INFO"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function initializePersonalInfoPage()
{
	document.frmQuestionair1.txtfName.focus();
	document.frmQuestionair1.txtfName.select();
}

function validatePersonalInfoPage()
{
	if( validatePersonalInfo() == true)
	{
		document.frmQuestionair1.submit();	
	}
}


function validatePersonalInfo()
{
	vEmail = document.frmQuestionair1.txtEmail.value;
	vFirstName = document.frmQuestionair1.txtfName.value;
	vlName = document.frmQuestionair1.txtlName.value;
	vcboAge = document.frmQuestionair1.cboAge.value;
	vZipcode = document.frmQuestionair1.txtZipCode.value;
	vPhone = document.frmQuestionair1.txtPhone.value;
	
	// Validate First Name
	if(jsTrim(vFirstName) == '')
	{
		alert("Please enter your first name.");
		document.frmQuestionair1.txtfName.focus();
		document.frmQuestionair1.txtfName.select();
		return false;
	}
	else if( containsQuotes( vFirstName ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair1.txtfName.focus();
		document.frmQuestionair1.txtfName.select();
		return false;
	}
	else if(jsTrim(vlName) == '')
	{
		alert("Please enter your last name.");
		document.frmQuestionair1.txtlName.focus();
		document.frmQuestionair1.txtlName.select();
		return false;
	}
	else if( containsQuotes( vlName ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair1.txtlName.focus();
		document.frmQuestionair1.txtlName.select();
		return false;
	}
	else if(jsTrim(document.frmQuestionair1.txtAddress.value) == '')
	{
		alert("Please enter address.");
		document.frmQuestionair1.txtAddress.focus();
		document.frmQuestionair1.txtAddress.select();
		return false;
	}
	else if( containsQuotes( document.frmQuestionair1.txtAddress.value ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair1.txtAddress.focus();
		document.frmQuestionair1.txtAddress.select();
		return false;
	}
	else if(jsTrim(document.frmQuestionair1.txtCity.value) == '')
	{
		alert("Please enter city.");
		document.frmQuestionair1.txtCity.focus();
		document.frmQuestionair1.txtCity.select();
		return false;
	}
	else if( containsQuotes( document.frmQuestionair1.txtCity.value ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair1.txtCity.focus();
		document.frmQuestionair1.txtCity.select();
		return false;
	}
	else if(document.frmQuestionair1.cboState.value == '')
	{
		alert("Please select the state.");
		document.frmQuestionair1.cboState.focus();
		document.frmQuestionair1.cboState.select();
		return false;
	}
	else if(jsTrim(document.frmQuestionair1.txtZipCode.value) == '')
	{
		alert("Please enter zip code.");
		document.frmQuestionair1.txtZipCode.focus();
		document.frmQuestionair1.txtZipCode.select();
		return false;
	}
	else if( !isCharsOk( vZipcode, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789+-"))
	{
		alert("Zip code should not contain any special characters");
		document.frmQuestionair1.txtZipCode.focus();
		document.frmQuestionair1.txtZipCode.select();
		return false;
	}
	else if( containsQuotes( vZipcode ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair1.txtZipCode.focus();
		document.frmQuestionair1.txtZipCode.select();
		return false;
	}
	else if(document.frmQuestionair1.cboCountry.value == '')
	{
		alert("Please select the country.");
		document.frmQuestionair1.cboCountry.focus();
		document.frmQuestionair1.cboCountry.select();
		return false;
	}
	else if(vcboAge == '')
	{
		alert("Please select your age.");
		document.frmQuestionair1.cboAge.focus();
		document.frmQuestionair1.cboAge.select();
		return false;
	}
	else if(jsTrim(vEmail) == '')
	{
		alert("Please enter your email id.");
		document.frmQuestionair1.txtEmail.focus();
		document.frmQuestionair1.txtEmail.select();
		return false;
	}
	else if( containsQuotes( vEmail ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair1.txtEmail.focus();
		document.frmQuestionair1.txtEmail.select();
		return false;
	}
	else if(ValidEmail()!=true)
	{
		errmsg = ValidEmail();
		alert(errmsg);	
		document.frmQuestionair1.txtEmail.focus();
		document.frmQuestionair1.txtEmail.select();
		return false;
	}
	else if(jsTrim(document.frmQuestionair1.txtPhone.value) == '')
	{
		alert("Please enter phone number.");
		document.frmQuestionair1.txtPhone.focus();
		document.frmQuestionair1.txtPhone.select();
		return false;
	}
	else if ( !isCharsOk( vPhone, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 +-"))
	{
		alert("Phone number should not contain any special characters");
		document.frmQuestionair1.txtPhone.focus();
		document.frmQuestionair1.txtPhone.select();
		return false;
	}
	else if( containsQuotes( document.frmQuestionair1.txtPhone.value ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair1.txtPhone.focus();
		document.frmQuestionair1.txtPhone.select();
		return false;
	}
	else if(document.frmQuestionair1.cboTimeZone.options[document.frmQuestionair1.cboTimeZone.selectedIndex].value == '-1')
	{
		alert("Please select a Time Zone.");
		document.frmQuestionair1.cboTimeZone.focus();
		document.frmQuestionair1.cboTimeZone.select();
		return false;
	}
	else
	{
		document.frmQuestionair1.cboCountry.options[document.frmQuestionair1.cboCountry.selectedIndex].value = document.frmQuestionair1.cboCountry.options[document.frmQuestionair1.cboCountry.selectedIndex].text;
		document.frmQuestionair1.hcountry.value = document.frmQuestionair1.cboCountry.options[document.frmQuestionair1.cboCountry.selectedIndex].text;
		
		document.frmQuestionair1.cboState.options[document.frmQuestionair1.cboState.selectedIndex].value = document.frmQuestionair1.cboState.options[document.frmQuestionair1.cboState.selectedIndex].text;
		document.frmQuestionair1.hstate.value = document.frmQuestionair1.cboState.options[document.frmQuestionair1.cboState.selectedIndex].text;
	}

	// set these now before submitting to pass them on to the next page...
	document.frmQuestionair1.hfirstName.value = vFirstName;
	document.frmQuestionair1.hlastName.value = vlName;
	document.frmQuestionair1.haddress.value = document.frmQuestionair1.txtAddress.value;
	document.frmQuestionair1.hcity.value = document.frmQuestionair1.txtCity.value;	
	document.frmQuestionair1.hzip.value = vZipcode;
	document.frmQuestionair1.hage.value = document.frmQuestionair1.cboAge.value;
	document.frmQuestionair1.hemail.value = document.frmQuestionair1.txtEmail.value;
	document.frmQuestionair1.hphone.value = document.frmQuestionair1.txtPhone.value;
	document.frmQuestionair1.htimezone.value = document.frmQuestionair1.cboTimeZone.options[document.frmQuestionair1.cboTimeZone.selectedIndex].text;
	return true;
}
	
function ValidEmail()	// email validation
{	
	var email1,atemail,atoccurance,splitter;
	email1 = document.frmQuestionair1.txtEmail.value;
	atemail=email1.indexOf("@");
	
	if (atemail==-1)
	{
		return "Your E-Mail id seems incorrect. Please check the '@' and '.' characters in your E-Mail id.";
	}
	else
	{
		atoccurence=email1.indexOf("@");
		dotcheck=email1.indexOf(".",atoccurence);
				
		 if (dotcheck==-1)
			{
				return "Your E-Mail id seems incorrect. Please check";
			}	
				
			splitter=email1.substring(atoccurence+1,2);
		if (splitter==".")
		{
			return "Your E-Mail id seems incorrect. Please check";
		}
		if(email1.indexOf("@.")!=-1)
		{
			return "Email should not have '@' immediately followed by '.'";
		}
								
		len=email1.length-1;
		if(email1.substr(len,1)==".")
		{
			return "Email should not have '.' as the last character";
		}									
					
		checky = email1.substr(len,1);
		if ((checky=="~")||(checky=="!")||(checky=="#")||(checky=="$")||(checky=="$")||(checky=="%")||(checky=="^")||(checky=="&")||(checky=="*")||(checky=="(")||(checky==")")||(checky=="_")||(checky=="+")||(checky=="|")||(checky=="-")||(checky=="?")||(checky==">")||(checky=="<")||(checky=="/")||(checky=="{")||(checky=="}")||(checky=="[")||(checky=="]")||(checky=="'")||(checky==":")||(checky==";")||(checky==",")||(checky=="`"))
		{
			return "Your E-Mail id seems incorrect. Please check";
		}
											
		if(email1.substr(0,1)=="@")
		{
			return "Email should not have '@' as the first character";
		}
		if(email1.substr(0,1)==".")
		{
			return "Email should not have '.' as the first character";
		}
		var speChar=0;
		for(i=0;i<email1.length;i++)
		{
			if(email1.substr(i,1)=="@")
			{
			speChar+=1;
			}
		}
		if(speChar>1)
		{
			return "Email should not have more than one '@'";
		}
	}
	return true;
}


////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"QUESTIONAIRE PAGE 2"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function initializePage2()
{

}

function jsTrim(TXT)
{
	return TXT.replace(/(^\s+)|(\s+$)/g,"");
}

function validateQuestionairePage()
{
	if( validateQuestionaire2() == true )
	{
		document.frmQuestionair2.submit();
	}
}

function validateQuestionaire2()
{
	flg1 = flg2 = flg3 = flg4 = flg5 = flg6 = "false";	
	varComments = document.frmQuestionair2.txtcomments.value;
	LenComments = varComments.length;	
	
	// QUESTION 1
	for( i=0; i<document.frmQuestionair2.extra1000.length; i++ )
	{ 
		if( document.frmQuestionair2.extra1000[i].checked == true )
		{
			document.frmQuestionair2.hQuestion1.value = document.frmQuestionair2.extra1000[i].value;
			if( document.frmQuestionair2.extra1000[4].checked == true )
			{
				document.frmQuestionair2.hQuestion1Text.value = document.frmQuestionair2.extra1000other.value;
			}
			flg1 = "true";
		}
	}	

	// QUESTION 2
	for( i=0; i<document.frmQuestionair2.candidate.length; i++ )
	{ 
		if( document.frmQuestionair2.candidate[i].checked == true )
		{
			document.frmQuestionair2.hQuestion2.value = document.frmQuestionair2.candidate[i].value;
			flg2 = "true";
		}
	}

	// QUESTION 3
	for( i=0; i<document.frmQuestionair2.selfemployed.length; i++ )
	{ 
		if( document.frmQuestionair2.selfemployed[i].checked == true )
		{
			document.frmQuestionair2.hQuestion3.value = document.frmQuestionair2.selfemployed[i].value;
			if( document.frmQuestionair2.selfemployed[0].checked == true)
			{
				document.frmQuestionair2.hQuestion3Text.value = document.frmQuestionair2.selfempdesc.value;
			}
			flg3 = "true";
		}
	}

	// QUESTION 6
	for( i=35; i<40; i++ )
	{		
		if( document.frmQuestionair2.elements[i].checked != false )
		{
			document.frmQuestionair2.hQuestion61.value = document.frmQuestionair2.elements[35].value;
			document.frmQuestionair2.hQuestion62.value = document.frmQuestionair2.elements[36].value;
			document.frmQuestionair2.hQuestion63.value = document.frmQuestionair2.elements[37].value;
			document.frmQuestionair2.hQuestion64.value = document.frmQuestionair2.elements[38].value;
			document.frmQuestionair2.hQuestion65.value = document.frmQuestionair2.elements[39].value;
			if( document.frmQuestionair2.elements[39].checked == true )
			{
				document.frmQuestionair2.hQuestion6Text.value = document.frmQuestionair2.homereasonothertxt.value;
			}
			flg4 = "true";
		}
	}

	// QUESTION 7
	for( i=0; i<document.frmQuestionair2.prepared.length; i++ )
	{ 		
		if( document.frmQuestionair2.prepared[i].checked == true )
		{
			document.frmQuestionair2.hQuestion7.value = document.frmQuestionair2.prepared[i].value;
			if( document.frmQuestionair2.elements[41].checked == true )
			{
				document.frmQuestionair2.hQuestion7Text.value = document.frmQuestionair2.preparedinvest[document.frmQuestionair2.preparedinvest.selectedIndex].value;
			}
			flg5 = "true";
		}
	}	

	// QUESTION 9
	for( i=0; i<document.frmQuestionair2.believe.length; i++ )
	{
		if( document.frmQuestionair2.believe[i].checked == true )
		{	
			document.frmQuestionair2.hQuestion9.value = document.frmQuestionair2.believe[i].value;
			flg6 = "true";
		}
	}


	if( flg1 != "true" )
	{
		alert("Please choose an appropriate answer for question 1.");
		return false;
	}
	else if( document.frmQuestionair2.extra1000[4].checked == true && document.frmQuestionair2.extra1000other.value == '' )
	{
		alert("Please fill the Other option textbox in question 1.");
		document.frmQuestionair2.extra1000other.focus();
		document.frmQuestionair2.extra1000other.select();
		return false;
	}
	else if( containsQuotes( document.frmQuestionair2.extra1000other.value ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair2.extra1000other.focus();
		document.frmQuestionair2.extra1000other.select();
		return false;
	}
	else if( flg2 != "true" )
	{
		alert("Please choose an appropriate answer for question 2.");
		return false;
	}
	else if( flg3 != "true" )
	{
		alert("Please choose an appropriate answer for question 3.");
		return false;
	}
	else if( document.frmQuestionair2.selfemployed[0].checked && document.frmQuestionair2.selfempdesc.value == '' )
	{
		alert("Please fill the Other option textbox in question 3.");
		document.frmQuestionair2.selfempdesc.focus();
		document.frmQuestionair2.selfempdesc.select();
		return false;
	}
	else if( containsQuotes( document.frmQuestionair2.selfempdesc.value ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair2.selfempdesc.focus();
		document.frmQuestionair2.selfempdesc.select();
		return false;
	}
	else if( jsTrim(document.frmQuestionair2.currentbusiness.value) =='' )
	{
		alert("Please choose an appropriate answer for question 4");
		document.frmQuestionair2.currentbusiness.focus();
		document.frmQuestionair2.currentbusiness.select();
		return false;
	}
	else if( containsQuotes( document.frmQuestionair2.currentbusiness.value ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair2.currentbusiness.focus();
		document.frmQuestionair2.currentbusiness.select();
		return false;
	}
	else if( document.frmQuestionair2.hoursperweek.options[document.frmQuestionair2.hoursperweek.selectedIndex].value == '' )
	{
		alert("Please select an appropriate answer for question 5.");
		return false;
	}
	else if(flg4 != "true")
	{
		alert("Please choose your answer for question 6.");
		return false;
	}
	else if( document.frmQuestionair2.elements[39].checked == true && document.frmQuestionair2.homereasonothertxt.value == '' )
	{
		alert("Please specify which trend in the textbox in question 6.");
		document.frmQuestionair2.elements[40].focus();
		document.frmQuestionair2.elements[40].select();
		return false;
	}
	else if( containsQuotes( document.frmQuestionair2.homereasonothertxt.value ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair2.elements[40].focus();
		document.frmQuestionair2.elements[40].select();
		return false;
	}
	else if(flg5 != "true")
	{
		alert("Please choose your answer for question 7.");
		return false;
	}
	else if( document.frmQuestionair2.elements[41].checked == true && document.frmQuestionair2.preparedinvest[document.frmQuestionair2.preparedinvest.selectedIndex].value == '' )
	{		
		alert("Please specify which how much you can invest in answer 7.");
		return false;
	}	
	else if( document.frmQuestionair2.cboExpectation[document.frmQuestionair2.cboExpectation.selectedIndex].value == '' )
	{
		alert("Please specify the answer for question 8.");
		return false;
	}	
	else if(flg6 != "true")
	{
		alert("Please choose your answer for question 9.");
		return false;
	}
	else if( document.frmQuestionair2.findsite.value == '' )
	{		
		alert("Please select a value for question 10");
		document.frmQuestionair2.findsite.focus();
		document.frmQuestionair2.findsite.select();
		return false;
	}
	else if( document.frmQuestionair2.calltime[document.frmQuestionair2.calltime.selectedIndex].value == '' )
	{
		alert("Please specify the answer for question 11.");
		return false;
	}
	else if( LenComments > 1000 )
	{
		alert("Your comments cannot be more than 1000 characters.");
		document.frmQuestionair2.txtcomments.focus();
		document.frmQuestionair2.txtcomments.select();
		return false;
	}
	else if( containsQuotes( varComments ) )
	{
		alert("Your comments cannot contain quotation marks.");
		document.frmQuestionair2.txtcomments.focus();
		document.frmQuestionair2.txtcomments.select();
		return false;
	}
	else
	{
		document.frmQuestionair2.hQuestion4.value = document.frmQuestionair2.currentbusiness.value;
		document.frmQuestionair2.hQuestion5.value = document.frmQuestionair2.hoursperweek.options[document.frmQuestionair2.hoursperweek.selectedIndex].value;
		document.frmQuestionair2.hQuestion8.value = document.frmQuestionair2.cboExpectation[document.frmQuestionair2.cboExpectation.selectedIndex].value;

		document.frmQuestionair2.hQuestion10.value = document.frmQuestionair2.findsite.value;

		document.frmQuestionair2.hQuestion11.value = document.frmQuestionair2.calltime[document.frmQuestionair2.calltime.selectedIndex].value;
		document.frmQuestionair2.hQuestion12.value = varComments;
		return true;
	}
}


function right(e)
{
  if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) 
	{  
		//alert('Thank you for using WTPowers.com !');
		//return false;
	}
  else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3 || event.keyCode == 93))
    {
		//alert('Thank You For Visiting WTPowers.com!');
		//return false;
	}

  //return true;
}
if( document.layers )
{
	window.captureEvents(Event.MOUSEDOWN);
}

function containsQuotes( strValue )
{
	var temp;
    for( var i = 0; i < strValue.length; i++ )
    {
        temp = "" + strValue.substring(i, i+1);
        if( (temp == "'") || (temp == '"') )
        {
			return true;
        }
    }
	return false;
}

////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"THANK YOU"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function openSSWindow()
{
	var newWindow;
    if( newWindow )
    {
        newWindow.close();
    }
	newWindow = window.open("http://www.yourmentorforsuccess.com/jls.htm","", "width=350,height=635");
}
////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"CONTACT MANAGER LOGIN"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function initializeContactManagerLoginPage()
{
	document.contactManagerLogin.txtUserName.focus();
	document.contactManagerLogin.txtUserName.select();
}

function validateContactManagerLoginPage()
{
	if( validateContactManagerLogin() == true )
	{
		document.contactManagerLogin.action = "ContactManager.asp?txtUserName=" + document.contactManagerLogin.txtUserName.value + "&txtPassword=" + document.contactManagerLogin.txtPassword.value;
//		document.contactManagerLogin.action = "processContactManagerLogin.asp";
		document.contactManagerLogin.submit();
	}
}

function validateContactManagerLogin()
{
	if(jsTrim(document.contactManagerLogin.txtUserName.value) == '')
	{
		alert("Please enter a User Name.");
		document.contactManagerLogin.txtUserName.focus();
		document.contactManagerLogin.txtUserName.select();
		return false;	
	}
	else if( containsQuotes( document.contactManagerLogin.txtUserName.value ) )
	{
		alert("User Name cannot contain quotation marks.");
		document.contactManagerLogin.txtUserName.focus();
		document.contactManagerLogin.txtUserName.select();
		return false;
	}
	else if(jsTrim(document.contactManagerLogin.txtPassword.value) == '')
	{
		alert("Please enter a Password.");
		document.contactManagerLogin.txtPassword.focus();
		document.contactManagerLogin.txtPassword.select();
		return false;	
	}
	else if( containsQuotes( document.contactManagerLogin.txtPassword.value ) )
	{
		alert("Password cannot contain quotation marks.");
		document.contactManagerLogin.txtPassword.focus();
		document.contactManagerLogin.txtPassword.select();
		return false;
	}
	else
	{
		return true;
	}
}

////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"CONTACT MANAGER"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function submitEmail( strvalue )
{
	if( validateContactID() == true )
	{
		document.contactManager.action="ProcessContactManager.asp?cid=" + strvalue;
		document.contactManager.submit();
	}
}


function submitNewAssociate()
{
	if( validateContactID() == true )
	{
		document.contactManager.action="newassociate.asp?txtUserName=" + document.contactManager.hContactID.value + "&txtPassword=" + document.contactManager.hPassword.value;
		document.contactManager.submit();
	}
}


function submitHits()
{
	if( validateContactID() == true )
	{
		document.contactManager.action="hits.asp?txtUserName=" + document.contactManager.hContactID.value + "&txtPassword=" + document.contactManager.hPassword.value;
		document.contactManager.submit();
	}
}

function initializeNewMessagePage()
{
	document.newMessage.txtSubject.focus();
	document.newMessage.txtSubject.select();
}

function submitNewFollowUp()
{
	if( validateContactID() == true )
	{
		document.contactManager.action="newmessage.asp?txtUserName=" + document.contactManager.hContactID.value + "&txtPassword=" + document.contactManager.hPassword.value;
		document.contactManager.submit();
	}
}


function submitEditDatabase()
{
	if( validateContactID() == true )
	{
		document.contactManager.action="databaseedit.asp?txtUserName=" + document.contactManager.hContactID.value + "&txtPassword=" + document.contactManager.hPassword.value;
		document.contactManager.submit();
	}
}

function submitDeleteDatabase()
{
	if( validateContactID() == true )
	{
		document.contactManager.action="databasedel.asp?txtUserName=" + document.contactManager.hContactID.value + "&txtPassword=" + document.contactManager.hPassword.value;
		document.contactManager.submit();
	}
}



function submitEditItems()
{
	var form = window.document.forms[0];
	var itemPreviouslySelected = false;
	var strEditString = "SELECT * FROM CONTACTS WHERE CONTACTID = ";
	
	for ( var i = 0; i < document.editItems.elements.length; i++)
	{
		if ( form.elements[i].type == "checkbox" )
		{
			// field was set to "checked"
			if( form.elements[i].checked )
			{
				// this goes in the loop
				if( itemPreviouslySelected == true )
				{
					strEditString	= strEditString + " OR CONTACTID = " + form.elements[i].value;				
				}
				else
				{
					strEditString	= strEditString + form.elements[i].value;
					itemPreviouslySelected = true;
				}
			}
		}
	}
	
	document.editItems.action = "editContact.asp?txtUserName=" + document.editItems.hContactID.value + "&txtPassword=" + document.editItems.hPassword.value + "&strEditQuery=" + strEditString;
	document.editItems.submit();
}

function submitDeleteItems()
{
	var form = window.document.forms[0];
	var itemPreviouslySelected = false;
	var strDeleteString = "SELECT * FROM CONTACTS WHERE CONTACTID = ";
	
	for ( var i = 0; i < document.deleteItems.elements.length; i++)
	{
		if ( form.elements[i].type == "checkbox" )
		{
			// field was set to "checked"
			if( form.elements[i].checked )
			{
				// this goes in the loop
				if( itemPreviouslySelected == true )
				{
					strDeleteString	= strDeleteString + " OR CONTACTID = " + form.elements[i].value;				
				}
				else
				{
					strDeleteString	= strDeleteString + form.elements[i].value;
					itemPreviouslySelected = true;
				}
			}
		}
	}
	
	document.deleteItems.action = "processDeleteItems.asp?txtUserName=" + document.deleteItems.hContactID.value + "&txtPassword=" + document.deleteItems.hPassword.value + "&strDeleteQuery=" + strDeleteString;
	document.deleteItems.submit();
}


function submitNewMessage()
{
	document.newMessage.action="processnewmessage.asp?txtUserName=" + document.newMessage.hContactID.value + "&txtPassword=" + document.newMessage.hPassword.value;
	document.newMessage.submit();
}


function logOut()
{
	document.contactManager.action="ContactManagerLogin.asp";
	document.contactManager.submit();
}

function backtocm()
{
	document.backToCM.action="contactmanager.asp?txtUserName=" + document.backToCM.hContactID.value + "&txtPassword=" + document.backToCM.hPassword.value;
	document.backToCM.submit();
}

function validateContactID()
{
	if( document.contactManager.hContactID.value == "" )
	{
		alert("Invalid User ID - Unable to Proceed");
		return false;
	}
	else if( document.contactManager.hPassword.value == "" )
	{
		alert("Invalid User ID - Unable to Proceed");
		return false;	
	}
	return true;
}

////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"AD POOL MANAGER"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function adPoolAdd()
{
	if( validateAddPoolAdd() == true )
	{
		document.formAdd.action = "processAddAssociate.asp"
		document.formAdd.submit();
	}
}

function adPoolDelete()
{
	var itemPreviouslySelected = false;
	var strDeleteString = "SELECT * FROM ROTATOR WHERE RECORDNUMBER = ";
	
	for ( var i = 0; i < document.formDelete.elements.length; i++)
	{
		if ( document.formDelete.elements[i].type == "checkbox" )
		{
			// field was set to "checked"
			if( document.formDelete.elements[i].checked )
			{
				// this goes in the loop
				if( itemPreviouslySelected == true )
				{
					strDeleteString	= strDeleteString + " OR RECORDNUMBER = " + document.formDelete.elements[i].value;				
				}
				else
				{
					strDeleteString	= strDeleteString + document.formDelete.elements[i].value;
					itemPreviouslySelected = true;
				}
			}
		}
	}
	
	document.formDelete.action = "processDeleteAdPoolMembers.asp?strDeleteQuery=" + strDeleteString;
	document.formDelete.submit();
}


function resetLeadCounters()
{
	document.formResetCounters.action = "processResetLeadCounters.asp"
	document.formResetCounters.submit();
}


function validateAddPoolAdd()
{
	if(document.formAdd.cboAssociate.options[document.formAdd.cboAssociate.selectedIndex].value == '-1')
	{
		alert("Please select an associate to add.");
		document.formAdd.cboAssociate.focus();
		return false;
	}

	if(document.formAdd.cboAdpoolname.options[document.formAdd.cboAdpoolname.selectedIndex].value == '-1')
	{
		alert("Please select an ad pool.");
		document.formAdd.cboAdpoolname.focus();
		return false;
	}

	if( jsTrim(document.formAdd.txtNumberSlots.value) == '' )
	{
		document.formAdd.txtNumberSlots.value = "1";
	}
	else
	{
		if( containsQuotes( jsTrim(document.formAdd.txtNumberSlots.value) ) )
		{
			alert("The number of slots cannot contain quotation marks.");
			document.formAdd.txtNumberSlots.focus();
			document.formAdd.txtNumberSlots.select();
			return false;
		}
		else if( isNaN(document.formAdd.txtNumberSlots.value) )
		{
			alert("You must enter a numerical value in this field.");
			document.formAdd.txtNumberSlots.focus();
			document.formAdd.txtNumberSlots.select();
			return false;		
		}
	}
	
	document.formAdd.hnumberslots.value = document.formAdd.txtNumberSlots.value;
	document.formAdd.hassociateID.value = document.formAdd.cboAssociate.options[document.formAdd.cboAssociate.selectedIndex].value;
	document.formAdd.hadpoolname.value = document.formAdd.cboAdpoolname.options[document.formAdd.cboAdpoolname.selectedIndex].value;
	return true;
}

////////////////////////////////////////////////////////////////////////////////////////
//
//
//	"NEW ASSOCIATE"
//
//
////////////////////////////////////////////////////////////////////////////////////////
function validateNewAssociatePage()
{
	if( validateNewAssociate() == true)
	{
		document.form.action = "processNewAssociate.asp";
		document.form.submit();	
	}
}

function validateNewAssociate()
{

	vFname = document.form.txtFname.value;
	vLname = document.form.txtLname.value;
	vEmail = document.form.txtEmail.value;
	vCity = document.form.txtCity.value;
	vState = document.form.txtState.value;
	vAssociateID = document.form.txtLLIAssociateid.value;
	vPhone = document.form.txtPhone.value;

	if(jsTrim(vFname) == '')
	{
		alert("Please enter your first name.");
		document.form.txtFname.focus();
		document.form.txtFname.select();
		return false;
	}
	else if( containsQuotes( vFname ) )
	{
		alert("Your first name cannot contain quotation marks.");
		document.form.txtFname.focus();
		document.form.txtFname.select();
		return false;
	}
	else if(jsTrim(vLname) == '') // last name
	{
		alert("Please enter your last name.");
		document.form.txtLname.focus();
		document.form.txtLname.select();
		return false;
	}
	else if( containsQuotes( vLname ) )
	{
		alert("Your last name cannot contain quotation marks.");
		document.form.txtLname.focus();
		document.form.txtLname.select();
		return false;
	}
	else if(jsTrim(vEmail) == '')
	{
		alert("Please enter your email address.");
		document.form.txtEmail.focus();
		document.form.txtEmail.select();
		return false;
	}
	else if( containsQuotes( vEmail ) )
	{
		alert("Your email address cannot contain quotation marks or colons.");
		document.form.txtEmail.focus();
		document.form.txtEmail.select();
		return false;
	}
	else if(ValidateEmail( vEmail )!= true)
	{
		alert("You have entered a bad email address.");	
		document.form.txtEmail.focus();
		document.form.txtEmail.select();
		return false;
	}
	else if(jsTrim(vCity) == '') // city
	{
		alert("Please enter your city.");
		document.form.txtCity.focus();
		document.form.txtCity.select();
		return false;
	}
	else if( containsQuotes( vCity ) )
	{
		alert("Your city cannot contain quotation marks.");
		document.form.txtCity.focus();
		document.form.txtCity.select();
		return false;
	}
	else if(jsTrim(vState) == '') // state
	{
		alert("Please enter your state.");
		document.form.txtState.focus();
		document.form.txtState.select();
		return false;
	}
	else if( containsQuotes( vState ) )
	{
		alert("Your state cannot contain quotation marks.");
		document.form.txtState.focus();
		document.form.txtState.select();
		return false;
	}
	else if(jsTrim(vAssociateID) == '')
	{
		alert("Please enter your Associate ID #.");
		document.form.txtLLIAssociateid.focus();
		document.form.txtLLIAssociateid.select();
		return false;
	}
	else if( containsQuotes( vAssociateID ) )
	{
		alert("Your Associate ID # cannot quotation marks.");
		document.form.txtLLIAssociateid.focus();
		document.form.txtLLIAssociateid.select();
		return false;
	}
	else if ( !isCharsOk( vAssociateID, "0123456789"))
	{
		alert("Your Associate ID # cannot contain any special characters or spaces");
		document.form.txtLLIAssociateid.focus();
		document.form.txtLLIAssociateid.select();
		return false;
	}
	else if(jsTrim(vPhone) == '')
	{
		alert("Please enter day phone number.");
		document.form.txtPhone.focus();
		document.form.txtPhone.select();
		return false;
	}
	else if ( !isCharsOk( vPhone, "()0123456789-. "))
	{
		alert("Phone number should not contain any special characters");
		document.form.txtPhone.focus();
		document.form.txtPhone.select();
		return false;
	}
	else if(document.form.cboTimeZone.options[document.form.cboTimeZone.selectedIndex].value == '-1')
	{
		alert("Please select a Time Zone.");
		document.form.cboTimeZone.focus();
		return false;
	}
	else
	{
		document.form.hfirstname.value = vFname;
		document.form.hlastname.value = vLname;
		document.form.hemail.value = vEmail;
		document.form.hcity.value = vCity;
		document.form.hstate.value = vState;
		document.form.hphone.value = vPhone;
		document.form.hassociateID.value = vAssociateID;
		document.form.htimezone.value = document.form.cboTimeZone.options[document.form.cboTimeZone.selectedIndex].value;
		return true;
	}
}

function ValidateEmail( strVal )	// email validation
{	
	var email1,atemail,atoccurance,splitter;
	email1 = strVal;
	atemail=email1.indexOf("@");
	
	if (atemail==-1)
	{
		return false;
	}
	else
	{
		atoccurence=email1.indexOf("@");
		dotcheck=email1.indexOf(".",atoccurence);
				
		 if (dotcheck==-1)
			{
				return false;
			}	
				
			splitter=email1.substring(atoccurence+1,2);
		if (splitter==".")
		{
					return false;
		}
		if(email1.indexOf("@.")!=-1)
		{
			return false;
		}
								
		len=email1.length-1;
		if(email1.substr(len,1)==".")
		{
			return false;
		}									
					
		checky = email1.substr(len,1);
		if ((checky=="~")||(checky=="!")||(checky=="#")||(checky=="$")||(checky=="$")||(checky=="%")||(checky=="^")||(checky=="&")||(checky=="*")||(checky=="(")||(checky==")")||(checky=="_")||(checky=="+")||(checky=="|")||(checky=="-")||(checky=="?")||(checky==">")||(checky=="<")||(checky=="/")||(checky=="{")||(checky=="}")||(checky=="[")||(checky=="]")||(checky=="'")||(checky==":")||(checky==";")||(checky==",")||(checky=="`"))
		{
			return false;
		}
											
		if(email1.substr(0,1)=="@")
		{
			return false;
		}
		if(email1.substr(0,1)==".")
		{
			return false;
		}
		var speChar=0;
		for(i=0;i<email1.length;i++)
		{
			if(email1.substr(i,1)=="@")
			{
				speChar+=1;
			}
		}
		if(speChar>1)
		{
			return false;
		}
	}
	return true;
}