var randomnumber = Math.round(Math.random() * 100000);

//code for email popup
//var daurl = ("http://costest.construction.com/cest/emailus/form2.asp?rd="+document.location.href);
//var canurl = ("http://costest.construction.com/cest/emailus/supplyform.asp?subject=canhelp");
//var needurl = ("http://costest.construction.com/cest/emailus/supplyform.asp?subject=needhelp");
//var friendurl = ("http://costest.construction.com/cest/efriend/friend.asp?rd="+document.location.href);

//function maillink(p){
//	window.open(p,'mail','width=617,height=561,scrollbars=yes,toolbar');
//	}
//end email code
	
function jumpMenu(target,selObj,restore){ 
  if (selObj.selectedIndex>0 && selObj.options[selObj.selectedIndex].value != ''){
    window.open(selObj.options[selObj.selectedIndex].value,target);}
  else if(selObj.options[selObj.selectedIndex].value == '')  {selObj.selectedIndex=0;}
  if (restore) selObj.selectedIndex=0;
}

ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;

function loadIFrame(urlToLoad) {
  document.write("<iframe src="+urlToLoad+" width='150' height='106' scrolling='no' frameborder='0' marginwidth='0' marginheight='0'></iframe>");
}
function loadILayer(urlToLoad) {
  document.write("<ilayer src="+urlToLoad+" width='150' height='106' scrolling='no'></ilayer>");
}

function loadIndices() {
 // if (ns4) loadILayer('http://hosting.standardandpoors.com/cgi-bin/WebObjects/SNP?action=gotoNamedPage&pageName=MarketIndices&tracking=CON&pc=CON&auth=USER');
 // else
   
//  if (ie4) loadIFrame('http://hosting.standardandpoors.com/cgi-bin/WebObjects/SNP?action=gotoNamedPage&tracking=CON&pc=CON&auth=user&pageName=MarketIndices');
}
 
  // if (ie4) loadIFrame('http://hosting.standardandpoors.com/cgi-bin/WebObjects/SNP?action=gotoNamedPage&tracking=CON&pc=CON&auth=user&pageName=MarketIndices');
   //  if (ie4) loadIFrame('http://beta.sandpwebsolutions.com/cgi-bin/WebObjects/SNP?action=gotoNamedPage&tracking=CON&pc=CON&auth=user&pageName=MarketIndices');

function checkOrps(someForm){

if((someForm.authcode.options[someForm.authcode.selectedIndex].value=="con100")||(someForm.authcode.options[someForm.authcode.selectedIndex].value=="con101")){
    someForm.orps.value=1;
}
else{
    someForm.orps.value=0;
}
}

function navimage (environment) {
	var site = "";
	if (environment > ""){
	  site=environment;
	}
	if (sponsor1.indexOf("home") > -1){
	  document.imghome.src = site+"/images/topnav_home_on.gif";
	}
	if (sponsor1.indexOf("center2") > -1){
	  document.imgresource.src = site+"/images/topnav_resource_on.gif";
	}
	if (sponsor1.indexOf("tert2") > -1){
	  document.imgresource.src = site+"/images/topnav_resource_on.gif";
	}
	if (sponsor1.indexOf("center3") > -1){
	  document.imgprojects.src = site+"/images/topnav_project_on.gif";
	}
	if (sponsor1.indexOf("tert3") > -1){
	  document.imgprojects.src = site+"/images/topnav_project_on.gif";
	}
	if (sponsor1.indexOf("center4") > -1){
	  document.imgproducts.src = site+"/images/topnav_products_on.gif";
	}
	if (sponsor1.indexOf("tert4") > -1){
	  document.imgproducts.src = site+"/images/topnav_products_on.gif";
	}
	if (sponsor1.indexOf("center5") > -1){
	  document.imgequipment.src = site+"/images/topnav_equip_on.gif";
	}
	if (sponsor1.indexOf("tert5") > -1){
	  document.imgequipment.src = site+"/images/topnav_equip_on.gif";
	}
	if (sponsor1.indexOf("center6") > -1){
	  document.imgcareer.src = site+"/images/topnav_career_on.gif";
	}
	if (sponsor1.indexOf("tert6") > -1){
	  document.imgcareer.src = site+"/images/topnav_career_on.gif";
	}
	if (sponsor1.indexOf("center7") > -1){
	  document.imgnews.src = site+"/images/topnav_news_on.gif";
	}	
	if (sponsor1.indexOf("tert7") > -1){
	  document.imgnews.src = site+"/images/topnav_news_on.gif";
	}
	if (sponsor1.indexOf("center8") > -1){
	  document.imgintl.src = site+"/images/topnav_intl_on.gif";
	}	
	if (sponsor1.indexOf("tert8") > -1){
	  document.imgintl.src = site+"/images/topnav_intl_on.gif";
	}
}

//-------------------------------------------------------
//  code for NEW sweets search box

function MHCSearch()
		{
			var search_keyword=document.getElementById('ad_keyword').value;
			if (search_keyword != '')
			{
			window.open('http://products.construction.com/portal/server.pt?open=512&objID=204&PageID=252&cached=true&mode=2&querySearch='+search_keyword+'&mustInclude=&searchSource=ES');
			}
		}

//-------------------------------------------------------
//  open new window (dreamweaver)

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//-------------------------------------------------------
//  swap image code

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_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_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];}
}