<!--//

// Get Document Object
function getObj(name){
	if(document.getElementById){
		return document.getElementById(name);
	}else if(document.all){
		return document.all[name];
	}else if(document.layers && document.layers[name] != null){
		return getObjNN4(document, name);
	}else{
		return false;
	}
}

// Get Document Style Object
function getObjStyle(name){
	if(document.getElementById){
		return document.getElementById(name).style;
	}else if(document.all){
		return document.all[name].style;
	}else if(document.layers){
		return getObjNN4(document, name);
	}
}

// Get NN4 Document Object
function getObjNN4(obj, name){
	var x = obj.layers;
	var foundLayer;
	for(var i=0;i<x.length;i++){
		if(x[i].id == name){
			foundLayer = x[i];
		}else if (x[i].layers.length){
			var tmp = getObjNN4(x[i],name);
		}
		if(tmp){
			foundLayer = tmp;
		}
	}
	if(foundLayer){
		return foundLayer;
	}else{
		return false;
	}
}

// Set Document Object Visibility
function setObjVisibility(name, what){
	if(what == 'SHOW'){
		if(document.getElementById){
			getObjStyle(name).visibility = "visible";
			getObjStyle(name).display = "inline";
		}else if(document.all){
			getObjStyle(name).visibility = "visible";
			getObjStyle(name).display = "inline";
		}else if(document.layers){
			getObjStyle(name).visibility = "show";
			getObjStyle(name).display = "inline";
		}
	}else if(what == 'HIDE'){
		if(document.getElementById){
			getObjStyle(name).visibility = "hidden";
			getObjStyle(name).display = "none";
		}else if(document.all){
			getObjStyle(name).visibility = "hidden";
			getObjStyle(name).display = "none";
		}else if(document.layers){
			getObjStyle(name).visibility = "hide";
			getObjStyle(name).display = "none";
		}
	}
}
// Determine width and resize table
function setWidth(){
	if(document.body.clientWidth){
		if(document.body.clientWidth >= 950){
			setObjVisibility('res950', 'SHOW');
			setObjVisibility('res610', 'SHOW');
			setObjVisibility('res750', 'HIDE');
			setObjVisibility('res410', 'HIDE');
			return true;
		}else{
			setObjVisibility('res950', 'HIDE');
			setObjVisibility('res610', 'HIDE');
			setObjVisibility('res750', 'SHOW');
			setObjVisibility('res410', 'SHOW');
			return true;
		}
	}else if(window.innerWidth){
		if(window.innerWidth >= 950){
			setObjVisibility('res950', 'SHOW');
			setObjVisibility('res610', 'SHOW');
			setObjVisibility('res410', 'HIDE');
			setObjVisibility('res750', 'HIDE');
			return true;
		}else{
			setObjVisibility('res950', 'HIDE');
			setObjVisibility('res610', 'HIDE');
			setObjVisibility('res750', 'SHOW');
			setObjVisibility('res410', 'SHOW');
			return true;
		}
	}else{
		setObjVisibility('res950', 'HIDE');
		setObjVisibility('res610', 'HIDE');
		setObjVisibility('res750', 'SHOW');
		setObjVisibility('res410', 'SHOW');
		return true;
	}
}

// Custom load functions
function customOnload(){
	try{
		setWidth();
	}catch(e){
		window.setTimeout("customOnload();", 500);
	}
}


function exitPopup(){
	//window.setTimeout("if(document.location.href.indexOf('.staging.sitecm.com') == -1){alert('Bye Bye!');}else{alert('You Stayed!');}", 5000);
	if(document.location.href.indexOf('.staging.sitecm.com') == -1){alert('Bye Bye!');}else{alert('You Stayed!');}
}

function exitPopup2(){
	varLeavingSite = ajaxTest();
	if (varLeavingSite){
	//var wnd = window.open( "ExitPopup.do", "exitPopup", "toolbar=no,status=no,scrollbars=no,resizable=yes,width=500,height=290,left=268,top=240" );
		alert("Bye Bye!");
	}
	return true;
}
			
function f_addEventListener(s_event, f_function){
	if(typeof(f_function) != 'function'){
		throw(new Error(000, 'Can not assign ' + typeof(f_function) + ' as the event handler.'));
	}
	if(document.addEventListener){
		window.addEventListener(s_event, f_function, false);
		return;
	}
	if(window.attachEvent){
		window.attachEvent('on' + s_event, f_function);
		return;
	}
	var f_oldHandler = window['on' + s_event];
	if(typeof(f_oldHandler) == 'function'){
		window['on' + s_event] = function(){
			f_oldHandler();
			f_function();
		}
		return;
	}
	window['on' + s_event] = f_function;
}

//f_addEventListener("unload", exitPopup);

/*
//specify page to pop-under
var popunder="http://www.idealever.com/popup.asp"

//specify popunder window features
//set 1 to enable a particular feature, 0 to disable
var winfeatures="width=400,height=450,scrollbars=1,resizable=0,toolbar=0,location=0,menubar=0,status=0,directories=0"

//Pop-under only once per browser session? (0=no, 1=yes)
//Specifying 0 will cause popunder to load every time page is loaded
var once_per_session=0

///No editing beyond here required/////

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function loadornot(){
if (get_cookie('popunder')==''){
loadpopunder()
document.cookie="popunder=yes"
}
}

function loadpopunder(){
win2=window.open(popunder,"",winfeatures)
win2.blur()
window.focus()
}

if (once_per_session==0)
loadpopunder()
else
loadornot()

*/		

//-->