﻿var chatLayer
var divstate=true
var chatlaystate=true
var cssob=document.createElement("link")
cssob.setAttribute("href","chat/media/css.css")
cssob.setAttribute("rel","stylesheet")
cssob.setAttribute("type","text/css")
var myhead=document.getElementsByTagName("head")
myhead[0].appendChild(cssob)

var scrollPos
var nowheight
var xScroll
xScroll=window.screen.width-300
yScroll=window.screen.availHeight-300
function get_x_scrool()
{
		if (typeof window.pageYOffset != 'undefined') {
	   scrollPos = window.pageYOffset;
		}
		else if (typeof document.compatMode != 'undefined' &&
					 document.compatMode != 'BackCompat') {
		   scrollPos = document.documentElement.scrollTop;
		}
		else if (typeof document.body != 'undefined') {
				   scrollPos = document.body.scrollTop;
		}
	}
window.onscroll = function()
{
	if(divstate==true)
	{
		get_x_scrool()
		nowheight=scrollPos+yScroll
		if(chatlaystate==false)
		{
			chatLayer_h=scrollPos+40
			chatLayer.style.cssText="height:470px;width:460px;position:absolute; top:"+chatLayer_h+"px;left:"+openwindow_x+"px; background:#fff;text-align:center;border:2px solid #999;filter:alpha(opacity=100);-moz-opacity:1;"
			}
	}
}

function closechatbox()
{
chatlaystate=true
chatLayer.innerHTML=""
chatLayer.style.cssText="width:0px;height:0px;"
}

function openwindow(ob)
{
get_x_scrool()
var url
url="feedback/index.html?"+ob
chatlaystate=false
openwindow_x=(xScroll/2)-100
nowheight=scrollPos+40
chatLayer=document.createElement("div")
chatLayer.style.cssText="height:470px;width:460px;position:absolute; top:"+nowheight+"px;left:"+openwindow_x+"px; background:#fff;text-align:center;border:2px solid #999;filter:alpha(opacity=100);-moz-opacity:1;"
var getframe=document.createElement("iframe")
getframe.setAttribute("width","460")
getframe.setAttribute("id","chatiframe")
getframe.setAttribute("height","450")
getframe.setAttribute("scrolling","no")
getframe.setAttribute("frameBorder","0")
getframe.setAttribute("src",url)
var closewindow=document.createElement("div")
closewindow.innerHTML="<a href='#' id='closewindow' onclick='closechatbox();return false;'>Cerrar&nbsp;&nbsp;&nbsp;&nbsp;</a>"
chatLayer.appendChild(closewindow)
chatLayer.appendChild(getframe)
document.body.appendChild(chatLayer)
}
function maillog(mail,url,domainId)
{
	mail=mail.replace("mailto:","")
	var geturl="http://etwinternational.de/maillog.asp?postid="+domainId+"&email="+mail+"&url="+url+"&thistime="+new Date().getTime()
	var iframe=document.createElement("iframe")
	iframe.setAttribute("width","0")
	iframe.setAttribute("height","0")
	iframe.setAttribute("frameBorder","0")
	iframe.setAttribute("scrolling","no")
	iframe.setAttribute("src",geturl)
	iframe.setAttribute("id","myframe2008")
	document.body.appendChild(iframe)
	window.setTimeout(clearframe,4000)
	}
function clearframe()
{
	var ob=document.getElementById("myframe2008")
	document.body.removeChild(ob)
	}
