var subMnus="";
									
function showmenu(idx,li){
	var subleftoffset=((document.body.offsetWidth-890)/2)+169;
	if(document.body.offsetWidth<895)
		subleftoffset=169;
	var sublefts=new Array(4);
	sublefts[0]=subleftoffset;
	sublefts[1]=sublefts[0]+117;
	sublefts[2]=sublefts[1]+136;
	sublefts[3]=sublefts[2]+104;
	try{
		hideAllMenu();
		var dv=document.getElementById("sub"+idx);
		dv.style.left=sublefts[li];
		dv.style.top=229;
		dv.style.visibility="visible";
	}
	catch(e){}
}

function hideAllMenu(){
	try{
		var ar=subMnus.split(',');
		for(i=0;i<ar.length;i++){
			var dv=document.getElementById("sub"+ar[i]);
			dv.style.visibility="hidden";
		}
	}
	catch(e){}
}

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 writeTraining(divName){
	var dv=document.getElementById(divName);
	var str='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="385" height="370">';
	str+='<param name="movie" value="training.swf">';
	str+='<param name="quality" value="high">';
	str+='<embed src="training.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="385" height="370"></embed>';
	str+='</object>';
	dv.innerHTML=str;
}

function writeComMapOLD(divName){
	var dv=document.getElementById(divName);
	var str='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" id="map2" width="432" height="589" align="middle">';
	str+='<param name="allowScriptAccess" value="sameDomain" />';
	str+='<param name="movie" value="map.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#b8c0cf" /><embed src="map.swf" quality="high" bgcolor="#b8c0cf" width="432" height="589" swLiveConnect=true id="map2" name="map2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	str+='</object>';
	dv.innerHTML=str;
}

function writeComMap(divName){
	var dv=document.getElementById(divName);
	var str='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" id="map2" width="432" height="589" align="middle">';
	str+='<param name="allowScriptAccess" value="sameDomain" />';
	str+='<param name="movie" value="map.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#b8c0cf" /><embed src="map.swf" quality="high" bgcolor="#b8c0cf" width="432" height="589" swLiveConnect=true id="map2" name="map2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	str+='</object>';
	dv.innerHTML=str;
}

// This function is used to pop up windows
function popUp(c,w,h){
	window.open(c,'','width='+w+',height='+h);
}

// This function kicks the page to value passed
function kickmeto(cbo){
	if(cbo[cbo.selectedIndex].value!=""){
		var target=cbo[cbo.selectedIndex].value;
		var arr=target.split('_');
		if(arr.length>1)
			window.open(arr[0],'','');
		else
			document.location.href=arr[0];
	}
	
	return false;
}

// This function is used to validate email entries
function isValidEmail(thisEmail){
	var emailexp = /.*\@.*\..*/;
	if (!emailexp.test(thisEmail)) {
		return false;
	} 
	return true;
}

// This function checks to see if a selection was made in a checkbox or radio group
function cbxSelectionMade(cbx){
	var isGood=false;
	if(cbx.checked){
		isGood=true;
	}
	for(i=0;i<cbx.length && !isGood;i++){
		if(cbx[i].checked){
			isGood=true;
		}
	}
	return isGood;
}

// This function checks to see if a selection was made in a dropdown box
function cboSelectionMade(cbo){
	var isGood=false;
	
	if(cbo.selectedIndex>0&&cbo.options[cbo.selectedIndex].value!="")
		isGood=true;
		
	return isGood;
}

// This function checks to see if all needed fields are valid for blog emailer
function validateBlogEmail(thisForm){	
	if(thisForm.from.value==""){
		alert("You must provide a name to identify who sent this link!");
		thisForm.from.focus();
		return false;
	}	
	if(thisForm.email.value==""||!isValidEmail(thisForm.email.value)){
		alert("You must provide a valid email address to send this link to!");
		thisForm.email.focus();
		return false;
	}
	
	return true;
}

// This function checks to see if all needed fields are valid for blog comment
function validateBlogComment(thisForm){	
	if(thisForm.cText.value==""){
		alert("You must provide a comment for submission!");
		thisForm.cText.focus();
		return false;
	}
	
	return true;
}

// This function is for validating BlogTitle submissions
function validateBlogTitle(thisForm){
	if(thisForm.bTitle.value==""){
		alert("You must provide a title for the blog!");
		thisForm.bTitle.focus()
		return false
	}
	if(thisForm.bText.value==''){
		alert("You must provide the first post for the blog!");
		return false
	}
	
	return true;
}

var subMnus="";
									
function showMenu(idx,li){
	var subleftoffset=((document.body.offsetWidth-771)/2+3);
	if(document.body.offsetWidth<773)
		subleftoffset=14;
	var sublefts=new Array(5);
	sublefts[0]=subleftoffset;
	sublefts[1]=sublefts[0]+154;
	sublefts[2]=sublefts[1]+101;
	sublefts[3]=sublefts[2]+100;
	sublefts[4]=sublefts[3]+87;
	try{
		hideAllMenu();
		
		var dv=document.getElementById("sub"+idx);
		dv.style.left=sublefts[li];
		dv.style.top=152;
		dv.style.visibility="visible";
	}
	catch(e){}
}

function hideAllMenu(){
	if(document.getElementById("rnavSelProd"))
		document.getElementById("rnavSelProd").style.visibility="visible";
	if(document.getElementById("rnavSelTopic"))
		document.getElementById("rnavSelTopic").style.visibility="visible";
	try{
		var ar=subMnus.split(',');
		for(i=0;i<ar.length;i++){
			var dv=document.getElementById("sub"+ar[i]);
			dv.style.visibility="hidden";
		}
	}
	catch(e){}
}