
var ingame = true;

if(document.referrer.indexOf('visual-utopia.com')==-1 && document.referrer.length > 0) top.location = '/?openpage=' + escape(document.location.href); 


function popload() {

	setHeight(document.getElementById('main').clientHeight - -30);
}


function setHeight(height) {
	
	if(height==null) {
		height = document.getElementById('main').clientHeight - -30;
	}
	
	var i = 0;

	if(!window.opener) {
	
		if(parent.document.getElementById(this.name + '_title')) {
			parent.document.getElementById(this.name + '_title').innerHTML = document.title;

			if(height) {
				var clientHeight = parseInt(parent.document.body.clientHeight);

				if(clientHeight>height) {
					parent.document.getElementById('slot' + i).style.height = Math.min(clientHeight - 50, height - -36);
					parent.document.getElementById('id_ifrslot' + i).style.height = Math.min(parseInt(clientHeight) - 86, height);
				}
				else {
					parent.document.getElementById('slot' + i).style.height = clientHeight - 50;
					parent.document.getElementById('id_ifrslot' + i).style.height = parseInt(clientHeight) - 86;
				}
				
				parent.document.getElementById('slot' + i).style.top = clientHeight / 2 - parseInt(parent.document.getElementById('slot' + i).style.height) / 2 - 8;

				parent.mainLoop();
				
			}
		}

	}	
	else {
		
		height = height - -65;
		var clientHeight = screen.height;

		if(height>clientHeight) height = clientHeight-50;

		var winHeight = window.innerHeight;

		var winX = (document.all)?window.screenLeft:window.screenX;
		var winY = (document.all)?window.screenTop:window.screenY;

		//self.moveTo(-1000,-1000);

		window.resizeTo(628, height);
		var diff = height - window.innerHeight;
		winHeight = winHeight + diff;
		window.resizeTo(628, winHeight);
	
		
		if(winHeight != height) {
		
			//alert('winHeight=' + winHeight + ' height=' + height);
			
			window.resizeTo(628, height);



			//alert(self.innerHeight);

			self.moveTo(winX,screen.height/2 - self.innerHeight/2 - 50);
			
			//alert('winHeight=' + window.clientHeight + ' height=' + height + ' scroll=' + document.body.scrollTop + 'window.scrollMaxY=' + window.scrollMaxY);
		}
		else self.moveTo(winX,winY);
		
		
		
	}
}




function closeWindow() {

	if(window.opener) self.close()
	else {
		
		var slot = parseInt(this.name.substring(7, this.name.length));
		
		//alert('slot: ' + slot + ' (' + this.name + ')');
		
		parent.document.getElementById('slot' + slot).style.display='none';
		
		if(parent.OPERA) {
			parent.bodyHolder.scrollTop = parent.bodyHolder.scrollTop + 1;
			parent.bodyHolder.scrollTop = parent.bodyHolder.scrollTop - 1;
		}

	}
	return false;

}


function go(sUrl) {

	var vuid = getSessionFromAddress(document.location.href, 'vuid');

	if(vuid) {
		if(sUrl.indexOf('vuid') == -1) {
			if(sUrl.indexOf('?') == -1) sUrl+='?vuid=' + vuid
			else  sUrl+='&vuid=' + vuid;
		}
	}

	self.location=sUrl;
	return false;

}

function getSessionFromAddress(strAddr, strName) { 

	var intPos = strAddr.indexOf(strName);

	if(intPos > 0) {

		intPos += strName.length + 1;
		
		if(strAddr.indexOf('translate.google.com') > 0) intPos+=2;

		var strRight = strAddr.substring(intPos, strAddr.length);

		if(strRight.indexOf('&') > -1) return strAddr.substring(intPos, intPos + strRight.indexOf('&'))
		else if(strRight.indexOf('%3D') > -1) return strAddr.substring(intPos, intPos + strRight.indexOf('&'))
		else return strRight;
	}

	else {
		return false;
	}
}





