//Browser detection
function BrowserCheck()
{
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.v = parseInt(navigator.appVersion)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns6 = (this.b=="ns" && this.v>=6)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	if (this.ie5) this.v = 5
	this.ie6 = (navigator.userAgent.indexOf('MSIE 6')>0)
	if (this.ie6) this.v = 6	
	this.min = (this.ns||this.ie)
}
// automatically create a nav object
nav = new BrowserCheck();

//MENU PATH MANAGEMENT
function getPath(state)
{
    if(current_section == state && false)
    {
        path="";
    }else
    {
        path="../"+dir[state]+"/";
    }
    return path;
}

//PRINT FUNCTION
function printit()
{  
/*
	if (window.print)
	{
		window.print() ;  
	} else
	{
		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
		WebBrowser1.ExecWB(6, 2);
	}
*/	
	//alert("Please wait, the print windows is coming");
/*	
  var disp_setting="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
  var content_vlue = document.getElementById("print_content").innerHTML; 
  alert("printit");
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>IN-Services</title>'); 
   docprint.document.write('</head><body onLoad="self.print()"><center>');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</center></body></html>'); 
   docprint.document.close(); 
   docprint.focus();
*/
     var NewWindow = null;
     var NewWindow_content=document.getElementById('print_content').innerHTML;
     var NewWindow_title=document.getElementsByTagName('title')[0].innerText;
     if (NewWindow) {if(!NewWindow.closed) NewWindow.close();}
     NewWindow = window.open ('',"NewWindow", "height=500,width=600,menubar=yes,scrollbars=yes,resizable=yes,,left=10,top=10"); ;
     NewWindow.document.open();
     NewWindow.document.write("<html><head><title>" + NewWindow_title + "</title></head>");
     NewWindow.document.write('<style type="text/css">');
     NewWindow.document.write('@import url("/ezpublish/design/plain/stylesheets/style.css");');
     NewWindow.document.write('@import url("/ezpublish/design/plain/stylesheets/styles_supp.css");');
     NewWindow.document.write('@import url("/ezpublish/design/plain/stylesheets/anylink.css");');
     NewWindow.document.write('</style>');
     NewWindow.document.write("<body onLoad='self.print()' bgcolor='#ffffff'>");
	 NewWindow.document.write ("<div align='right' id='PSR_print'>");
	 NewWindow.document.write ("<input onclick='window.print();' type='button' value='Print'>");
	 NewWindow.document.write ("&nbsp;<input onclick='window.close();' type='button' value='Close'></div>");
	 NewWindow.document.write ("</div>");
     NewWindow.document.write(NewWindow_content+"</body></html>");
     NewWindow.document.close();
     NewWindow.document.getElementById('print_content').style.visibility='hidden';
     //NewWindow.focus();   
}
 
//Popup functions
function winpopup(url)
{
	popup=window.open(url,'Window_popup','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=780,height=580,left=5,top=5');
	popup.focus();
}


//Popup functions
function winmcosearch(url)
{
	popup=window.open(url,'Window_mco','scrollbars=no,toolbar=no,status=no,resizable=yes,width=450,height=250,left=5,top=5');
	popup.focus();
}

//Popup functions
function winordersearch(url)
{
	popup=window.open(url,'Window_order','scrollbars=no,toolbar=no,status=no,resizable=yes,width=450,height=250,left=5,top=5');
	popup.focus();
}

//Popup functions
function wincustomersearch(url)
{
	popup=window.open(url,'Window_customer','scrollbars=no,toolbar=no,status=no,resizable=yes,width=450,height=335,left=5,top=5');
	popup.focus();
}

//Popup functions
function winprint(url)
{
	popup=window.open(url,'Window_print','scrollbars=yes,resizable=yes,width=980,height=780,left=5,top=5');
	popup.focus();
}


//Popup functions
function wincustomer(url)
{
	popup=window.open(url,'Window','scrollbars=yes,resizable=yes,width=450,height=300,left=5,top=5,status=no');
	popup.focus();
}

//Popup functions
function openMap(num)
{
	popup=window.open('../about/map.php?num='+num,'Window','scrollbars=yes,resizable=yes,width=280,height=300,left=10,top=10,status=no');
	popup.focus();
}



//Print properties
function explore(obj)
{
	var tmp="";
    for(j in obj)
    {
        //if(obj[j]=="[object]")
		if(false)
        {
            tmp += "\n";
            explore(j);
        }else
        {
            tmp += j + "=" + obj[j]+ "\t";
        }
    }
	alert(tmp);
}


function changelink(id,on)
{
	if (nav.ns4)
	{
	obj = document.layers[id];
	}else if (nav.ie4)
	{
	   obj = document.all[id];
	}else if (nav.ie5)
	{
	   obj = document.getElementById(id);
	}else if (nav.ie6)
	{
	   obj = document.all(id);
	}

	if(on==true && nav.ie)
	{
		obj.style.color='#F8EA00';
	}else if(nav.ie)
	{
		obj.style.color='#1C60AB';
	}
}


function listMouse(obj,on)
{
	if (nav.ie)
	{			
		if(on==true)
		{
			obj.style.backgroundColor='#1C60AB';obj.style.color='#FFFFFF';
		}else
		{
			obj.style.backgroundColor='';obj.style.color='';
		}
	}	
}


function goUp()
{
	var t=window.document.title;
	window.document.location='#top';
	window.document.title=t;
}

function goTo(url) {
	window.location=url;
}