var jsFile = true;
var childWin = null;

function popupWin(htmlurl, name, w,h, popupfeatures, replace) {
	var winsizew = w;
        var winsizeh = h;	
        if(navigator.appVersion.indexOf("3.0") == -1){
	        var top = (screen.height / 2) - (winsizeh / 2);
        	var left = (screen.width / 2) - (winsizew / 2);
		features = "width="+ w +",height="+h +",left=" +left+ ",top="+ top +","+ popupfeatures ;
        }
	else {
		features =  "width="+ w +", height="+h +","+ popupfeatures;
	};
	newWindow = window.open(htmlurl,name, features, replace);
	window.setTimeout("newWindow.focus()", 1000);
}

function popupDownloadWin(htmlurl, name, w,h) {
	var popupfeatures="scrollbars=no,resizable=no,"
	var winsizew = w;
        var winsizeh = h;	
        if(navigator.appVersion.indexOf("3.0") == -1){
	        var top = (screen.height / 2) - (winsizeh / 2);
        	var left = (screen.width / 2) - (winsizew / 2);
		features = "width="+ w +",height="+h +",left=" +left+ ",top="+ top +","+ popupfeatures ;
        }
	else {
		features =  "width="+ w +", height="+h +","+ popupfeatures;
	};	
	
	newWindow = window.open(htmlurl, name, features, true);
	return newWindow;	
	//window.setTimeout("newWindow.focus()", 1000);
}

function downloadFile(htmlurl){	
	var str = htmlurl.substring(htmlurl.lastIndexOf("/")+1, htmlurl.length);	
	thiswin = popupDownloadWin('', 'download', 300, 200, 'location=no,scrollbars=no',true);
	doc = thiswin.document;
	doc.close();
	doc.open();
	doc.writeln("<HTML> ");
	doc.writeln("<HEAD>");
	doc.writeln("<SCRIPT LANGUAGE='JAVASCRIPT'>");
	doc.writeln("function doNothing(){");
	doc.writeln("self.close()");
	doc.writeln("}");
	doc.writeln("</SCRIPT>");
	doc.writeln("</HEAD>");
	doc.writeln("<BODY TEXT='000000' BGCOLOR='#F0F0D8' LINK='0000FF' ALINK='0000FF' VLINK='0000FF' ONUNLOAD='window.opener.document.focused=true;'>");
	doc.writeln("<FORM>");
	doc.writeln("<CENTER>");
	doc.writeln("Please right click (single mouse click for MAC) on the following link");
	doc.writeln(" and <BR> select <B>\"save target as\"</B>");
	doc.writeln(" from the popup menu to download the requested information");
	doc.writeln("</CENTER><BR>");
	doc.writeln("<A HREF='" + htmlurl + "' onClick='doNothing()'>");
	doc.writeln("<IMG SRC='../abook.gif' BORDER='0' ALIGN='bottom'>")
	doc.writeln("</A>");
	doc.writeln("<A HREF='" + htmlurl + "' onClick='doNothing()'>");
	doc.writeln(" " + str);
	doc.writeln("</A>");
	doc.writeln("</FORM>");
	doc.writeln("</BODY>");
	doc.writeln("</HTML>");	
	doc.close();
	return thiswin;
}

