// JavaScript Document

function fwLoadMenus() {
  if (window.fw_menu_0) return;
  window.fw_menu_0 = new Menu("root",280,17,"Verdana, Arial, Helvetica, sans-serif",10,"#92342F","#ffffff","#BDBDB5","#92342F");  
  fw_menu_0.addMenuItem("overview","location='products_overview.asp'");
  fw_menu_0.addMenuItem("postfuture enterprise edition","location='products_ppenterprise.asp'");
  fw_menu_0.addMenuItem("print-at-home&#8482; incentives and certificates","location='products_printathome.asp'");
  fw_menu_0.addMenuItem("multi-content zone&#8482; personalization","location='products_multicontentzone.asp'");
  fw_menu_0.addMenuItem("xml remote control&#8482; transactional messaging","location='products_xmlremote.asp'");
  fw_menu_0.fontWeight="bold";
  fw_menu_0.hideOnMouseOut=true;
  window.fw_menu_1 = new Menu("root",285,17,"Verdana, Arial, Helvetica, sans-serif",10,"#92342F","#ffffff","#BDBDB5","#92342F");
  fw_menu_1.addMenuItem("overview","location='services_overview.asp'");
  fw_menu_1.addMenuItem("strategy roadmaps","location='services_roadmaps.asp'");
  fw_menu_1.addMenuItem("campaign analytics and optimization","location='services_analytics.asp'");
  fw_menu_1.addMenuItem("email design and web development","location='services_designdev.asp'");
  fw_menu_1.addMenuItem("subscription handling and data management","location='services_subman.asp'");
  fw_menu_1.addMenuItem("delivery assurance","location='services_assurance.asp'");
  fw_menu_1.addMenuItem("campaign management and quality assurance","location='services_campman.asp'");
  fw_menu_1.addMenuItem("automated messaging system","location='services_automated.asp'");
  fw_menu_1.fontWeight="bold";
  fw_menu_1.hideOnMouseOut=true;
  window.fw_menu_2 = new Menu("root",130,17,"Verdana, Arial, Helvetica, sans-serif",10,"#92342F","#ffffff","#BDBDB5","#92342F");
  fw_menu_2.addMenuItem("overview","location='solutions_overview.asp'");
  fw_menu_2.addMenuItem("business solutions","location='solutions_bus.asp'");
  fw_menu_2.addMenuItem("consumer solutions","location='solutions_con.asp'");
  fw_menu_2.fontWeight="bold";
  fw_menu_2.hideOnMouseOut=true;
  window.fw_menu_3 = new Menu("root",110,17,"Verdana, Arial, Helvetica, sans-serif",10,"#92342F","#ffffff","#BDBDB5","#92342F");
  fw_menu_3.addMenuItem("press releases","location='press_releases.asp'");
  fw_menu_3.addMenuItem("press coverage","location='press_coverage.asp'");
  fw_menu_3.addMenuItem("research","location='research.asp'");
  fw_menu_3.fontWeight="bold";
  fw_menu_3.hideOnMouseOut=true;
  window.fw_menu_4 = new Menu("root",99,17,"Verdana, Arial, Helvetica, sans-serif",10,"#92342F","#ffffff","#BDBDB5","#92342F");
  fw_menu_4.addMenuItem("overview","location='company_overview.asp'");
  fw_menu_4.addMenuItem("management","location='company_management.asp'");
  fw_menu_4.addMenuItem("jobs","location='company_jobs.asp'");
  fw_menu_4.addMenuItem("privacy policy","location='privacy.asp'");
  fw_menu_4.addMenuItem("terms of use","location='termsofuse.asp'");
  fw_menu_4.fontWeight="bold";
  fw_menu_4.hideOnMouseOut=true;

  fw_menu_4.writeMenus();
} // fwLoadMenus()

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// emailCheck v1.1.2: Sandeep V. Tamhankar (stamhankar@hotmail.com)
function emailCheck (emailStr) {
	var emailPat="^(.+)@(.+)$"
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat="^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$"
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) return false;
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) return false;
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {if (IPArray[i]>255) return false}
		return true
	}
	var domainArray=domain.match(domainPat)
	if (domainArray==null) return false;
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) return false;
	if (len<2) return false;
	return true;
}
	
function checkLogin(fm)
{
	if (fm.LoginName.value.length < 1) {
		alert("Please enter your username");
		fm.LoginName.focus();
		return false;
	}

	if (fm.LoginPassword.value.length < 1) {
		alert("Please enter your password");
		fm.LoginPassword.focus();
		return false;
	}
	return true;
}

function checkNewsletter(fm)
{
	if (!emailCheck(fm.EmailAddress.value)) {
		alert("Please enter your email address\n(Format: something@something.something)");
		fm.EmailAddress.focus();
		return false;
	}
	return true;
}

function ExecOnloadCommand()
{
	if (document.form1.BrowserCommand.value == 'cmdLoginError') MM_openBrWindow('login_error.htm','login','width=400,height=150')
	else
	if (document.form1.BrowserCommand.value == 'cmdEmailAddressError') alert('Invalid Email Address!')
	else
	if (document.form1.BrowserCommand.value != '') alert(document.form1.BrowserCommand.value);
}

IE4 = (document.all);
NS4 = (document.layers);

if (NS4) document.captureEvents(Event.KEYPRESS);
document.onkeypress = doKey;

function doKey(e) {
  whichASC = (NS4) ? e.which : event.keyCode;
  whichKey = String.fromCharCode(whichASC).toLowerCase();
	if (whichKey.charCodeAt(0) == 13) {
		if (document.form1.DefaultButton.value == 'Login') {
//			{if (checkLogin(document.form1)) document.form1.submit()}
			if(checkLogin(document.form1)) MM_openBrWindow('login.asp?LoginName='+document.form1.LoginName.value+'&LoginPassword='+document.form1.LoginPassword.value,'send1','width=450,height=150');
			document.form1.LoginPassword.value = '';
		}
		else if (document.form1.DefaultButton.value == 'Email') {
		  if (checkNewsletter(document.form1)) MM_openBrWindow('newsletter_signup.asp?SampleNumber=0&EmailAddress='+document.form1.EmailAddress.value,'send1','width=450,height=300')
		}
//		else alert('No button');
	return false;
  }
}

function checkInquiry(fm)
{
	if (fm.cname.value.length < 1) {
		alert("Please enter your name");
		fm.cname.focus();
		return false;
	}

	if (!emailCheck(fm.emailadd.value)) {
		alert("Please enter your email address\n(Format: something@something.something)");
		fm.emailadd.focus();
		return false;
	}
	return true;
}