

function rowlink_hover(tableRow, highLight,orig_bg)
{
	if (highLight)
		{
		tableRow.style.backgroundColor = '#D77';
		}
	else
		{
		tableRow.style.backgroundColor = orig_bg;
		}
  }

function rowlink_nav(theUrl)
{
	document.location.href = theUrl;
}


function popup_iris(ServerIP,WinName)
{
WinProp = "resizable=yes,scrollbars=yes,toolbar=no,menubar=no,"                 
WinSize = "height=600,width=800"                                                
WinOpts = WinProp + WinSize                                                     
WebHostURL = "http://192.168.1.16:8080/WHO0CGI1?REQ=NEW&AIP="                                            
TheURL = WebHostURL + ServerIP                                                  
iriswin=window.open(TheURL,WinName,WinOpts)                                             

//http://192.168.1.16:8080/WHO0CGI1?REQ=NEW&AIP=192.168.1.16:5023
}                                                                               


function popup(winurl,winname,scroll,w,h)
{
if (w && h)
	{
	newwin = window.open(winurl,winname,"toolbar=no,directories=no,status=yes,menubar=no,scrollbars="+scroll+",resizable=yes,width="+w+",height="+h);
	}
	else
	{
	newwin = window.open(winurl,winname,"toolbar=no,directories=no,status=yes,menubar=no,scrollbars="+scroll+",resizable=yes");
	}
}


function pdfpopup(pdfurl)
{
pdfnewwin = window.open("/pdfwindow.asp?pdfurl="+pdfurl,"pdfwin","toolbar=no,directories=no,status=no,menubar=no,scrollbars=false,resizable=yes");
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		//top_contact_on = newImage("images/top_contact_on.gif");
		//top_faq_on = newImage("images/top_faq_on.gif");
		//top_forms_on = newImage("images/top_forms_on.gif");
		preloadFlag = true;
	}
}


function getTheID(theLayerID)
{	
	if(document.getElementById){				
		return document.getElementById(theLayerID); //DOM; IE5, NS6, Mozilla, Opera
	}else if(document.all){
		
		return document.all[theLayerID]; //Proprietary DOM; IE4
	}else if(document[theLayerID]){
		return document[theLayerID]; //Netscape alternative
	}
	//Netscape layers - not currently supporting
	//if( document.layers ){//return document.layers[theLayerID];//}
	return false;
}

function showhidebox(activeBox)
{
	// this function assumes that the id of the popupbox is popupLookupBox# such that # is a number between 1 and infinity, they MUST BE SEQUENTIAL
	var box_cnt = 3 //number of popbox's on the page
	var activeToolBoxRef = getTheID(activeBox);
	var count;
	var thisBox;
	for (count=1;count<=box_cnt;count++)
	{
		if (activeBox != 'popbox' + eval(count))
		{
			thisBox = getTheID('popbox' + eval(count))
			if(thisBox.style)
			{
				thisBox.style.visibility = "hidden";
			}
			else
			{
				thisBox.visibility = "hidden";
			}
		}
	}
	if(!activeToolBoxRef){return;}
	if(activeToolBoxRef.style)
	{
		if(activeToolBoxRef.style.visibility == "visible")
		{
		activeToolBoxRef.style.visibility = "hidden";
		}
		else
		{
		activeToolBoxRef.style.visibility = "visible";
		//activeToolBoxRef.style.height='0px'
		//openthepopbox(activeToolBoxRef);
		}
	}
	else
	{
		if(toolBoxRef.visibility == "visible")
		{
		activeToolBoxRef.visibility = "hidden";
		}
		else
		{
		activeToolBoxRef.visibility = "visible";
		//activeToolBoxRef.height='0px'
		//openthepopbox(activeToolBoxRef);
		}
	}
}


function openthepopbox(activeBox)
{
//alert(parseInt(activeBox.style.height));
activeBox.style.height = parseInt(activeBox.style.height)+1+'px';
if(parseInt(activeBox.style.height)>=85)
	{
	clearTimeout(openthepopbox);
	}
else
	{
	setTimeout('openthepopbox(['+activeBox+'])',500);
	}
}


function show_loading()
{
var loading_id = getTheID("search_result");
loading_id.innerHTML = "<div class='loading'><img src='/images/loading.gif' /><div>";
}

function hide_loading()
{
var loading_id = getTheID("loading");
loading_id.innerHTML = "";
loading_id.style.visibility = "hidden";
}


var prev_option
function show_hide_notoggle(option)
{
var layerID = getTheID(option)
var prev_layerID = getTheID(prev_option)
	if (layerID)
		{
		layerID.style.display=""
		}
	if(prev_layerID)
		{
		if(prev_option!=option)
			{
			prev_layerID.style.display="none"
			}
		}
	prev_option=option
}


/*-----------------------------------------------------
---------------------AJAX------------------------------
-----------------------------------------------------*/

var xmlHttp
function do_search(search_url,search_type,arg)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request.")
	return;
	} 

var url=search_url
url=url+"?search_type="+search_type+"&arg="+arg
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function do_search2(search_url)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request.")
	return;
	} 

var url=search_url
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


var result
function stateChanged() 
{ 
var result_id
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	result = xmlHttp.responseText
	result_id = getTheID("search_result")
	result_id.innerHTML=result
	} 
} 

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
	objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}





//IRIS REPORTS
function report_search(search_url)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request.")
	return;
	} 
var url="iris_report_search.asp?l="+search_url

url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function report_search2(search_url)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request.")
	return;
	} 
var url="iris_report_search2.asp?l="+search_url

url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}


function report_search3(search_url,priorsort,sortby,reverse)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request.")
	return;
	} 
if(reverse=="true"){reverse=true}
if(reverse=="false"){reverse=false}

var url="iris_report_search3.asp?l="+search_url+"&priorsort="+priorsort+"&sortby="+sortby+"&reverse="+reverse

url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

