
/************************************************************************************************
used for info req
param = "Component" or "Kit"
************************************************************************************************/	
	function onclick_radio(value) {
		
		//call function and pass in the value
		setDisabled(value);
		
	}
	
/************************************************************************************************
disable inforeq buttons
param = "Component" or "Kit"
************************************************************************************************/	
	function setDisabled(value) {
	
		if (value.substring(0,3) == "KIT"||value == "Component") {
			var strStatus = (value != "Component"); //sets status to true if value = kit, else false

			var strControls = document.frmInfoReq.elements;

			//iterate through the form elements
			for (var i = 0; i < strControls.length; i++) {
	
				//if checkbox
				if (strControls[i].type == "checkbox") {
					//if a component checkbox is not checked
					if (strControls[i].name.indexOf("Component") == 0) {
						strControls[i].disabled = strStatus; //set disabled 
					}
				}
			}
		}			
	}

/************************************************************************************************
called before html is processed on inforeq page
************************************************************************************************/
	function hideScript() {
		
		var objMaterial = document.all("Material");
		if ((typeof(objMaterial) != "undefined")&&(objMaterial != null)) {
			if (objMaterial[0].checked) {
				setDisabled("KIT");
			}
			else {
				setDisabled("Component");
			}
		}
	}
	

/************************************************************************************************
This function is used for opening the conference call window
Param = ConferenceCall EventID
************************************************************************************************/
function newWindow(eventID) {
	audioURL = "conferencecallhost.asp?event=" + eventID + "&client=aol"
	audioWindow = window.open(audioURL.toLowerCase(), 'audioWin', 'width=500,height=400,resizeable=yes,toolbars=1')
}

/************************************************************************************************
This function will open a new window
Param 1 = URL of the new window
param 2 = Width Value
param 3 = height value
************************************************************************************************/
function winOpen(url, x, y) {
	win = "scrollbars=yes,width=" + x + ",height=" + y +",left=0,top=0"; 
 	wind = window.open(url,'popWin',win);	
	window.wind.focus();
}

function getDate() 
{	
	//set the months to an array
	months = new Array(12);
	months[0] = "Jan"
	months[1] = "Feb"
	months[2] = "Mar"
	months[3] = "Apr"
	months[4] = "May"
	months[5] = "Jun"
	months[6] = "Jul"
	months[7] = "Aug"
	months[8] = "Sep"
	months[9] = "Oct"
	months[10] = "Nov"
	months[11] = "Dec"
	

	//set todays date to variable now
	now = new Date();
	
	//right out the full date,..as day, month, year
	document.write(now.getDate() + " " + months[now.getMonth()] + " "  + now.getFullYear());
 	document.close();	
}

function BweekDate() 
{
	//set the months to an array
	months = new Array(12);
	months[0] = "January"
	months[1] = "February"
	months[2] = "March"
	months[3] = "April"
	months[4] = "May"
	months[5] = "June"
	months[6] = "July"
	months[7] = "August"
	months[8] = "September"
	months[9] = "October"
	months[10] = "November"
	months[11] = "December"
	
	//set the Days to an array
	days = new Array(7);
	days[0] = "Sunday"
	days[1] = "Monday"
	days[2] = "Tuesday"
	days[3] = "Wednesday"
	days[4] = "Thursday"
	days[5] = "Friday"
	days[6] = "Saturday"
	
	//set todays date to variable now
	now = new Date();
	
	//right out the full date,..as day, month, year
	document.write(days[now.getDay()] + ", " + months[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear());
 	document.close();
}

/************************************************************************************************
This function will take redirect the user to the appropriate directory page
************************************************************************************************/
function companyDirectory(client,letter,industry,datatype) {
	
	var x = document.frmDirectory

	if (x.txtIndustryID.options[x.txtIndustryID.selectedIndex].value == "") {
		
		alert("Please choose an Option from the list below");
		return false;
		
	}
	else if (x.txtIndustryID.options[x.txtIndustryID.selectedIndex].value > 400) {
		location.href = "companyindustrydir.asp?client=" + client + "&letter=" + letter + "&industry=" + industry + x.txtIndustryID.options[x.txtIndustryID.selectedIndex].value + "&data=" + datatype
	}
	
	else {
		location.href = "companyindustrydir.asp?client=" + client + "&letter=" + letter + "&industry=" + x.txtIndustryID.options[x.txtIndustryID.selectedIndex].value + "&data=" + datatype
	}
	
}


/************************************************************************************************
This function will validate financial news alerts when news alerts are already checked
************************************************************************************************/
function validateFinancialNewsAlerts()
{
	f=document.frmJoinMail;
	if ((f.elements['ir-financialnews'])&&(f.elements['ir-news']))
	{
		if ((f.elements['ir-financialnews'].checked)&&(f.elements['ir-news'].checked))
		{
			alert ("You are already signed up to receive " + f.elements['ir-news'].value + ". By signing up for " + f.elements['ir-news'].value + " you will receive " + f.elements['ir-financialnews'].value + " by default. Please un-check " + f.elements['ir-financialnews'].value + " to proceed to the next screen.");
			return false;
		}
		else return true;
	}
	else return true;
}

/************************************************************************************************
This function will validate e-mail address
************************************************************************************************/
function validateEmailAddress(txtEmail)
{
	if (txtEmail.value == "")
	{
		alert("Please Enter Your E-Mail Address");
		txtEmail.focus();
		return false;
	}
	else if (txtEmail.value.indexOf("@",1) == -1)
	{
		alert("Please Enter a Valid E-Mail Address");
		txtEmail.focus()
		return false;
	}
	else if ((txtEmail.value.indexOf("<") != -1) || (txtEmail.value.indexOf(">") != -1))
	{
		alert("Please Enter a Valid E-Mail Address");
		txtEmail.focus()
		return false;
	}
	else return true;
}

/************************************************************************************************
This function will validate joinmail 
************************************************************************************************/
function validateEmail() {

	if (validateFinancialNewsAlerts())
	{
		x = document.frmJoinMail
	
		if (!validateEmailAddress(x.txtEmail)) return false;
		else return true;
	}
	else return false;
}

/************************************************************************************************
This function will validate joinmail for Etrade cobrand
************************************************************************************************/
function validateEmailEtrade()
{
	if (validateEmail()) document.frmJoinMail.submit();
}

/************************************************************************************************
This function will validate joinmail 
************************************************************************************************/
function validateInclude() {
	
	x = document.frmInclude
	
	if (x.FirstName.value == "") {
		alert("Please Enter Your First Name");
		x.FirstName.focus()
		return false;
	}
	else if (x.LastName.value == "") {
		alert("Please Enter Your Last Name");
		x.LastName.focus()
		return false;
	}
	else if (!validateEmailAddress(x.Email)) return false;
	else if (x.Company.value == "") {
		alert("Please Enter Your Company Name");
		x.Company.focus()
		return false;
	}
	else if (x.Title.value == "") {
		alert("Please Enter Your Title");
		x.Title.focus()
		return false;
	}
	else if (x.Address1.value == "") {
		alert("Please Enter Your Address");
		x.Address1.focus()
		return false;
	}
	else if (x.State.value == "") {
		alert("Please Enter Your State");
		x.State.focus()
		return false;
	}
	else if (x.Zip.value == "") {
		alert("Please Enter Your Zip Code");
		x.Zip.focus()
		return false;
	}
	else if (x.Phone.value == "") {
		alert("Please Enter Your Phone Number");
		x.Phone.focus()
		return false;
	}
	else {
		return true;
	}
}

/************************************************************************************************
This function will validate suggestion form
************************************************************************************************/
function validateSug() {
	x = document.frmSuggestion
	
	if (x.txtCompanyName.value == "") {
		alert("Please enter the name of the Company");
		x.txtCompanyName.focus();
		return false;
	}
	else if (!validateEmailAddress(x.txtEmail)) return false;
}

/************************************************************************************************
This function will validate and submit suggestion form for Etrade cobrand
************************************************************************************************/
function validateSugEtrade()
{
	x = document.frmSuggestion;

	if (x.txtCompanyName.value == "") {
		alert("Please enter the name of the Company");
		x.txtCompanyName.focus();
	}
	else if (validateEmailAddress(x.txtEmail)) x.submit();
}

/************************************************************************************************
This function will validate information request form
************************************************************************************************/
function validateInfoReq()
{
	x = document.frmInfoReq;

	if (x.email)
	{
		if (x.email.value != "")
		{
			if (!validateEmailAddress(x.email)) return false;
			else return true;
		}
		else return true;
	}
	else return true;
}

/************************************************************************************************
This function will validate and submit information request form for Etrade cobrand
************************************************************************************************/
function validateInfoReqEtrade()
{
	if (validateInfoReq()) document.frmInfoReq.submit();
}

/************************************************************************************************
This function is used for streetevents ticker search
param = streetevents url
************************************************************************************************/
function checkSearch1d(se_url) {

	var x = document.sstart

	if (x.search.value != "") {	
		if (x.radiobutton[0].checked) {
			x.action = se_url + '/search.asp?type=ticker';
			x.submit();
			return true;
		}	 
		else if (x.radiobutton[1].checked) {
			x.action = se_url + '/search.asp?type=name';
			x.submit();
			return true;
		}	 
	}
	else {
		return false;
	}
}
/************************************************************************************************
change location only if passed a valid URL
param = url
************************************************************************************************/
function gotoPage(url) {
	
	if (("" != url) && ("#" != url)) {
  	location.href=url;
  }
	
}