function crossBrowserLayerCreate(id, L, T, visible) {
	if (document.layers) {
		if (document.layers[id]) {
			alert ('Layer with this ID already exists!') ;
			return ;
		}
		var LR = document.layers[id] = new Layer(0) ;
		LR.name = id ;
		LR.left = L ;
		LR.top = T ;
		LR.visibility = (null == visible || 1 == visible ? 'show' : 'hide')
	}
	else if (document.all) {
		if (document.all[id]) {
			alert('Layer with this ID already exists!') ;
			return ;
		}
		var LR = '\n<DIV id=' + id + ' style="position:absolute'
		+ '; left:' + L
		+ '; top:' + T
		+ '; visibility:' + (null==visible || 1==visible ? 'visible':'hidden')
		+ '"></DIV>' ;
		document.body.insertAdjacentHTML("BeforeEnd", LR) ;
	}
	else if (W3Crulzzz) { // Nimashe kak da go znam towa opredeleno Netscape 6 rulzz
		if (document.getElementById(id)) {
			alert('Layer with this ID already exists!') ;
			return ;
		}
		this.lyr = document.createElement("DIV") ;
		this.lyr.style.position = "absolute" ;
		this.lyr.style.visibility = (null==visible || 1==visible ? 'visible':'hidden') ;
		this.lyr.id = id ;
		document.body.appendChild(this.lyr) ;
		var t = document.getElementById(id) ;
		t.style.left = L ;
  		t.style.top = T ;
	}
}

function crossBrowserLayerMove(layerid, newLEFT, newTOP) {
	if (document.layers) {
		document.layers[layerid].moveTo(newLEFT, newTOP) ;
	}
	
  	if (document.getElementById) {
  		document.getElementById(layerid).style.left = newLEFT ;
  		document.getElementById(layerid).style.top = newTOP ;
  	}
}

function showLoading() {
	var sizes=getDocumentSize();
	crossBrowserLayerCreate("loading_info", (Math.floor(sizes.x/2.4)-Math.floor(200/2)),(Math.floor(sizes.y/5)-Math.floor(120/2)), 1);
	document.getElementById("loading_info").innerHTML=
	'<table bgcolor="#cccccc" cellpadding="2" cellspacing="0" border="0"><tr><td><table cellpadding="20" cellspacing="0" border="0">'
	+'<tr>'
	+'	<td bgcolor="#ffffff">'
	+'		<font class="firms" size="+5">Loading please wait...</font>'
	+'	</td>'
	+'</tr>'
	+'</table></td></tr></table>';
}

function getDocumentSize() {
	var winW,winH;
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  winW = window.innerWidth-16;
	  winH = window.innerHeight-16;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.body.offsetWidth-20;
	  winH = document.body.offsetHeight-20;
	 }
	}
	return {x: winW, y: winH };
}
function getTop(element ) {
	var top = element.offsetTop;
	while ((element = element.offsetParent) != null)
	top += element.offsetTop; 
	return top;
}
function getLeft(element ) {
	var left = element.offsetLeft;
	while ((element = element.offsetParent) != null)
	left += element.offsetLeft; 
	return (left);
}
function ShowDiv(id, id_1, rel_x, rel_y) {
	var div = document.getElementById(id),
		div_1 = document.getElementById(id_1);
	
	if (div.className == 'tableHide') {
		div.style.top = getTop(div_1)+rel_y+'px';
		div.style.left = getLeft(div_1)+rel_x+'px';
		
		div.className = 'tableShow';
	} else {
		div.className = 'tableHide';
	}
}