function loaded(){
	if (getQSParam('pf')==1) self.setTimeout('pagePrint()', 500);
	

}
function getQSParam(name){
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == name) {
return pair[1];
}
} 
}
function openMailer(address){	window.location="mailto:" + address; }
function rmOff(){
if (navigator.appName.indexOf("Microsoft")!=-1) {  
document.oncontextmenu = function(){return false} 
if(document.layers) { 
window.captureEvents(Event.MOUSEDOWN); 
window.onmousedown = function(e){ 
if(e.target==document)return false; 
} 
} 
else { 
document.onmousedown = function(){return false} 
} 
}
}
function pagePrint(){
if ( window.print ){
if (window.event) window.event.cancelBubble = true;
window.focus();
window.print( );
}
else alert("Sorry! Your browser doesn't support this function.");
}
function openPrintWindow(theURL){ 
	var scW = screen.availWidth ? screen.availWidth : screen.width;	
	var scH = screen.availHeight ? screen.availHeight : screen.height;
	winW=Math.round(scW * .8);
	winH=Math.round(scH * .8);	
	var winL=Math.round(scW-winW)/2;
	var winT=Math.round(scH-winH)/2;
	strOptions= 'height=' + winH +  ',width=' + winW + ',left='+winL+',top='+winT;  
	strOptions += "toolbar=no,"; strOptions += "location=no,"; strOptions += "directories=no,"; 
	strOptions += "status=no,"; strOptions += "menubar=yes,"; strOptions += "scrollbars=yes,"; strOptions += "resizable=no"; 
	return (openWindow(theURL,'print',strOptions ));
}
function openImgWindow(imgURL,imgW,imgH,caption,txFlag){
	imgW = imgW;
	imgH = imgH;
	var scW = screen.availWidth ? screen.availWidth : screen.width;
	var scH = screen.availHeight ? screen.availHeight : screen.height;
	scH = scH - 100;
	scW = scW - 20;
	var scrollBars = '';
	var vScrollBarW = 0;
	var hScrollBarH = 0;
	vScale = scH / imgH;
	if ( vScale < 1 ){
		imgH = Math.round(imgH * vScale);
		imgW = Math.round(imgW * vScale);
		scrollBars = 'scrollbars=1,';
		vScrollBarW = 20;
	}
	hScale = scW / imgW  ;
	if ( hScale < 1 ){
		imgH = Math.round(imgH * hScale);
		imgW = Math.round(imgW * hScale);
		scrollBars = 'scrollbars=1,';
		hScrollBarH = 20;		
	}	
 
	winH=Math.round(imgH)+80+ hScrollBarH;
	winW=Math.round(imgW)+40 + vScrollBarW;
	if ( caption && caption.length > 1 ){
		charsPerLine = winH/12;
		lines=caption.length/charsPerLine;
		winH = Math.round(winH + 40  + (10 * lines));
	}
	winH = ( winH > (scH-20) )? scH-20 : winH;
	winW = ( winW > (scW-20) )? scW-20 : winW;
	winL=Math.round(scW-winW)/2;
	winT=Math.round(scH-winH)/2;
	url='about:blank';
	options= 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=yes,' + scrollBars + 'status=no,menubar=yes,resizable=yes,left='+winL+',top='+winT; 
	winName='winImage';
	// Open the window
	if (!window.winImage){  
		try{ winImage = window.open(url,winName,options);}
		catch(e){return(false);}; //window.alert("Popup window blocked " + e.number);}
	} else { // has been defined
		if (!winImage.closed){  
			try{ winImage.close(); winImage = window.open(url,winName,options);}
			catch(e){return(false);}; //window.alert("Popup window blocked " + e.number);}
		} else {
			try{ winImage = window.open(url,winName,options);}
			catch(e){window.alert("Popup window blocked " + e.number); }
		}
	}
	if (winImage){
		winImage.focus();
		if(caption){
			arrayTemp = caption.split('|');
			caption = arrayTemp[0];
			text = arrayTemp[1];
		}
		/* BODGE ALERT!! this assumes that the relative part of the path leads to the site's root!! */
		pos = imgURL.lastIndexOf('../');
		relRoot=imgURL.substring(0, pos+3);
		html='<html><head>\n';
		html+='<link rel="stylesheet"  href="' + relRoot + 'style/popup.css" type="text/css">\n';
		html+='<title>Image Viewer<\/title><\/head>\n';
		html+='<body>\n';
		if (caption) html+='<p class="pTitle" align="center">'+caption+'<\/p>\n';
		if (txFlag=='1'){	// Transparent overlay
			html += '<center><div  style="width:' + imgW + 'px; height:' + imgH + 'px; ';
			html += 'background-image:url(' + imgURL + ');background-repeat: no-repeat;">';
			txPath= '../../style/images/transparent.gif';
			html += '<img src="'+txPath+'" width="'+imgW+'" height="'+imgH+'" border="0" alt="'+caption+'"\/>';
			html += '</div></center>';
		}
		else {
			html+='<center><img src="'+imgURL+'" width="'+imgW+'" height="'+imgH+'" border="0" alt="'+caption+'"\/></center>\n';
			//html+='<center><img src="'+imgURL+'" border="0" alt="'+caption+'"\/></center>\n';
		}
		try{ if(text) html+='<p class="pText" align="center">'+text+'<\/p>\n';}
		catch(e){};
		html+='<center><a href="javascript:window.close();" >Close Window</center></a>';
		html+='<\/body><\/html>\n';
		winImage.document.write(html);
		winImage.document.close();
		winImage.focus();
		return (false);	
	}
	else return (true);
}
function openPopup(url, winName){
var scW = screen.availWidth ? screen.availWidth : screen.width;
var scH = screen.availHeight ? screen.availHeight : screen.height;
var winW=800;
var winH=600;	
var winL=Math.round(scW-winW)/2;
var winT=Math.round(scH-winH)/2;
strOptions = 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=no,status=no,' + 'menubar=yes,scrollbars=yes,resizable=no,left='+winL+',top='+winT; 
if (!winName) winName='winInfo';
return (openWindow(url,winName,strOptions));
}
function openDownload(url ){
var scW = screen.availWidth ? screen.availWidth : screen.width;
var scH = screen.availHeight ? screen.availHeight : screen.height;
var winW=640;
var winH=480;	
var winL=Math.round(scW-winW)/2;
var winT=Math.round(scH-winH)/2;
strOptions = 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=no,status=no,' + 'menubar=no,scrollbars=yes,resizable=no,left='+winL+',top='+winT; 
winName='winDownload';
return (openWindow(url,winName,strOptions));
}
function openFlash(url){
var scW = screen.availWidth ? screen.availWidth : screen.width;
var scH = screen.availHeight ? screen.availHeight : screen.height;
var winW=scW*.8;
var winH=scH*.8;	
var winL=Math.round(scW-winW)/2;
var winT=Math.round(scH-winH)/2;
strOptions = 'height=' + winH +  ',width=' + winW + ',toolbar=no,directories=no,status=no,' + 'menubar=yes,scrollbars=yes,resizable=no,left='+winL+',top='+winT; 

	return(openWindow(url,'flash',strOptions, winW, winH) );
}
function openWindow(url, winName, strOptions, winW, winH){
var winName='winPop';
 
var scW = screen.availWidth ? screen.availWidth : screen.width;	
var scH = screen.availHeight ? screen.availHeight : screen.height;
if (! winW ) winW=Math.round(scW * .9);
if (! winH) winH=Math.round(scH * .9);	
var winL=Math.round(scW-winW)/2;
var winT=Math.round(scH-winH)/2;
if (! strOptions) strOptions= 'height=' + winH +  ',width=' + winW + ',location=yes,toolbar=yes,directories=yes,status=yes,' + 'menubar=yes,scrollbars=yes,resizable=yes,left='+winL+',top='+winT;  
if (!window.winName){  
 
try{ winName =  window.open(url,winName,strOptions);}
catch(e){return(false);};//window.alert("Popup window blocked " + e.number);}
} else { 
if (!winName.closed){  
try{ winName.close(); winName = window.open(url,winName,strOptions);}
catch(e){return(false);};//window.alert("Popup window blocked " + e.number);}
} else {
try{ winName = window.open(url,winName,strOptions);}
catch(e){return(false);};//window.alert("Popup window blocked " + e.number); }
}
}
if (winName ) winName.focus();
return (false);
}


function Banner_start(){
if (is_win && (is_ie5up || is_gecko || is_opera5up )) {	
elTest = xbGetElement(window,this.textID)
if ( this.firstCall == 1 ) this.firstCall = 0;   
else if ( elTest != null  ){
xbSetInnerHTML(window,this.titleID,this.titles[this.banIndex]);
xbSetInnerHTML(window,this.textID,this.text[this.banIndex]);
this.banIndex++;
if ( this.banIndex >= this.text.length ) this.banIndex = 0;
}
// Set callback
var pThis = this;
var f = function(){pThis.start();}
this.timerID = window.setTimeout(f, this.banDuration * 1000);		
}
}
function Banner() {
this.banIndex = 1;
this.titleID='bannerTitle';
this.textID='bannerText';
this.titles = new Array();
this.text = new Array();	
this.banCount=0;
this.banDuration=5;
this.firstCall=1;
this.start = Banner_start;
} 
function xbGetElement(win,strID){
if (document.layers) return (xbGetNS4Element(win, strID))
if (document.getElementById) return(win.document.getElementById(strID));
else if (document.all) return( win.document.all[strID]);
}
function xbSetInnerHTML(win,strID,strHTML){
var el = xbGetElement( win, strID )
if ( el && ! win.document.layers ){
if (win.document.getElementById)  el.innerHTML = strHTML;
else if (win.document.all)  el.innerHTML  = strHTML;
}
}
function xbElHide(el){
if (document.getElementById || document.all) el.style.visibility = 'hidden';
else if (document.layers)  el.visibility = 'hidden';
}
function xbElShow(el){
if (document.getElementById || document.all) {
el.style.visibility = 'visible';
el.style.display = 'block';
}
else if (document.layers)  el.visibility = 'visible';
}
function xbSetElClass(el,strClass){
if (el != null){
if (document.layers ) ; //unsupported in document.layers.X
else if (document.getElementById) el.className = strClass;
else if (document.all ) el.className = strClass;
}
}
function setFormFocus(){
var frm = document.forms[0];		
var done = false;
	if (document.forms.length == 0) return;
 	for (f = 0; f < frm.elements.length; f++){
 		if (! done){
		 	if ( frm.elements[f].type.substr(0,5) != "selec" && frm.elements[f].type != "hidden" && frm.elements[f].type != "reset" && frm.elements[f].type != "submit" && ! frm.elements[f].disabled && ! frm.elements[f].readOnly){
				frm.elements[f].focus();
	 			done = true;
	  		 }
 		}
 	} 	
}


vdsTimer=null;
vdsTop=0;
 
var agt=navigator.userAgent.toLowerCase();
// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_gecko = (agt.indexOf('gecko') != -1);
var is_moz = (agt.indexOf('mozilla') != -1);
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav6up = (is_nav && (is_major >= 5));
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_opera = (agt.indexOf("opera") != -1);
var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);
var is_win = (agt.indexOf("win")!=-1);
var is_mac = (agt.indexOf("mac")!=-1);  
window.onload=loaded;
