function openDemo(productID)
{
	thewindow = window.open("http://www.newstandardinstitute.com/demo/index.cfm?ID=" + productID,
	"anew", config="height=600,width=800,toolbar=no,menubar=no," +
	"scrollbars=no,resizable=yes,location=no,directories=no,status=no");
}

function add_to_onload( func ) {
    var old_onload = window.onload;
    window.onload = function() {
        if ( typeof old_onload == 'function' ) {
        	old_onload();
        }
        func();
    }
}

function RightslinkPopUp(title, date, author, contentID)
	{	
		var url = "https://s100.copyright.com/servlet/DispatchServlet"; 
		var location = url 
			+ "?PublisherName=" + escape("Putman Media, Inc.")
			+ "&Publication=" + escape("Plant Services")
			+ "&Title=" + escape(title)
			+ "&PublicationDate=" + escape(date)
			+ "&Author=" + escape(author)
			+ "&Install=S"
			+ "&ContentID=" + escape(contentID);
		PopUp = window.open( location,  'Rightslink', 
			'location=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=650,height=550');
	}

function OpenBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

var displayed;
displayed = '';
function toggle(divid){
	if(displayed != '') {
	  document.getElementById(displayed).style.display = 'none';
	}	
	if(displayed != divid){
		if(document.getElementById(divid).style.display == 'none'){
			document.getElementById(divid).style.display = 'block';
		}else{
			document.getElementById(divid).style.display = 'none';
		}
	}	
	displayed = divid;
}

function HideRevealContent(tid) {

    var myelement = document.getElementById("c"+tid);

    if(myelement!=null) {
      if(myelement.style.display == "none") {
        myelement.style.display = "";
        document.getElementById("b"+tid).style.display = "none";
      }
      else {
        myelement.style.display = "none";
        document.getElementById("b"+tid).style.display = "";
      }
    }
}


// Top tabnav fix for IE6
var lastnavtab = "navtab2";
var ie6 = "";
function tabNavToggle(divid,disp,hover) {	
	// check to see if ie6 is being used
	var appVer = navigator.appVersion;
	appVer = appVer.split(';');
	if(appVer[1] == ' MSIE 6.0') {
		var ie6 = "yes";
	}	
	if (ie6 == "yes") {		
		if (disp != '') {		
			document.getElementById(lastnavtab+"a").style.backgroundPosition = "top right";
			document.getElementById(lastnavtab+"li").style.backgroundPosition = "top left";		
			if (divid != lastnavtab) {
				document.getElementById(lastnavtab).style.display = "none";
				lastnavtab = divid;
			}		
			if (disp == "block") {
				document.getElementById(divid+"a").style.backgroundPosition = "100% -42px";
				document.getElementById(divid+"li").style.backgroundPosition = "0% -42px";		
				document.getElementById(divid).style.display = disp;
			} else {
				document.getElementById(divid).style.display = disp;
			}
		}
		// if disp param is empty, there's no dropdown
		// for that li, so just change bg hover states.
		if (disp == '') {
			switch (hover) {
				case "on":
					document.getElementById(divid+"a").style.backgroundPosition = "100% -42px";
					document.getElementById(divid+"li").style.backgroundPosition = "0% -42px";
					break;
				case "off":
					document.getElementById(divid+"a").style.backgroundPosition = "top right";
					document.getElementById(divid+"li").style.backgroundPosition = "top left";
					break;
				default:
					return false;
			}		
		}		
	}	
}


// Content boxes
//var lastvoicetab = 'voices1';
var lastcommunitytab = 'community1';
var lastmmediatab = 'mmedia1';
var lastrecenttab = 'recent1';
var lastviewedtab = 'viewed1';
var lastproductstab = 'products1';
var lasttopicstab = 'topics1';
var lastsubstab = 'subs1';
var lastsktvtab = 'sktv1'
function toggleContent(box,idnum) {	
	var divid = box+idnum;
	switch (box){
  //voices content box
  //	case "voices":
  //		if (divid != lastvoicetab) {
  //			document.getElementById(lastvoicetab+"a").className = "";
  //			document.getElementById(lastvoicetab).style.display = "none";
  //			document.getElementById(divid+"a").className = "on";
  //			document.getElementById(divid).style.display = "block";
  //			lastvoicetab = divid;
  //		}
  //		break;
  //community content box
	case "community":
		if (divid != lastcommunitytab) {
			document.getElementById(lastcommunitytab+"a").className = "";
			document.getElementById(lastcommunitytab).style.display = "none";
			document.getElementById(divid+"a").className = "on";
			document.getElementById(divid).style.display = "block";
			lastcommunitytab = divid;
		}
		break;
  //multimedia content box
	case "mmedia":
		if (divid != lastmmediatab) {
			document.getElementById(lastmmediatab+"a").className = "";
			document.getElementById(lastmmediatab).style.display = "none";
			document.getElementById(divid+"a").className = "on";
			document.getElementById(divid).style.display = "block";
			lastmmediatab = divid;
		}
		break;
  //topics content box
	case "topics":
		if (divid != lasttopicstab) {
			document.getElementById(lasttopicstab+"a").className = "";
			document.getElementById(lasttopicstab).style.display = "none";
			document.getElementById(divid+"a").className = "on";
			document.getElementById(divid).style.display = "block";
			lasttopicstab = divid;
		}
		break;
  //subscriptions content box
	case "subs":
		if (divid != lastsubstab) {
			document.getElementById(lastsubstab+"a").className = "";
			document.getElementById(lastsubstab).style.display = "none";
			document.getElementById(divid+"a").className = "on";
			document.getElementById(divid).style.display = "block";
			lastsubstab= divid;
		}
		break;
  //most recent content list
	case "recent":
		if (divid != lastrecenttab) {
			document.getElementById(lastrecenttab+"a").className = "";
			document.getElementById(lastrecenttab).style.display = "none";
			document.getElementById(divid+"a").className = "on";
			document.getElementById(divid).style.display = "block";
			lastrecenttab = divid;
		}
		break;
  //most viewed content list
	case "viewed":
		if (divid != lastviewedtab) {
			document.getElementById(lastviewedtab+"a").className = "";
			document.getElementById(lastviewedtab).style.display = "none";
			document.getElementById(divid+"a").className = "on";
			document.getElementById(divid).style.display = "block";
			lastviewedtab = divid;
		}
		break;
  //products content list
	case "products":
		if (divid != lastproductstab) {
			document.getElementById(lastproductstab+"a").className = "";
			document.getElementById(lastproductstab).style.display = "none";
			document.getElementById(divid+"a").className = "on";
			document.getElementById(divid).style.display = "block";
			lastproductstab = divid;
		}
		break;
  //SkillTV nav
	case "sktv":
		if (divid != lastsktvtab) {
			document.getElementById(lastsktvtab+"a").className = "";
			document.getElementById(lastsktvtab).style.display = "none";
			document.getElementById(divid+"a").className = "on";
			document.getElementById(divid).style.display = "block";
			lastsktvtab = divid;
		}
		break;
	default:
		return false;
	}
}


// For jump menu selects within content boxes
lastblogtab = 'blog1';
lastvoicestab = 'voices1';
function rboxmidSelect(prefix,targ,selObj,restore){ //v3.0
	var selected = selObj.selectedIndex+1;
	var divid = prefix+selected;	
	switch (prefix){
  //blog select
	case "blog":
		document.getElementById(lastblogtab).style.display = "none";
		document.getElementById(divid).style.display = "block";
		lastblogtab = divid;
		break;
  //voices select
	case "voices":
		document.getElementById(lastvoicestab).style.display = "none";
		document.getElementById(divid).style.display = "block";
		lastvoicestab = divid;
		break;
	default:
		return false;
	}
}


/* Deal with IE problems on hover for left nav*/


startList = function() {

	startListLeft();
	startListTop();
}

startListLeft = function() {

if (document.all&&document.getElementById) {
navRoot = document.getElementById("leftnav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

/* Deal with IE problems on hover for top nav*/
startListTop = function() {

if (document.all&&document.getElementById) {
navRoot = document.getElementById("topnav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}

// set up axel and ord for DART
var axel = Math.random() + "";
var ord = Math.floor(axel * 100000000000000);

var lastkctab = 'kctab1';
function toggletabs(kind,num) {
	var divid = kind+num;
	if (divid != 'lastkctab') {
		document.getElementById(lastkctab+"a").className = "";
		document.getElementById(lastkctab+"li").className = "";
		document.getElementById(lastkctab).style.display = "none";		
		document.getElementById(divid+"a").className = "current";
		document.getElementById(divid+"li").className = "active";
		document.getElementById(divid).style.display = "block";
		lastkctab = divid;		
	}		
}

function popup(url, title, width, height){
	window.open(url,title,"toolbar=0,location=0,statusbar=0,menubar=0,resizable=1,width="+width+",height="+height+",scrollbars=yes");
}
