//<!--

/////////////////////////////////////////////////////////////////
////////// please let me know if you use my code           //////
////////// iain@arnison.net                                //////
/////////////////////////////////////////////////////////////////


var layerRef="null",layerStyleRef="null",styleSwitch="null",leftSwitch="null",topSwitch="null",show="show",hide="hide",height,width;
var newPageName = "content.asp";


explorer = (document.all) ? true:false;
netscape = (document.layers) ? true:false;
dom = (document.getElementById) ? true:false;


//----------------popup variables---------------

var left = Math.round(screen.availWidth/2)
var top = Math.round(screen.availHeight/2)
var windowCount = 0

//----------------popup variables---------------

//run Imediately
if(explorer){
	//width = document.body.clientWidth;
	//height = document.body.clientHeight;

	layerStyleRef="layer.style.";
	layerRef="document.all";
	styleSwitch=".style";
	leftSwitch=".pixelLeft";
	topSwitch=".pixelTop";
	show = "visible";
	hide = "hidden";
}

if(netscape){
	width = window.innerWidth;
	height = window.innerHeight;
	layerStyleRef="layer.";
	layerRef="document.layers";
	styleSwitch="";
	leftSwitch=".left";
	topSwitch=".top";
	show = "show";
	hide = "hide";
}

if(dom){
	layerRef="document.getElementById";
	styleSwitch=".style";
	leftSwitch=".left";
	topSwitch=".top";
	show = "visible";
	hide = "hidden";
}


//----------layer functions----------------
function getLayerReference(layerName){
	if(netscape || (explorer && !dom))
		return (layerRef+"['"+layerName+"']");
	else
		return (layerRef+"('"+layerName+"')");
}

function showLayer(layerName){
	eval(getLayerReference(layerName)+styleSwitch+'.display="";');
}

	
function hideLayer(layerName){
	eval(getLayerReference(layerName)+styleSwitch+'.display="none";');
}

function moveTo(layerName, top, left){
	eval(getLayerReference(layerName)+styleSwitch+topSwitch+' ="'+top+'";');
	eval(getLayerReference(layerName)+styleSwitch+leftSwitch+' ="'+left+'";');
}
	
function moveBy(layerName, dX, dY){
	eval(getLayerReference(layerName)+styleSwitch+topSwitch+' ='+layerRef+'["'+layerName+'"]'+styleSwitch+topSwitch+' + ' +dY+ ";");
	eval(getLayerReference(layerName)+styleSwitch+leftSwitch+' ='+layerRef+'["'+layerName+'"]'+styleSwitch+leftSwitch+' + '+dX+ ";");
}

function getLayerTop(layerName){
	return eval(getLayerReference(layerName)+styleSwitch+topSwitch+ ";");
}




/////////////////////;o) Layer Code ///////////////////
function toggelLayer(elementId){
	var theElement = document.getElementById( elementId );
	if(theElement.style.display!=''){
		theElement.style.display = '';
	}else{
		theElement.style.display = 'none';
	}
}


/////////////////////;o) style Code ///////////////////
function changeStyle(elementID,className){
	//alert(elementID);
	if(document.getElementById( elementID )!=null){
		document.getElementById( elementID ).className=className;
	}
}


////////////////////;o) page load /////////////////////


function jumpTo(whichPage){
	pageLink = newPageName + "?s=" + whichPage;
	loadNewPage(pageLink);
}

function loadNewPage(page){	
	if(page == "#" || page =="") return;
	window.location = page;
}


//-->

