document.write("<style>#body { display: none; }</style>");
document.write("<table id=resept><td><table align=center id=resin><td><div>Now Loading...</div></td></table></td></table>");

resfn = 10;
var FD, colFn, numIm, count, TO, PS, focusConf;

agt = navigator.userAgent;
cmd = (agt.match(/firefox/i)) ? "MozOpacity"
 : (agt.match(/safari/i)) ? "Opacity"
 : (document.all && ! window.opera) ? "filter"
 : "";
safari = (agt.match(/safari/i)) ? 1 : 0;
ip = (agt.match(/iphone/i)) ? 1 : 0;

function getSelfSize() {

	if(self.innerHeight && self.scrollMaxY) {	
		maxX = document.body.scrollWidth;
		maxY = self.innerHeight + self.scrollMaxY;
	}
	else if(document.body.scrollHeight > document.body.offsetHeight){
		maxX = document.body.scrollWidth;
		maxY = document.body.scrollHeight;
	}
	else {
		maxX = document.body.offsetWidth;
		maxY = document.body.offsetHeight;
	}

	if(document.body.clientWidth) {
		selfW = document.body.clientWidth;
		selfH = document.body.clientHeight;
	}
	else if(self.innerHeight) {
		selfW = self.innerWidth;
		selfH = self.innerHeight;
	}
	else if(document.documentElement && document.documentElement.clientHeight) {
		selfW = document.documentElement.clientWidth;
		selfH = document.documentElement.clientHeight;
	}

	maxX = parseInt(maxX);
	maxY = parseInt(maxY);
	selfW = parseInt(selfW);
	selfH = parseInt(selfH);
}

function resEscape() {

	resT += 20;
	document.getElementById("resin").style.top = resT * -1;
	getSelfSize();

	if(resT <= selfH + 100)
		setTimeout("resEscape()", 10);
	else {
		document.getElementById("body").style.display = "block";
		if(safari || document.all) {
			before = document.body.clientWidth
			document.body.style.overflow = "hidden";
			iescrWid = document.body.clientWidth - before;
			document.body.style.overflow = "scroll";
		}
		chLayout();
		getSelfSize();
		document.getElementById("resept").style.width = selfW + "px";
		document.getElementById("resept").style.height = selfH + "px";
		getSelfSize();
		document.getElementById("resept").style.width = maxX + "px";
		document.getElementById("resept").style.height = maxY + "px";
		opening();
	}
}

function opening() {

	clearTimeout(FD);
	resfn --;
	op = (cmd == 'filter') ? "alpha(opacity=" + (resfn * 10) + ")" : resfn / 10;
	document.getElementById("resept").style[cmd] = op;
	if(resfn > 0)
		FD = setTimeout("opening()", 100);
	else
		document.getElementById("resept").style.display = "none";
}

function chLayout() {

	regW = 930;
	minW = 768;
	getSelfSize();

	w = parseInt(selfW) - 6;
	w = (w >= regW) ? regW : (w < minW) ? minW : w;
	md = (w >= regW) ? 1 : 0;

	document.getElementById("adstop").style.left = ((md) ? 170 : Math.floor((w - 728) / 2)) + "px";
	document.getElementById("left").style.top = ((md) ? 0 : 100) + "px";
	document.getElementById("body").style.width = w + "px";
	document.getElementById("footer").style.width = w + "px";
	document.getElementById("footer").style.width = w + "px";
	document.getElementById("content").style.minHeight = (md) ? "850px" : "950px";
	if(document.all)
		document.getElementById("content").style.height = (md) ? "850px" : "950px";
}

function init() {

	if(document.getElementById("send")) {
		document.getElementById("send").onmouseover = function() {
			this.style[cmd] = (cmd == 'filter') ? "alpha(opacity=100)" : 1;
		}
		document.getElementById("send").onmouseout = function() {
			this.style.top = "0px";
			this.style.left = "0px";
			this.style[cmd] = (cmd == 'filter') ? "alpha(opacity=60)" : 0.6;
		}
		document.getElementById("send").onmousedown = function() {
			this.style.top = "1px";
			this.style.left = "1px";
			return false;
		}
		document.getElementById("send").onmouseup = function() {
			this.style.top = "0px";
			this.style.left = "0px";
		}
	}

	if(document.getElementById("ml"))
		document.getElementById("ml").onclick = function() {
			location.href = "mai" + "lto" + ":" + "con" + "tact" + "@" + location.hostname;
		}

	if(! document.getElementById("string-form"))
		window.onresize = chLayout;

	resT = 0;
	resEscape();
}

onload = init;
