var regwin = null;
var wizwin = null;
var trakwin = null;
var srchwin = null;
var fntrwin = null;
var picwin = null;

function killRegWin(){
	if (regwin) regwin.close;
}

function buildRegWin(url, features){
	if (regwin==null){	
		regwin = window.open(url, "_blank", features);	
	}
	else if (regwin && regwin.closed){	
		regwin = window.open(url, "_blank", features);	
	}
	else if (regwin && regwin.open){ 
		regwin.focus();
	}
}

function buildWizWin(url, features){
	if (wizwin==null){	
		wizwin = window.open(url, "_blank", features);	
	}
	else if (wizwin && wizwin.closed){	
		wizwin = window.open(url, "_blank", features);	
	}
	else if (wizwin && wizwin.open){ 
		wizwin.focus();
	}
}

function buildTrakWin(url, features){
	if (trakwin ==null){	
		trakwin  = window.open(url, "_blank", features);	
	}
	else if (trakwin && trakwin.closed){	
		trakwin = window.open(url, "_blank", features);	
	}
	else if (trakwin && trakwin.open){ 
		trakwin.focus();
	}
}

function buildSrchWin(url, features){
	if (srchwin==null){	
		srchwin = window.open(url, "_blank", features);	
	}
	else if (srchwin && srchwin.closed){	
		srchwin = window.open(url, "_blank", features);	
	}
	else if (srchwin && srchwin.open){ 
		srchwin.focus();
	}
}

function frontierWin(url, features){
	if (fntrwin==null){	
		fntrwin = window.open(url, "_blank", features);	
	}
	else if (fntrwin  && fntrwin .closed){	
		fntrwin = window.open(url, "_blank", features);	
	}
	else if (fntrwin  && fntrwin .open){ 
		fntrwin.focus();
	}
}

function openPictureWin(imageName,imageWidth,imageHeight,alt,posLeft,posTop){
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",resizable=1");
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="window.close()">'); 
	newWindow.document.write('<div align=center><img src='+imageName+' alt='+alt+'>'); 
	newWindow.document.write('<br><a href="javascript:window.close()">close</a><br></div></body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function toggleLayer(whichLayer) {
	if (document.getElementById) {  // this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	style2.display = style2.display? "":"block";
	}
	else if (document.all) { // this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	style2.display = style2.display? "":"block";
	}
	else if (document.layers){ // this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = style2.display? "":"block";
	}
}

function blockLayer(whichLayer) {
	if (document.getElementById) {  // this is the way the standards work
	document.getElementById(whichLayer).style.display = "";
	}
	else if (document.all) {  // this is the way old msie versions work
	document.all[whichLayer].style.display = "";
	}
	else if (document.layers){  // this is the way nn4 works
	document.layers[whichLayer].style.display = "";	
	}
}

function modelesswin(url,mwidth,mheight){
	if (document.all&&window.print) //if ie5
		eval('window.showModelessDialog(url,"","help:0;resizable:1;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px")')
	else
		eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=1,scrollbars=1")')
}

