//cookie lesen

 function getCookieVal (offset) {
    var endstr = document.cookie.indexOf (";", offset);
    if (endstr == -1)
        endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
        return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break; 
    }
    return null;
    }

// cookie schreiben

function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
	((path == null) ? "" : ("; path=" + path)) +
	((domain == null) ? "" : ("; domain=" + domain)) +
	((secure == true) ? "; secure" : "");
}


//Cookie löschen

function DeleteCookie (name) {
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	var cval = GetCookie (name);
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}





// Drop-in content box- By Dynamic Drive
// For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
// This credit MUST stay intact for use

var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "%"

var bouncelimit=0 //(must be divisible by 8)
var direction="down"

function initbox(){
var befragen = GetCookie('SurveyHoRweb')
if (befragen==null){


if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-100+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",50)
}}

function dropin(){
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<50+scroll_top)
crossobj.top=parseInt(crossobj.top)+10+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",50)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

//nicht teilnehmen
function dismissboxn(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
        var expdate = new Date (); 
        expdate.setTime(expdate.getTime() + (100 * 24 * 60 * 60 * 1000)); //Verfallsdatum setzen
        SetCookie('SurveyHoRweb','no', expdate); 
}

//Teilnehmen
function dismissboxy(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
        var expdate = new Date (); 
        expdate.setTime(expdate.getTime() + (100 * 24 * 60 * 60 * 1000)); //Verfallsdatum setzen
        SetCookie('SurveyHoRweb','yes', expdate); 

window.open('http://survey.house-of-research.de/index.php?sid=94171&lang=de','popdown','location=yes,scrollbars=yes,menubar=yes,toolbar=yes,resizable=yes,statusbar=yes');
focus();
}

//X
function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


window.onload=initbox

