var w2=null;  // for screen saver closeit call.
var w1 = null; 
function closeit()
    { w2.close(); }

    
function openWin( src, w, h, pageLink )  
{
	if( screen.width < 810 ) {
		if(h>500) h=500;
	}
	if(w1)w1.close(); 
	var aW = w+25;
	
	if(pageLink){ 
	if( src.indexOf('http://') < 0 ) {
		src = 'http://' + src;
	}}
	
	w1 = window.open( src, 'temp1', 'width='+w+', height=' +h+ ', left='+(screen.availWidth-aW)+', top=30, scrollbars=yes, status=no, resizable=yes');
}
	
function changeNodesToBlack( obj ) {
	var c = obj.childNodes;
	for( var j=0; j < c.length; j++ ) {
		if( c[j].style ) { c[j].style.color = 'black'; } 
		changeNodesToBlack( c[j] ); 
	}
	
	
}

function removeObjects( ){ 
	
	    
		var linkNodes = document.links;
		
		
		for( var k=(linkNodes.length-1); k >=0; k-- ) { 
			
			if( linkNodes[k].name == 'removeFromPrint' ) {
				linkNodes[k].parentNode.removeChild( linkNodes[k] ); 
			}
		} 
	
		imgNodes = document.images;
		
		for( var k=(imgNodes.length-1); k>=0; k-- ) { 
			
				imgNodes[k].parentNode.removeChild( imgNodes[k] ); 
		} 
}

function deleteNonPrintables(o){
	
	removeObjects();
	changeNodesToBlack(o); 
}
function showHtmlInPopup(w, h, xtitle, id, q4 ) {

//alert( 'id='+id+'  q4='+q4 ); 

	if(w1)w1.close(); 
	var aW = w+25;
	if( q4== '' ){   
		w1 = window.open('eventShowPrint.cfm?id=' + id + '&xtitle=' + xtitle, 'temp1', 'width='+w+', height=' +h+ ', left='+(screen.availWidth-aW)+', top=30, scrollbars=yes, status=no, resizable=yes');
	} else  {     alert(q4);    
		w1 = window.open('eventShowPrint.cfm?q4=' + q4 + '&xtitle=' + xtitle, 'temp1', 'width='+w+', height=' +h+ ', left='+(screen.availWidth-aW)+', top=30, scrollbars=yes, status=no, resizable=yes');
	}
}

function returnUrlLink( link ){
	if( !link ){ var link = document.getElementById("urlLink").value; }

	if( link.indexOf('http://') < 0 ) {
		link = 'http://' + link;
	}
	return link; 
}

function setPrint( id, xtitle, xaction ) {
	
	document.forms[0].idPrint.value = id; 
	document.forms[0].titlePrint.value = xtitle; 
	document.forms[0].target = '_blank'; 
	document.forms[0].action = xaction; 
	document.forms[0].submit(); 
} 
function doSearch( xaction ){ 
	document.forms[0].idPrint.value = ''; 
	document.forms[0].titlePrint.value = ''; 
	document.forms[0].target = ''; 
	document.forms[0].action = xaction ; 
	document.forms[0].submit(); 
}
