var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;
var winW = (ns4)? window.innerWidth-16 : document.body.offsetWidth-20;
var winH = (ns4)? window.innerHeight : document.body.offsetHeight;
var orgL = (winW - 750)/2;
var orgT = Math.floor((winH - 445)/2);

function showDiv(id) {
      if (ns4) document.layers[id].visibility = "show";
      if (ie4) document.all[id].style.visibility = "visible";
}

function hideDiv(id) {
      if (ns4) document.layers[id].visibility = "hide";
      if (ie4) document.all[id].style.visibility = "hidden";
}

function changeImg(lyrId, imgId, file) {
      if (ns4) document.layers[lyrId].document[imgId].src = file;
      if (ie4) document.all[lyrId].document[imgId].src = file;
}

function resizeFix() {
      if ((ns4 && (winW != window.innerWidth || winH != window.innerHeight)) || ie4)
	      history.go(0)
} 

function css(id,left,top,width,height,color,vis,z,other) {
	if (id=="START") return '<STYLE TYPE="text/css">\n'
	else if (id=="END") return '</STYLE>'
	var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=5 && height!=null) {
		str += ' height:'+height+'px;'
		if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
	}
	if (arguments.length>=6 && color!=null) str += (is.ns)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length==9 && other!=null) str += ' '+other
	str += '}\n'
	return str
}

function writeCSS(str,showAlert) {
	str = css('START') + str + css('END');
	document.write(str);
	if (showAlert) alert(str)
}
