//start of function for DHTNL dropdowns//

function MM_reloadPage(init) {  //Reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 P7_autoLayers() { //v1.2 
 var g,b,k,f,args=P7_autoLayers.arguments;
 var a = parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc) {p7c=new Array();document.p7setc=true;
  for (var u=0;u<10;u++) {p7c[u] = new Array();}}
 for(k=0; k<p7c[a].length; k++) {
  if((g=MM_findObj(p7c[a][k]))!=null) {
   b=(document.layers)?g:g.style;b.visibility="hidden";}}
 for(k=1; k<args.length; k++) {
  if((g=MM_findObj(args[k])) != null) {
   b=(document.layers)?g:g.style;b.visibility="visible";f=false;
   for(j=0;j<p7c[a].length;j++) {
    if(args[k]==p7c[a][j]) {f=true;}}
  if(!f) {p7c[a][p7c[a].length++]=args[k];}}}
}

//end of function for DHTNL dropdowns//

function show(object) {
  if (document.getElementById && document.getElementById(object)) {
    document.getElementById(object).style.visibility = 'visible';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].visibility = 'visible';
  }
  else if (document.all && document.all[object]) {
    document.all[object].style.visibility = 'visible';
  }
}

function hide(object) {
  if (document.getElementById && document.getElementById(object)) {
    document.getElementById(object).style.visibility = 'hidden';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].visibility = 'hidden';
  }
  else if (document.all && document.all[object]) {
    document.all[object].style.visibility = 'hidden';
  }
}

function clearDefaultandCSS(el) {
	if (el.defaultValue==el.value) el.value = ""
	// If Dynamic Style is supported, clear the style
	if (el.style) el.style.cssText = ""
}

//start function to change image rollovers//
	if (document.images) {
	
		dotbg = new Image
		dotbg_ro = new Image
		dotbg.src = "/img/misc/dot_16.gif"
		dotbg_ro.src = "/img/s.gif"
		
	}
	
	function ImgRoll(imgName,newImg) {
		if (document.images) {
			document[imgName].src= eval(newImg + ".src")
		}
	}



function toggleLayer(layer) { 
	if ((document.location.href != "http://cpdevcenter.niteo.com/0_0_0_0_Secure_home_CEL1.asp") && (document.location.href != "http://cpdevcenter.niteo.com/0_0_0_0_Secure_home_RCI1.asp") && (document.location.href != "http://cpdevcenter.niteo.com/0_0_0_0_Secure_Wrapper.asp")){
		document.getElementById(layer).style.visibility='hidden'; 
		document.getElementById(layer).style.display='none';
	}
	else {
		document.getElementById(layer).style.visibility='visible'; 
		document.getElementById(layer).style.display='block';
	}
}
// for the menu iframes ie select box fix:
// Browser sniff -- the following code does a very simple browser check and rates the 
//     browser as either Internet Explorer on a Win32 platform or not, so that we 
//     know to use the ActiveX model, or the plug-in Model.
var sBrowser = navigator.userAgent;  
if ((sBrowser.indexOf("IE") > -1) && (navigator.platform == "Win32"))
{
	sBrowser = "IE";
} else {
	sBrowser = "nonIE";
}
// end browser sniff
function ShowMenu(m_name) {
	if (sBrowser == "IE") {
		document.getElementById(m_name).style.display = "inline"; 
	}
}
function HideMenu(m_name) {
	if (sBrowser == "IE") {
		document.getElementById(m_name).style.display = "none";
	}
}
function doLink(url){
	location.href=url;
}
function jsBasic_popup(param_href, param_width, param_height) {
	window.open(param_href,"","toolbar=1,directories=1,status=1,menubar=1,location=1,scrollbars=1,resizable=1,width="+param_width+",height="+param_height);
}	
function jsBasic_popupfull(param_href, param_width, param_height) {
	window.open(param_href,"","toolbar=1,directories=1,status=1,menubar=1,location=1,scrollbars=1,resizable=1,width="+param_width+",height="+param_height);
}
function jsBasic_popup(param_href, param_width, param_height, param_hasScroll) {
	if(param_hasScroll) {		
		window.open(param_href,"","toolbar=0,directories=0,status=0,menubar=0,location=0,scrollbars=1,resizable=0,width="+param_width+",height="+param_height);
	} else {
		window.open(param_href,"","toolbar=0,directories=0,status=0,menubar=0,location=0,scrollbars=0,resizable=0,width="+param_width+",height="+param_height);
	}
}

// cookie functions
function setCookie(name, value, expires, path, domain, secure) {
   var curCookie = name + "=" + escape(value) +
       ((expires) ? "; expires=" + expires : "") +
       ((path) ? "; path=" + path : "") +
       ((domain) ? "; domain=" + domain : "") +
       ((secure) ? "; secure" : "");
   document.cookie = curCookie;
}

function getCookie(name) {
   var dc = document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   if (begin == -1) {
     begin = dc.indexOf(prefix);
     if (begin != 0) return null;
   } else
     begin += 2;
   var end = document.cookie.indexOf(";", begin);
   if (end == -1)
     end = dc.length;
   return unescape(dc.substring(begin + prefix.length, end)); 
} 


function setAllBrands(name){
	var formName = document.forms[name]; 
	var brandCol = formName.promotionBrand;
	var check = "";
	brandCol[(brandCol.length-1)].checked = 'checked';
		
	for ( b = 0 ; b < (brandCol.length-1) ; b++ ) 
		brandCol[b].checked = ""; 
	check = "checked";
	
}

// This function will check/uncheck brands
function toogleBrands(name,brand) {
	var formName = document.forms[name]; 
	var brandCol = formName.promotionBrand;
	var check = "";
	var dis = "disabled";
	if ( brand.length > 1 ) {
		if ( brandCol[(brandCol.length-1)].checked == true ){										
			for ( b = 0 ; b < (brandCol.length-1) ; b++ ) 
				brandCol[b].checked = ""; 
			check = "checked";										
		} 
	} else {	
		for ( b = 0 ; b < (brandCol.length-1) ; b++ ) {
				if ( brandCol[b].value.indexOf(brand) !=-1 && brandCol[b].checked == true ){
					brandCol[(brandCol.length-1)].checked = "";
					break;
				}	
		}
	}
}
							
//-->

