//'*******************************************************************************
//'Function:      GetNewPage
//'Parameters:
//'Return:
//'Description:   automatically loads page from a dropdown SELECT list
//'*******************************************************************************

function getNewPage(form) {
	var f = form.urlList;
	var selectedUrl = f.options[f.selectedIndex].value;
	return location.href = selectedUrl;
}
//'*******************************************************************************
//'Function:      PreloadImages
//'Parameters:
//'Return:
//'Description:   preload images that are used for mouseovers
//'*******************************************************************************

function PreloadImages()
{
   if (document.images)
   {

     tellafriend_off = new Image();
	 tellafriend_off.src = "/images/tellafriend_off.gif";
	 tellafriend_on = new Image();
	 tellafriend_on.src = "/images/tellafriend_on.gif";
	 tellafriend_active = new Image();
	 tellafriend_active.src = "/images/tellafriend_on.gif"; 

   }
}
// call this function as soon as its loaded
PreloadImages();

//'*******************************************************************************
//'Function:      TurnOn
//'Parameters:    strName,strCurrentSection,strMenu
//'Return:
//'Description:   function to turn on mouseover effect for navigation elements
//'*******************************************************************************

function TurnOn(strName)
{
   if (document.images)
   {
      onImage = eval(strName + "_on.src");
      document[strName].src = onImage;
   }
}

//'*******************************************************************************
//'Function:      TurnOff
//'Parameters:    strName,strCurrentSection,strMenu
//'Return:
//'Description:   function to turn off mouseover effect for navigation elements
//'*******************************************************************************

function TurnOff(strName,strCurrentSection,strMenu)
{
   if (document.images)
   {
      if (strCurrentSection != strMenu)
      {
         offImage = eval(strName + "_off.src");
         document[strName].src = offImage;
      }
      else
      {
         activeImage = eval(strName + "_active.src");
         document[strName].src = activeImage;
      }
   }
}



//'*******************************************************************************
//'Function:      LaunchExternal
//'Parameters:    strURL
//'Return:
//'Description:   function to launch a new window set to a specific size
//'*******************************************************************************

function LaunchExternal(strURL)
{
   NewWindow(strURL,'external_window',1,1,1,1,1,1,1,750,525);
}

//'*******************************************************************************
//'Function:      NewWindow
//'Parameters:    strURL,strName,intMenubar,intToolbar,intLocation,
//'               intDirectories,intStatus,intScrollbars,intResizable,
//'               intWidth,intHeight
//'Return:
//'Description:   function to launch a new window set to specific parameters
//'*******************************************************************************

function NewWindow(strURL,strName,intMenubar,intToolbar,intLocation,intDirectories,intStatus,intScrollbars,intResizable,intWidth,intHeight)
{
   var objNewWindow;
   if (strURL == '' && strName == 'print')
   {  
		strURL = window.location + "&Print=True";
   }
   
   if (strURL == '' && strName == 'print2')
   {  
		strURL = window.location + "?Print=True";
   }
   var strParameters
   strParameters = 'menubar=' + intMenubar;
   strParameters += ',toolbar=' + intToolbar;
   strParameters += ',location=' + intLocation;
   strParameters += ',directories=' + intDirectories;
   strParameters += ',status=' + intStatus;
   strParameters += ',scrollbars=' + intScrollbars;
   strParameters += ',resizable=' + intResizable;
   strParameters += ',width=' + intWidth;
   strParameters += ',height=' + intHeight;
   strParameters += ',screenX=' + 10;
   strParameters += ',screenY=' + 10;
   strParameters += ',left=' + 10;
   strParameters += ',top=' + 10;
   objNewWindow = window.open(strURL,strName,strParameters);
   objNewWindow.focus();
}

//entrepreneur form validation
function checkInput()
{

	if (document.contactform.orgName.value == ""){
		alert("Please enter the Organization name.");
		document.contactform.orgName.focus();
		return;
	}
	
	if (document.contactform.Contact.value == ""){
		alert("Please enter the contact person.");
		document.contactform.Contact.focus();
		return;
	}
	
	if (document.contactform.Bus_Address.value == ""){
		alert("Please enter the address street.");
		document.contactform.Bus_Address.focus();
		return;
	}
	
	if (document.contactform.Bus_City.value == ""){
		alert("Please enter the address city.");
		document.contactform.Bus_City.focus();
		return;
	}
	
	if (document.contactform.Phone.value == ""){
		alert("Please enter the phone number.");
		document.contactform.Phone.focus();
		return;
	}
	
	if (document.contactform.Fax.value == ""){
		alert("Please enter the fax number.");
		document.contactform.Fax.focus();
		return;
	}
	
	if (document.contactform.Email.value == ""){
		alert("Please enter the email address");
		document.contactform.Email.focus();
		return;
	}
	
	if (document.contactform.Email.value!=""){
		var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
		var check=/@[\w\-]+\./;
		var checkend=/\.[a-zA-Z]{2,4}$/;  
		if(((document.contactform.Email.value.search(exclude) != -1) || (document.contactform.Email.value.search(check)) == -1) || (document.contactform.Email.value.search(checkend) == -1)){              
			alert("Invalid email address!");   
			document.contactform.Email.focus()
			return;   
		}       
	}	
	
	if (document.contactform.Certify.checked == false ){
		alert("You must certify that the information given is correct.");
		document.contactform.Certify.focus();
		return;
	}
	
	//alert("All good");
	document.contactform.submit();
}

//investor form validation
function checkInput2()
{

	if (document.contactform.orgName.value == ""){
		alert("Please enter the Organization name.");
		document.contactform.orgName.focus();
		return;
	}
	
	if (document.contactform.Contact.value == ""){
		alert("Please enter the contact person.");
		document.contactform.Contact.focus();
		return;
	}
	
	if (document.contactform.Bus_Address.value == ""){
		alert("Please enter the business mailing address.");
		document.contactform.Bus_Address.focus();
		return;
	}
	
	/*if (document.contactform.Bus_City.value == ""){
		alert("Please enter the address city.");
		document.contactform.Bus_City.focus();
		return;
	}*/
	
	if (document.contactform.Phone.value == ""){
		alert("Please enter the phone number.");
		document.contactform.Phone.focus();
		return;
	}
	
	if (document.contactform.Fax.value == ""){
		alert("Please enter the fax number.");
		document.contactform.Fax.focus();
		return;
	}
	
	if (document.contactform.Email.value == ""){
		alert("Please enter the email address");
		document.contactform.Email.focus();
		return;
	}
	
	if (document.contactform.Email.value!=""){
		var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
		var check=/@[\w\-]+\./;
		var checkend=/\.[a-zA-Z]{2,4}$/;  
		if(((document.contactform.Email.value.search(exclude) != -1) || (document.contactform.Email.value.search(check)) == -1) || (document.contactform.Email.value.search(checkend) == -1)){              
			alert("Invalid email address!");   
			document.contactform.Email.focus()
			return;   
		}       
	}	
	
	if (document.contactform.Agriculture.checked == false && 
	document.contactform.biotechnology.checked == false && 
	document.contactform.consumer_products.checked == false && 
	document.contactform.cultural_industries.checked == false && 
	document.contactform.energy.checked == false && 
	document.contactform.electronics.checked == false && 
	document.contactform.finance_or_consumer_credit.checked == false && 
	document.contactform.industrial_manufacturing.checked == false && 
	document.contactform.information_technology.checked == false && 
	document.contactform.nanotechnology.checked == false && 
	document.contactform.nutriceuticals.checked == false && 
	document.contactform.new_media.checked == false && 
	document.contactform.oil_gas.checked == false && 
	document.contactform.retail.checked == false && 
	document.contactform.software.checked == false && 
	document.contactform.others.checked == false && 
	document.contactform.all_sectors.checked == false) {
		alert("You must select at least one industry sector you are interested in.");
		document.contactform.Agriculture.focus();
		return;
	}
	
	
	if (document.contactform.certify.checked == false ){
		alert("You must acknowledge the 'Deal Generator Rules of Engagement'.");
		document.contactform.certify.focus();
		return;
	}
	
	//alert("All good");
	document.contactform.submit();
}