// JavaScript Document
// EM-Game Elements
doverl='<div id="overlay" style="position:absolute; top:0px; left:0px; width:100%; height:100%; background-color:#CCCCCC; visibility:hidden; z-index:10; '
doverl=doverl+'filter:alpha(opacity=80);-moz-opacity:.80;opacity:.80;"></div>'
theotherworld='<div id="otherworld" style="position:absolute; width: 800px; height: 560px; left: 50%; top: 1%; margin-left: -400px; z-index:11; visibility:hidden;"></div>'
dcl='<div style="position:relative; left:0px; text-align:right; height:17px; font-family:Arial, Helvetica, sans-serif; font-size:12px"><a href="javascript:fnCC()">'
dcl=dcl+'<b style="color:#FFFFFF"> X Close</a></b></div>'

url = 'http://www.clickntip.ch/wm/index.asp'
urlstr = '?085078097109101='+c085078097109101+'&099049='+c099049+'&099050='+c099050+'&082101103075101121='+c082101103075101121+'&l='+lng+'&cc='+cc
iframe='<div style="border:1px solid #FFFFFF; width:800px"><iframe src="" id="thewindow" width="800" marginwidth="0" height="560" marginheight="0" scrolling="no" frameborder="0" style="border:0px solid #666666;"></iframe></div>'


// HTML and Body Stlye
cssst = '<style type="text/css"> html {height: 100%;} '
cssst=cssst+'body {height: 100%; margin: 0px; padding: 0px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#000000; background-color:#FFFFFF;}</style>'
document.write(cssst)

// Write EM-Game Elements to Document
document.write(doverl+theotherworld)


// Store actual body-styles
bpos = document.body.style.position
bflo = document.body.style.overflow

var emzeigen=false

var pageHeight=0

if (window.location.search != "")
	{
	uprm=location.search
	if (uprm.indexOf('em08layout=')>0)
		{
			emlayout = getURLParam('em08layout')
			urlstr=urlstr+'&layout='+emlayout
		}
	if (uprm.indexOf('em08zeigen=ja')>0)
		{
			emzeigen=true
			fnCO()
		}

	if (uprm.indexOf('ctzeigen=ja')>0)
		{
			emzeigen=true
			fnCO()
		}

	}

function getPageSize()
{	
	var xScroll, yScroll, windowWidth, windowHeight;
	this.doc = document;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = this.doc.scrollWidth;
		yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);
	} else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){
		xScroll = this.doc.body.scrollWidth;
		yScroll = this.doc.body.scrollHeight;
	} else {
		xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth;
		yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight;
		xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll;
		yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll;
	}
	if (self.innerHeight) {
		windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
		windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = this.doc.documentElement.clientWidth;
		windowHeight = this.doc.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth;
		windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight;
		windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth;
		windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight;
	}
	pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
	pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
	//return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
	//alert(pageHeight)
};

spielstatus = 'close'

function fnCO() // Open / View EM-Game Elements
	{
	window.scrollTo(0, 0);
	document.body.style.position='relative'
	document.body.style.overflow='hidden'
	document.body.style.height='100%'
	getPageSize()
	document.getElementById('otherworld').innerHTML=dcl+iframe
	document.getElementById('overlay').style.visibility='visible';
	document.getElementById('overlay').style.height=pageHeight+'px';
	document.getElementById('otherworld').style.visibility='visible';
	document.getElementById('thewindow').src=url+urlstr;
	spielstatus = 'open'
	}

	
function fnCC() // Close EM Game
	{
	document.getElementById('overlay').style.visibility='hidden';
	document.getElementById('otherworld').style.visibility='hidden';
	document.getElementById('otherworld').innerHTML='';
	spielstatus = 'close'
	document.body.style.position=bpos
	document.body.style.overflow=bflo
	}

function getURLParam(strParamName){
  var strReturn = "";
  var strHref = window.location.href;
  if ( strHref.indexOf("?") > -1 ){
    var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    var aQueryString = strQueryString.split("&");
    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      if ( 
aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        var aParam = aQueryString[iParam].split("=");
        strReturn = aParam[1];
        break;
      }
    }
  }
  return unescape(strReturn);
} 

function resize () 
	{
		if (spielstatus == 'open')
			{
    		fnCC()
			fnCO()
			}
	}

window.onresize = resize;