document._target = "_self";

var NS = (navigator.appName.indexOf('Netscape') == 0 ? true : false);
var row = (navigator.appName.indexOf('Netscape') == 0 ? 'table-row' : 'block');

function _check(){
	
	var form = document._apache;
	
	if (form.words.value == ""){

		return false;
		
	}else{
		
		form.action = '/cgi-bin/htsearch';
		form.submit();
		
	}
	

}

function _askAnExpert(){
	
	var form = document._expert;
	
	form.action = 'http://SEMCO-MS.semcoinc.com/SMARTMail.nsf/AskAnExpert?OpenForm&seq=1';
	
	form.submit();
	
	return false; 
	
}

function _doClick(v, o, t, h) {

	var form = document._apache;
	
  	if (form.onsubmit) {
  
		var retVal = form.onsubmit();
  
     	if (typeof retVal == "boolean" && retVal == false) return false;
  
  	}
  
  	var target = document._target;
 
  
  	if (o.href != null) {
  
    	if (o.target != null) target = o.target;
  
  	}else{
  
    	if (t != null) target = t;
  
  	}

  	form.target = target;
  	form.__Click.value = v;
  
  	if ((h != null)&&(v=="$Redirect")) {
		
		form.action = h;
		form.submit();
		
		return false;
		
	}
  
  	if (h != null) form.action += h;
  
  	form.submit();
  
  	return false;
}

// Begin Netscape Whitespace Fix

function is_all_ws( nod )
{
  // Use ECMA-262 Edition 3 String and RegExp features
  return !(/[^\t\n\r ]/.test(nod.data));
}

function is_ignorable( nod )
{
  return ( nod.nodeType == 8) || // A comment node
         ( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}

function node_before( sib )
{
  while ((sib = sib.previousSibling)) {
    if (!is_ignorable(sib)) return sib;
  }
  return null;
}

function node_after( sib )
{
  while ((sib = sib.nextSibling)) {
    if (!is_ignorable(sib)) return sib;
  }
  return null;
}

function last_child( par )
{
  var res=par.lastChild;
  while (res) {
    if (!is_ignorable(res)) return res;
    res = res.previousSibling;
  }
  return null;
}

function first_child( par )
{
  var res=par.firstChild;
  while (res) {
    if (!is_ignorable(res)) return res;
    res = res.nextSibling;
  }
  return null;
}

function data_of( txt )
{
  var data = txt.data;
  // Use ECMA-262 Edition 3 String and RegExp features
  data = data.replace(/[\t\n\r ]+/g, " ");
  if (data.charAt(0) == " ")
    data = data.substring(1, data.length);
  if (data.charAt(data.length - 1) == " ")
    data = data.substring(0, data.length - 1);
  return data;
}

// End Netscape Whitespace Fix

// Ask and Expert

var tbodyElem;
var node;
var timerID = null;
var delay = 1;

function initMe(){
	
	tbodyElem = document.getElementById("dyna_table");
	node = first_child(tbodyElem);
	
	expandMe();

}

function expandMe(){
	
		if (node){
			
			node.style.display = row;
			node = node_after(node);
		
			timerID = window.setTimeout("expandMe()", 1);
		
		}else{
			
			clearTimeout(timerID);
			timerID = window.setTimeout("waitForMe()", 5000);

		}

}

function stallMe(){

	clearTimeout(timerID);
	
}

function go(){
	
	timerID = window.setTimeout("waitForMe()", 1000);
	
}

function waitForMe(){

	node = last_child(tbodyElem);
	timerID = window.setTimeout("collapseMe()", 1);
	
}

function collapseMe(){
	
	if (node){
			
		node.style.display = 'none';
		node = node_before(node);
		
		timerID = window.setTimeout("collapseMe()", 1);
		
	}else{
			
		clearTimeout(timerID);

	}

}

var rs = null;

function closeWindow(){

	window.close()

}

function sampleRequest(){
	
	if(rs && rs.open){
		rs.close()
	}
	
	strURL="http://semco-ms.semcoinc.com/SMARTMail.nsf/Avron_Sample?OpenForm"
	rs = window.open(strURL,"login","height=700,width=390,resizable=no")
	
	
}

function openDemo(){

	if(rs && rs.open){
		rs.close()
	}

	strURL="/products/gallery/FVFlow.html"
	rs = window.open(strURL,"FVDemo","height=460,width=620, resizable=no, scrollbars=yes")

}

function openFeedback(){
	
	if(rs && rs.open){
		rs.close()
	}
	
	strURL="http://semco-ms.semcoinc.com/SMARTMail.nsf/SEMCO_Feedback?OpenForm"
	rs = window.open(strURL,"login","height=600,width=400,resizable=no")
}

function openComparison(){

	if(rs && rs.open){
		rs.close();
	}
	
	strURL="/products/energyrecovery/comparison/index.html";
	rs = window.open(strURL,"login","height=550,width=725,scrollbars=no");

}


function openLegal(){

	if(rs && rs.open){
		rs.close();
	}
	
	strURL="/legal.htm"
	rs = window.open(strURL,"login","height=525,width=490,scrollbars=yes");

}

function openImageViewer( x ){

	if(rs && rs.open){
		rs.close();
	}
	
	strURL="/products/gallery/stage.php?startProdID=" + x;
	
	rs = window.open(strURL,"login","height=355,width=535,scrollbars=no");

}

function openWindow(){

	if(rs && rs.open){
		rs.close();
	}

	strURL="/products/dap/duct/ductchallenge/index.html"
	rs = window.open(strURL,"login","height=593,width=720,scrollbars=no");

}

function openRevolution(){

	if(rs && rs.open){
		rs.close();
	}
	
	strURL="http://www.semcorevolution.com";
	rs = window.open(strURL,"login","");


}

function openAvron(){

	if(rs && rs.open){
	rs.close()
	}
	
	strURL="http://www.avron46.com";
	rs = window.open(strURL,"login","");

}

var selected = null;

function fnGetUnit(a)
{
   selected = a;
   var aInput=document.getElementsByName("unit");   
   for(x = 0; x < aInput.length; x++)
   {
   		aInput[x].checked = false;
   }
   a.checked = true;
}

function fnGetProduct(a)
{
   selected = a;
   var aInput=document.getElementsByName("product");
   for(x = 0; x < aInput.length; x++)
   {
   		aInput[x].checked = false;
   }
   a.checked = true;
}

function fnGetType(a)
{
   selected = a;
   var aInput=document.getElementsByName("type");
   for(x = 0; x < aInput.length; x++)
   {
   		aInput[x].checked = false;
   
   }
   a.checked = true;
}

function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((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 deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function register(doc){
	
	var myFrame;
	
	setCookie("cookieisEnabled", "1");
	var cookieIsEnabled = getCookie("cookieisEnabled");

	if(NS)
	{
		myFrame = window.frames[0];
	}
	else
	{
		myFrame = document.frames[0];
	}

	if (!cookieIsEnabled)
	{
		return false;
	}
	
	if (!navigator.cookieEnabled)
	{
		return false;
	}
	
	var UserID = getCookie("UserID");

	if(!UserID)
	{
		myFrame.location.href = "http://semco-ms.semcoinc.com/News.nsf/SetAnonymous?OpenAgent&docid=" + doc;
	}
	else
	{
		myFrame.location.href = "http://semco-ms.semcoinc.com/News.nsf/RegisterDownload?OpenAgent&docid=" + doc + "&userid=" + UserID;
	}
	
}

function updateDoc( doc, userid ){
	
	var myFrame;
	
	setCookie("cookieisEnabled", "1");
	var cookieIsEnabled = getCookie("cookieisEnabled");

	if(NS)
	{
		myFrame = window.frames[0];
	}
	else
	{
		myFrame = document.frames[0];
	}

	if (!cookieIsEnabled)
	{
		return false;
	}
	
	if (!navigator.cookieEnabled)
	{
		return false;
	}
	
	var UserID = getCookie("UserID");

	if(!UserID)
	{
		//Nothing should happen.
	}
	else
	{
		myFrame.location.href = "http://semco-ms.semcoinc.com/News.nsf/UpdateDownload3?OpenAgent&docid=" + doc + "&userid=" + UserID + "&curr=" + location.href;
	}

}

