var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

function getRef(id) 
{
	if (isDOM) return document.getElementById(id);
	if (isIE4) return document.all[id];
	if (isNS4) return document.layers[id];
}
function getSty(id) 
{
	return (isNS4 ? getRef(id) : getRef(id).style);
} 

function setMode(mode) 
{
	var block_id = 'advpopup';
	if(arguments.length > 1)
		block_id = arguments[1];
	var menuref = getSty(block_id);
	if(menuref)
		menuref.visibility = mode;
}

var ie=1;
var loc;

function newWindow(url,id,width,height)
{
	var my_scr = 0;
	if(arguments.length > 4 && arguments[4] == 1)
		my_scr = 1; // show scrollbars
	var win_par = 'width='+width+',height='+height+',resizable=0,scrollbars='+my_scr+',menubar=0,status=0, left='+Math.max(0,(screen.width-width)/2)+', top='+Math.max(0,(screen.height-height)/2);
	if (loc!=id)
	{
		zoom=window.open(url, id, win_par);
		loc=id;
	}
	else 
	{
		zoom.close();
		zoom=window.open(url, id, win_par);
	}
}
function getCookie(name) 
{
	var value = null;
	if(document.cookie)	   //only if exists
	{
		var arr = document.cookie.split((escape(name) + '=')); 
			if(2 <= arr.length)
       		{
           		var arr2 = arr[1].split(';');
       			value  = unescape(arr2[0]);
       		}
		}
		return value;
	}
