//JS-Document     

var ns4=document.layers;
var ie4=document.all;
var ns6=document.getElementById&&!document.all;

//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0;
var nsx;
var nsy;
var nstemp;

//hier wird die Ausgangsseite des Layer ausgelesen. Auf diese Seite wird zu Beginn der Live-Messung als Startseite vorgegeben.
var seite=window.location.href;

//Link ist noch nicht aktiv
var survey_url= onsite_url+seite; 

//Funktion/Layer wird nur aufgerufen, wenn Cookies zugelassen sind
document.cookie="check=check_cookies;path=/;Expires=Sat,20 Feb 2010 12:00:00 UTC"; 
if (document.cookie.indexOf("check=check_cookies") != -1){


//Hier wird die Zufallssteuerung "Zugriff nur bei jedem Xten Besucher" eingestellt 
// onsite_rand = 0.02 = jeder 50te Besucher
// onsite_rand = 1 = jeder Besucher
	if (Math.random() <= onsite_rand){ // jeder 50te Teilnehmer 
		if (document.cookie.indexOf("survey=dasoertliche") == -1){
			
			//Hier wird die Mehrfacheinblendung vermieden. Wenn der Layer einmal ausgeliefert wurde, so wird ein Cookie gesetzt. Durch das Setzen des Cookies wird der Besucher nicht noch einmal auf die Befragung (Layer) hingewiesen. 
			//Wenn man die folgende Zeile auskommentiert (zwei Slashes), dann kann man die funktionsweise des Layer gut Testen. (So muss man nicht nach jedem Aufruf des Layer die Cookies löschen)
		    if (onsite_test != "true") {
		    	domain = document.domain;
		    	if (domain.charAt(0) != '.') {
		    		domain = "." + domain;
		    	}
		    	// alert("cookie setzen:" + "survey=dasoertliche;domain=" + domain + ";Expires=Sat,20 Feb 2010 12:00:00 UTC");
		    	document.cookie="survey=dasoertliche;domain=" + domain + ";Expires=Sat,20 Feb 2010 12:00:00 UTC"; 
		    }
		   random_img();
		}
	}
}






function initializedrag(e){
	crossobj=ns6? document.getElementById("showimage") : document.all.showimage;
}
document.onmousedown=initializedrag;

function openwin(url)
{
  /* the height of the popup window */
  var eresult_popup_height        = 700;
  
  /* the widht of the popup window */
  var eresult_popup_width         = 1000; // breite des Popups
  
  /* shall the popup window show the toolbar */
  var eresult_popup_toolbar       = "no";
  
  /* shall the popup show the scrollbars */
  var eresult_popup_scrollbar     = "yes";
  
  /* shall the popup show the locationbar */
  var eresult_popup_locationbar   = "no";
  
  /* shall the popup show the resizable */
  var eresult_popup_resizable   = "yes";
  
  /* shall the popup show the menubar */
  var eresult_popup_menubar   = "no"; // 
  
    /* shall the popup show the statusbar */
  var eresult_popup_status   = "yes"; // 
  
  
  /* the window object. do not change */
  var eresult_mywindow            = false;
  
  

    var window_parameter = 'left='+((screen.width-eresult_popup_width)/2)+', ';
    window_parameter = window_parameter+'top='+((screen.height-eresult_popup_height)/2)+', ';
    window_parameter = window_parameter+'height='+eresult_popup_height+', ';
    window_parameter = window_parameter+'width='+eresult_popup_width+', ';
    window_parameter = window_parameter+'toolbar='+eresult_popup_toolbar+', ';
    window_parameter = window_parameter+'scrollbars='+eresult_popup_scrollbar+', ';
    window_parameter = window_parameter+'location='+eresult_popup_locationbar+', ';
    window_parameter = window_parameter+'resizable='+eresult_popup_resizable+', ';
    window_parameter = window_parameter+'menubar='+eresult_popup_menubar+'';
	window_parameter = window_parameter+'status='+eresult_popup_status+'';
    check_window = window.open(url,"win_survey", window_parameter);
}


function hidebox(){
if (ie4||ns6)
crossobj.style.visibility="hidden";
else if (ns4)
document.showimage.visibility="hide";
}


function random_img(){

document.write("<div id='showimage' style='position:absolute;width:400px;left:300px;top:150px;z-index:9999;'>");
document.write("<table border=0 width=400 bgcolor=#FFFFFF cellspacing=0 cellpadding=1 style='border:1px solid #E00034;'>");
document.write("<tr>");
document.write("<td width=100%><table border=0 width=100% cellspacing=0 cellpadding=0>");

//Kopfzeile mit Logo und Schliessen-Button (X in rechten Ecke des Layer)
document.write("<tr bgcolor='#FFFFFF'>");
document.write("<td height='45' align='left' valign='top' width='50%' style='border-bottom:1px dotted #7f7f7f;'><img src='" + onsite_path + "/logo_35.gif' border=0 style='margin-left:8px;margin-top:3px;'></td>");
document.write("<td height='45' width='50%' style='cursor:hand;border-bottom:1px dotted #7f7f7f;' valign=top align=right><a href='#' onClick='hidebox();return false'><b><img src='" + onsite_path + "/close_button.gif' border='0'></a></td>");
document.write("</tr>");
document.write("<tr>");

document.write("<td width='100%' colspan='2'>");


//Inhalt-Beginn
document.write("<table border=0 width=100% cellspacing=0 cellpadding=0>");

document.write("<tr> ");
document.write("<td width=1%></td>");
document.write("<td width=99%><p style='font-size:14px; font-family:Arial, sans-serif; color:#313031;margin-top:10px;'><b>Ihre Meinung ist uns wichtig!</b></p></td>");
document.write("</tr>");

document.write("<tr> ");
document.write("<td width=2%>&nbsp</td>");
document.write("<td width=98%><p style='font-size:12px; font-family:Arial, sans-serif; color:#313031;margin-top:20px;'>Liebe Besucherin, lieber Besucher,<br><br>helfen Sie mit, das Online-Angebot www.dasoertliche.de nach Ihren Wünschen zu gestalten und nehmen Sie an unserer Umfrage teil.<br /><br /></p></td>");
document.write("</tr>");

document.write("<tr> ");
document.write("<td width=1%>&nbsp</td>");
document.write("<td width=99% valign=top> <a href='#' onclick='javascript:openwin(survey_url); hidebox();'><img src='" + onsite_path + "/go_button.gif' border=0></a><p style='font-size:10px; font-family:Arial, sans-serif; color:#313031;margin-left:1px;'>Der Fragebogen wird in einem extra Fenster geöffnet.</p><a href='#' onClick='hidebox();'><div style='font-size:11px; font-family:Arial, sans-serif; color:#313031;margin-left:2px;margin-top:10px;margin-bottom:20px;'><u>Nein, ich möchte nicht an der Befragung teilnehmen.</u></div></a></td>");
document.write("</tr>");

document.write("</table>");
//Inhalt-Ende

document.write("</td>");
document.write("</tr>");
document.write("</table>");


document.write("</td>");
document.write("</tr>");


document.write("</table>");
document.write("</div>");
}

