

var html = '<style type="text/css">div#sahnesingles {     display:none;    position:absolute;    z-index:998;    border:0;    width:730px;    height:600px;    left: -730px;    top:120px;    padding: 0;    margin:0 auto 0 auto;    text-align: left;    background-image:url(http://antenne.henkstrobel.de/sahneflirt/images/bg.jpg);    background-repeat: no-repeat;    font-family: Arial, sans-serif;    color: #096392;}div#sahnesingles * {    margin:0;}div#sahnesingles table {    border-collapse:collapse;}div#sahnesingles_content {     position:relative;    z-index:999;    height: 185px;    background-image:url(http://antenne.henkstrobel.de/sahneflirt/images/bg_content.jpg);}div#sahnesingles_dose {     width: 191px;    float: left;    margin: 5px 0 0 30px;    font-family: Arial, sans-serif;    font-size: 10px;    color: #FFFFFF;}div#sahnesingles_dose a {     color: #41A3CE;}div#sahnesingles_text {     float:right;    width: 450px;    padding: 40px 20px 20px 0px;    font-family: Arial, sans-serif;    font-size: 8px;}div#sahnesingles_text h1 {     font-family: Arial, sans-serif;    font-size: 12px;    margin-bottom: 0.3em;}div#sahnesingles_text table {    width: 450px;    font-family: Arial, sans-serif;    font-size: 8px;    color: #096392;}img#sahnesingles_submit {    margin: 10px 20px;    cursor:pointer;}div#sahnesingles_text table td.sub {    text-align:right;    font-size: 9px;    white-space: nowrap;}label {    /*white-space:nowrap;*/}img.sahnesingles_submit {    margin: 10px 0 0 20px;    cursor:pointer;}div#sahnesingles_text input.text {     border: 1px solid #5EB9E3;    background-color: #FFFFFF;    font-family: Arial, sans-serif;    font-size: 10px;    color: #096392;}</style><div id="sahnesingles">    <img         usemap="#overview"         src="http://antenne.henkstrobel.de/sahneflirt/images/overview.jpg"         alt=""         width="730"         height="415"         border="0"><div             id="sahnesingles_content">                        <div id="sahnesingles_dose"><img src="http://antenne.henkstrobel.de/sahneflirt/images/dosen/start.gif" alt="" width="191" height="133" border="0"></div>                        <div id="sahnesingles_text">                        <h1>Flirten &amp; gewinnen!</h1>            <p>Jeder Sahnesingle hat ein individuelles Geheimnis.<br>            Klicke oben auf Deinen Favoriten, lerne ihn oder sie näher kennen und             gewinne mit ein bisschen Glück 1.000 Euro in bar!</p>        </div>    </div>        <map name="overview">        <area shape="rect" coords="670,0,730,17" href="#" onclick="sahnesingles_close();" alt="">                <area shape="circle" coords="44,50,32" href="#" onclick="select_single(1, this);" alt="">        <area shape="circle" coords="108,50,32" href="#" onclick="select_single(2, this);" alt="">        <area shape="circle" coords="172,50,32" href="#" onclick="select_single(3, this);" alt="">        <area shape="circle" coords="236,50,32" href="#" onclick="select_single(4, this);" alt="">        <area shape="circle" coords="300,50,32" href="#" onclick="select_single(5, this);" alt="">        <area shape="circle" coords="364,50,32" href="#" onclick="select_single(6, this);" alt="">        <area shape="circle" coords="428,50,32" href="#" onclick="select_single(7, this);" alt="">        <area shape="circle" coords="492,50,32" href="#" onclick="select_single(8, this);" alt="">        <area shape="circle" coords="556,50,32" href="#" onclick="select_single(9, this);" alt="">        <area shape="circle" coords="620,50,32" href="#" onclick="select_single(10, this);" alt="">        <area shape="circle" coords="684,50,32" href="#" onclick="select_single(11, this);" alt="">                <area shape="circle" coords="44,114,32" href="#" onclick="select_single(12, this);" alt="">        <area shape="circle" coords="108,114,32" href="#" onclick="select_single(13, this);" alt="">        <area shape="circle" coords="172,114,32" href="#" onclick="select_single(14, this);" alt="">        <area shape="circle" coords="236,114,32" href="#" onclick="select_single(15, this);" alt="">        <area shape="circle" coords="300,114,32" href="#" onclick="select_single(16, this);" alt="">        <area shape="circle" coords="556,114,32" href="#" onclick="select_single(17, this);" alt="">        <area shape="circle" coords="620,114,32" href="#" onclick="select_single(18, this);" alt="">        <area shape="circle" coords="684,114,32" href="#" onclick="select_single(19, this);" alt="">                <area shape="circle" coords="44,178,32" href="#" onclick="select_single(20, this);" alt="">        <area shape="circle" coords="108,178,32" href="#" onclick="select_single(21, this);" alt="">        <area shape="circle" coords="172,178,32" href="#" onclick="select_single(22, this);" alt="">        <area shape="circle" coords="236,178,32" href="#" onclick="select_single(23, this);" alt="">        <area shape="circle" coords="300,178,32" href="#" onclick="select_single(24, this);" alt="">        <area shape="circle" coords="556,178,32" href="#" onclick="select_single(25, this);" alt="">        <area shape="circle" coords="620,178,32" href="#" onclick="select_single(26, this);" alt="">        <area shape="circle" coords="684,178,32" href="#" onclick="select_single(27, this);" alt="">                <area shape="circle" coords="44,242,32" href="#" onclick="select_single(28, this);" alt="">        <area shape="circle" coords="108,242,32" href="#" onclick="select_single(29, this);" alt="">        <area shape="circle" coords="172,242,32" href="#" onclick="select_single(30, this);" alt="">        <area shape="circle" coords="236,242,32" href="#" onclick="select_single(31, this);" alt="">        <area shape="circle" coords="300,242,32" href="#" onclick="select_single(32, this);" alt="">        <area shape="circle" coords="364,242,32" href="#" onclick="select_single(33, this);" alt="">        <area shape="circle" coords="492,242,32" href="#" onclick="select_single(34, this);" alt="">        <area shape="circle" coords="556,242,32" href="#" onclick="select_single(35, this);" alt="">        <area shape="circle" coords="620,242,32" href="#" onclick="select_single(36, this);" alt="">        <area shape="circle" coords="684,242,32" href="#" onclick="select_single(37, this);" alt="">            <area shape="circle" coords="44,306,32" href="#" onclick="select_single(38, this);" alt="">        <area shape="circle" coords="108,306,32" href="#" onclick="select_single(39, this);" alt="">        <area shape="circle" coords="172,306,32" href="#" onclick="select_single(40, this);" alt="">        <area shape="circle" coords="236,306,32" href="#" onclick="select_single(41, this);" alt="">        <area shape="circle" coords="300,306,32" href="#" onclick="select_single(42, this);" alt="">        <area shape="circle" coords="364,306,32" href="#" onclick="select_single(43, this);" alt="">        <area shape="circle" coords="428,306,32" href="#" onclick="select_single(44, this);" alt="">        <area shape="circle" coords="492,306,32" href="#" onclick="select_single(45, this);" alt="">        <area shape="circle" coords="556,306,32" href="#" onclick="select_single(46, this);" alt="">        <area shape="circle" coords="620,306,32" href="#" onclick="select_single(47, this);" alt="">        <area shape="circle" coords="684,306,32" href="#" onclick="select_single(48, this);" alt="">                <area shape="circle" coords="428,370,32" href="#" onclick="select_single(49, this);" alt="">        <area shape="circle" coords="492,370,32" href="#" onclick="select_single(50, this);" alt="">        <area shape="circle" coords="556,370,32" href="#" onclick="select_single(51, this);" alt="">        <area shape="circle" coords="620,370,32" href="#" onclick="select_single(52, this);" alt="">        <area shape="circle" coords="684,370,32" href="#" onclick="select_single(53, this);" alt="">    </map> </div>';

document.write(html);
window.onload=sahnesingles;

function teilnahmebedingungen() {
    window.open('http://antenne.henkstrobel.de/sahneflirt/bedingungen.html');
}

function sahnesingles()
{
    // Singles einblenden
    if (navigator.appVersion.indexOf("MSIE")) {
        width = document.body.clientWidth;
    }
    else {
        width = window.innerWidth;
    }
    
    max_left = ((width-730)/2)-75;
    
    if (document.getElementById && document.getElementById("sahnesingles")){
        document.getElementById("sahnesingles").style.display = "block";
        
        i=-800;
        
        var aktiv = window.setInterval("sahnesingles_move()", 30);
    }
    
    // Formularfelder ausblenden für IE < 7
    index = parseInt(navigator.appVersion.indexOf("MSIE"));
    
    if (navigator.appVersion.indexOf("MSIE") && parseInt(navigator.appVersion.substring(index+5, index+6)) < 7) {
        if (document.getElementsByTagName && document.getElementsByTagName("input") && document.getElementsByTagName("select")) {
            inputs = document.getElementsByTagName("input");
            for (i=0; i<inputs.length; i++) {
                inputs[i].style.visibility = "hidden";
            }
            selects = document.getElementsByTagName("select");
            for (i=0; i<selects.length; i++) {
                selects[i].style.visibility = "hidden";
            }
        }
    }
    
    
}

function sahnesingles_move ()
{
    if (i<=max_left) {
        interval = i<max_left-100?40:20;
        document.getElementById("sahnesingles").style.left = i+"px";
        i+=interval;
        
        if (i==max_left) {
            images = new Array();
            
            for (k=0; k<=53; k++) {
                images[k] = new Image;
                images[k].src = "images/dosen/"+k+".png";
            }
        }
    }
}

function sahnesingles_close ()
{
    // Singles ausblenden
    if (document.getElementById && document.getElementById("sahnesingles")){
        document.getElementById("sahnesingles").style.display = "none";
    }
    
    // Formularfelder einblenden für IE < 7
    index = parseInt(navigator.appVersion.indexOf("MSIE"));
    
    if (navigator.appVersion.indexOf("MSIE") && parseInt(navigator.appVersion.substring(index+5, index+6)) < 7) {
        if (document.getElementsByTagName && document.getElementsByTagName("input") && document.getElementsByTagName("select")){
            inputs = document.getElementsByTagName("input");
            for (i=0; i<inputs.length; i++) {
                if (inputs[i].style.visibility && inputs[i].style.visibility == "hidden") {
                    inputs[i].style.visibility = "visible";
                }
            }
            selects = document.getElementsByTagName("select");
            for (i=0; i<selects.length; i++) {
                if (selects[i].style.visibility && selects[i].style.visibility == "hidden") {
                    selects[i].style.visibility = "visible";
                }
            }
        }
    }
}

function select_single (id, a_object)
{
    if (a_object.blur()) a_object.blur();
    
    doHttpRequest("sahnesingles.php?action=select_single&id="+id, "sahnesingles_content");
}

function mitmachen(id)
{
    if (document.getElementById && document.getElementById("sahnesingles_antwort0") && document.getElementById("sahnesingles_antwort1")) {
        if (document.getElementById("sahnesingles_antwort0").checked) {
            doHttpRequest("sahnesingles.php?action=mitmachen&antwort=0&id="+id, "sahnesingles_text");
        }
        else if (document.getElementById("sahnesingles_antwort1").checked) {
            doHttpRequest("sahnesingles.php?action=mitmachen&antwort=1&id="+id, "sahnesingles_text");
        }
        else {
            alert("Bitte wählen Sie eine Antwort!");
        }
    }
}

function speichern ()
{
    if (document.getElementById && 
        document.getElementById("sahnesingles_id") && 
        document.getElementById("sahnesingles_antwort") && 
        document.getElementById("sahnesingles_vorname") && 
        document.getElementById("sahnesingles_nachname") && 
        document.getElementById("sahnesingles_geburtstag") && 
        document.getElementById("sahnesingles_email") && 
        document.getElementById("sahnesingles_plz") && 
        document.getElementById("sahnesingles_tb")) {
        
        if (document.getElementById("sahnesingles_vorname").value == '' || 
            document.getElementById("sahnesingles_nachname").value == '' || 
            document.getElementById("sahnesingles_geburtstag").value == '' || 
            document.getElementById("sahnesingles_email").value == '' || 
            document.getElementById("sahnesingles_plz").value == '') {
            
            alert("Bitte füllen Sie alle Felder aus!");
        }
        else if (document.getElementById("sahnesingles_tb").checked==false) {
            alert("Bitte akzeptieren Sie die Teilnahmebedingungen!");
        }
        else if (checkEmail(document.getElementById("sahnesingles_email").value)==false) {
            alert("Bitte geben Sie eine gültige E-Mail-Adresse an!");
        }
        else {
            doHttpRequest(
                 "sahnesingles.php?action=speichern&antwort="+document.getElementById("sahnesingles_antwort").value
                +"&id="+document.getElementById("sahnesingles_id").value
                +"&vorname="+document.getElementById("sahnesingles_vorname").value
                +"&nachname="+document.getElementById("sahnesingles_nachname").value
                +"&geburtstag="+document.getElementById("sahnesingles_geburtstag").value
                +"&email="+document.getElementById("sahnesingles_email").value
                +"&plz="+document.getElementById("sahnesingles_plz").value, "sahnesingles_text");
        }
    }
}

function checkEmail(email) {
    var proto  = "(mailto:)?";
    var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
    var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
    var regex  = "^" + proto + "?" + usr + "\@" + domain + "$";
    
    var rgx    = new RegExp(regex);
    return rgx.exec(email) ? true : false;
}

/* Basic AJAX functions */

var httpRequest = false;
var noResult = "Kein Ergebnis";

// ===================================

function doHttpRequest(url, outputId) {
   httpRequest = false;
   if(window.XMLHttpRequest)  // Mozilla, Safari,...
       httpRequest = new XMLHttpRequest();
   else if(window.ActiveXObject) { // IE
       try {
           httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
    }
       catch (e) {
           try {
               httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
     }
           catch (e) {}
       }
   }
   if(!httpRequest) 
      return false;
   httpRequest.onreadystatechange = function() {
      if(httpRequest.readyState == 4) {
         if(httpRequest.status == 200) 
            handleHttpResponse(httpRequest.responseText, outputId);
       else
          return false;
         }
    else
       return false;
   } 
   httpRequest.open('get', url, true);
   httpRequest.send(null);
}


function handleHttpResponse(content, outputId) {
   if(!document.getElementById)
      return false;
   if(!document.getElementById(outputId))
   return false;
   if(content == "FALSE")
      document.getElementById(outputId).innerHTML = noResult;
   else
      document.getElementById(outputId).innerHTML = content;
} 
