function setCookie(name, value){
	document.cookie = escape(name) + '=' + escape(value) + '; path=/;';
}
// set cookie with javascript... read it with php
setCookie('screenwidth',parseInt(screen.width));
setCookie('screenheight',parseInt(screen.height));

browserName = navigator.appName; 
browserVer = parseInt(navigator.appVersion); 
ns3up = (browserName == "Netscape" && browserVer >= 3); 
ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4); 

function NS4ResizeCheck() {
	if (pendingReload && (innerWidth != origWidth || innerHeight != origHeight)) {
		pendingReload = false;
		location.reload();
	}
}
if (document.layers) {
	origWidth = innerWidth;
	origHeight = innerHeight;
	pendingReload = true;
	setTimeout("NS4ResizeCheck()",100);
}
function showhide(visid,s_name,s_name2,cat) {  
	if (!document.layers) {
		var w3div = document.getElementById('category'+visid+'');		
		if (w3div.style.display=='none') {
			w3div.style.visible = 'true';
			if (!document.all) w3div.style.display='inline';
			else w3div.style.display='block';
		} else {
			w3div.style.display = 'none';
			w3div.style.visible = 'false';
		}
	}
}
function showhidelayer(layername){
	if(document.getElementById(layername).style.display=='none'){
		document.getElementById(layername).style.display='block';
	}else{
		document.getElementById(layername).style.display='none'; 
	} 
}
function padlength(what){
	var output=(what.toString().length==1)? "0"+what : what;
	return output;
}
// make name for this window
window.name='mainwindow';
// autofocus popup window
var newwindow = ''; 
function popWin(url, name, size) { 
	if (!newwindow.closed && newwindow.location) { 
		newwindow.location.href = url; 
	} else {
		newwindow=window.open(url, name, size); 
		if (!newwindow.opener) newwindow.opener = self; 
	} 
	if (window.focus) {
		newwindow.focus();
	} 
	return false; 
}

// initialize embedded player4x.swf
var player;
function playerReady(obj) {
	player = window.document.getElementById(obj['id']);
};
/* on unload Stop loading and playing */
window.onbeforeunload = function () {
	if(player)	player.sendEvent('STOP');
}
window.onunload = function () {
	if(player)	player.sendEvent('STOP');
}
