var OS = 'Win';
var version = "n";
var isNS = (navigator.appName == "Netscape");
var isMAC = (navigator.platform.indexOf('Mac') != -1);

browserVer=navigator.appVersion;
App = navigator.appName;
var Version=browserVer.substring(0,1);
var posOS = navigator.appVersion.indexOf('Mac');
var posOS2 = navigator.appVersion.indexOf('Win');
if (posOS >= 0) OS = 'Mac';
if ((posOS < 0) && (posOS2 >= 0)) OS = 'Win';
if (App == "Netscape" && Version >= 3) version = "n3";

var message="";
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")


function openwin(name,myname,mywidth,myheight,mytool,mydir,mystatus,myscroll,myresize,mymenu) {
	mytop=Math.floor((screen.height/2) - (myheight/2));
	myleft=Math.floor((screen.width/2) - (mywidth/2));
	if (version != "n3" && OS != 'Mac') debute = window.open(name,myname,"toolbar="+mytool+",width="+mywidth+",height="+myheight+",directories="+mydir+",status="+mystatus+",scrollbars="+myscroll+",top="+mytop+",left="+myleft+",resizable="+myresize+",menubar="+mymenu)
	if (OS == 'Mac') debute = window.open(name,myname,"toolbar="+mytool+",width="+mywidth+",height="+myheight+",directories="+mydir+",status="+mystatus+",scrollbars="+myscroll+",top="+mytop+",left="+myleft+",resizable="+myresize+",menubar="+mymenu)
	if (version == "n3") {
		debute = window.open(name,myname,"toolbar="+mytool+",width="+mywidth+",height="+myheight+",directories="+mydir+",status="+mystatus+",scrollbars="+myscroll+",top="+mytop+",left="+myleft+",resizable="+myresize+",menubar="+mymenu)
		debute.focus();
	}
}

function openwintopleft(name,myname,mywidth,myheight,mytool,mydir,mystatus,myscroll,myresize,mymenu) {
	mytop=10;
	myleft=10;
	if (version != "n3" && OS != 'Mac') debute = window.open(name,myname,"toolbar="+mytool+",width="+mywidth+",height="+myheight+",directories="+mydir+",status="+mystatus+",scrollbars="+myscroll+",top="+mytop+",left="+myleft+",resizable="+myresize+",menubar="+mymenu)
	if (OS == 'Mac') debute = window.open(name,myname,"toolbar="+mytool+",width="+mywidth+",height="+myheight+",directories="+mydir+",status="+mystatus+",scrollbars="+myscroll+",top="+mytop+",left="+myleft+",resizable="+myresize+",menubar="+mymenu)
	if (version == "n3") {
		debute = window.open(name,myname,"toolbar="+mytool+",width="+mywidth+",height="+myheight+",directories="+mydir+",status="+mystatus+",scrollbars="+myscroll+",top="+mytop+",left="+myleft+",resizable="+myresize+",menubar="+mymenu)
		debute.focus();
	}
}

function openwin_popup(myurl,mywidth,myheight) {
	openwin(myurl,"newpopup",mywidth,myheight,0,0,0,0,0,0);
}

function openwin_docked(myurl) {
	debute = window.open(myurl,"newwin","location=1,toolbar=1,directories=1,status=1,scrollbars=1,resizable=1,menubar=1");
}

function openwin_fixedsize(myurl,mywidth,myheight) {
	debute = window.open(myurl,"newwin","width="+mywidth+",height="+myheight+",location=1,toolbar=1,directories=1,status=1,scrollbars=1,resizable=1,menubar=1");
}

function openwin_fullscreen(name,myname) {
	debute = window.open(name,myname,"fullscreen=1,toolbar=1,directories=1");
}

function pub(myurl) {
	popupWidth = 468;
	popupHeight = 60;
	myname = "pub";
	mytool = "no";
	mydir = "no";
	mystatus = (!(isNS) && (isMAC)) ? "no" : "yes";
	myscroll = "no";
	myresize = "no";
	mymenu = "no";
	winparams = "toolbar="+mytool+",directories="+mydir+",status="+mystatus+",scrollbars="+myscroll+",resizable="+myresize+",menubar="+mymenu;
	if(isNS) {
		winWidth = window.innerWidth;
		winHeight = window.innerHeight;
		winLeft = self.screenX;
		winTop = self.screenY;
	} else if (!(isNS) && !(isMAC)) {
		winWidth = document.body.offsetWidth;
		winHeight = document.body.offsetHeight;
		winLeft = self.screenLeft;
		winTop = self.screenTop;
	} else {
		winWidth = 0;
		winHeight = 0;
		winTop=0;
		winLeft=0;
	}
	mytop= Math.floor(winTop + ((winHeight - 420)/4) - popupHeight);
	myleft= Math.floor((winWidth/2) - (popupWidth/2) + winLeft);
	mytop=(mytop>0)? mytop : Math.floor((screen.height/4) - (popupHeight/2));
	myleft=(myleft>0)? myleft : Math.floor((screen.width/2) - (popupWidth/2));
	winparams += (isNS) ? ",width="+popupWidth+",height="+popupHeight+",screenX="+mytop+",screenY="+myleft : ",width="+popupWidth+",height="+popupHeight+",top="+mytop+",left="+myleft;
	window.open(myurl,myname,"toolbar="+mytool+",width="+popupWidth+",height="+popupHeight+",directories="+mydir+",status="+mystatus+",scrollbars="+myscroll+",top="+mytop+",left="+myleft+",resizable="+myresize+",menubar="+mymenu);

}

function zoom(myurl,mywidth,myheight) {
	openwin(myurl,"zoom",mywidth,myheight,0,0,0,0,0,0);
}

function preview(myurl,mywidth,myheight) {
	openwin(myurl,"preview",mywidth,myheight,0,0,0,0,0,0);
}

function teaser(myurl,mywidth,myheight) {
	if((OS == 'Mac') && (document.all)) {
		openwin(myurl,"teaser",mywidth,myheight,0,0,0,0,0,0);
	} else {
		openwin_fullscreen(myurl,"teaser",mywidth,myheight,0,0,0,0,1,0);
	}
}