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_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 NewsletterSubmit() {
	var txtEmail = document.getElementById("newsletter_signup");
	var reEmail = /^[\w-\.]+\@[\w\.-]+\.[a-z]{2,4}$/;
	if (!(reEmail.test(txtEmail.value))) {
		alert ("Please enter a valid e-mail address.");
		return false;
	}
	else {
		txtEmail.form.submit();
	}
}

//Checks if the supplied fields are empty and highlights field in red if so
function ContactFormValidation (sFieldIDs) {
   var i;
   var arrFields = sFieldIDs.split(":");
   var currField;
   var bSubmitForm = true;
   var email= /^[\w-\.]+\@[\w\.-]+\.[a-zA-Z]{2,4}$/;
   
   for (i = 0; i < arrFields.length; i++) {
      // Get form field reference
      currField = document.getElementById(arrFields[i]);
      
      // Check for null in the case of a non existing html element
      if (currField != null) {      
         // Set fields style to default
         SetBorderStyle(currField, "default");
         
         // If field is empty then set the style to red background and border
         if (currField.name.toLowerCase() == "email" && (!(email.test(currField.value)))) {
            SetBorderStyle(currField, "error");
            bSubmitForm = false;
         }
         else if (currField.value == "") {
            SetBorderStyle(currField, "error");
            bSubmitForm = false;
         }
      }
   }
   return bSubmitForm;
}
function SetBorderStyle(fldFormField, fDefaultOrError){
   if (fDefaultOrError.toLowerCase() == "error") {
      borderstyle = "1px solid #ea172a";
      bgcolorstyle = "#ffc0c0";
   }
   else if (fDefaultOrError.toLowerCase() == "default") {
      borderstyle = "1px solid #969696";
      bgcolorstyle = "#FFFFFF";
   }
   
   fldFormField.style.border = borderstyle;
   fldFormField.style.background = bgcolorstyle;
}

function showthis(id) {
	if (id == "setup") {
		document.getElementById('setup').style.display = "block";
		document.getElementById('costs').style.display = "none";
		document.getElementById('results').style.display = "none";
	}
	else if (id == "costs") {
		document.getElementById('setup').style.display = "none";
		document.getElementById('costs').style.display = "block";
		document.getElementById('results').style.display = "none";
	}
	else {
		document.getElementById('setup').style.display = "none";
		document.getElementById('costs').style.display = "none";
		document.getElementById('results').style.display = "block";
	}
}

function mmLoadMenus() {
	// Advertisers
	if (window.mm_menu_1008145136_0) return;
	window.mm_menu_1008145136_0 = new Menu("root",185,20,"Arial, Helvetica, sans-serif",14,"#ffffff","#ffffff","#66961b","#84c126","left","middle",3,0,250,0,0,true,true,true,5,true,true);
	mm_menu_1008145136_0.addMenuItem("Targeting&nbsp;and&nbsp;Optimization","location='advertisers_targeting_optimization.php'");
	mm_menu_1008145136_0.addMenuItem("Catagories/Channels","location='advertisers_catagories_channels.php'");
	mm_menu_1008145136_0.addMenuItem("Validation","location='advertisers_validation.php'");
	mm_menu_1008145136_0.addMenuItem("Campaign&nbsp;Management","location='advertisers_campaign_management.php'");
	mm_menu_1008145136_0.addMenuItem("Formats&nbsp;and&nbsp;Pricing","location='advertisers_formats_pricing.php'");
	mm_menu_1008145136_0.addMenuItem("FAQ","location='advertisers_faq.php'");
	mm_menu_1008145136_0.addMenuItem("Open&nbsp;an&nbsp;account","location='advertisers_open_account.php'");
	mm_menu_1008145136_0.hideOnMouseOut=true;
	mm_menu_1008145136_0.menuBorder=0;
	mm_menu_1008145136_0.menuLiteBgColor='#03284d';
	mm_menu_1008145136_0.menuBorderBgColor='#03284d';
	mm_menu_1008145136_0.bgColor='#03284d';
	
	// Publishers
	if (window.mm_menu_1008145136_1) return;	
	window.mm_menu_1008145136_1 = new Menu("root",139,20,"Arial, Helvetica, sans-serif",14,"#ffffff","#ffffff","#66961b","#84c126","left","middle",3,0,250,0,0,true,true,true,5,true,true);
	mm_menu_1008145136_1.addMenuItem("Rates&nbsp;and&nbsp;Payment","location='publishers_rates_payment.php'");
	mm_menu_1008145136_1.addMenuItem("FAQ","location='publishers_faq.php'");
	mm_menu_1008145136_1.addMenuItem("Specifications","location='publishers_specifications.php'");
	mm_menu_1008145136_1.hideOnMouseOut=true;
	mm_menu_1008145136_1.menuBorder=0;
	mm_menu_1008145136_1.menuLiteBgColor='#000000';
	mm_menu_1008145136_1.menuBorderBgColor='#000000';
	mm_menu_1008145136_1.bgColor='#000000';	
	
	mm_menu_1008145136_1.writeMenus();
} // mmLoadMenus()