var index = 1; function menukaart ( x ) { if ( ( x == -1 && index > 1 ) || ( x == 1 && index < 12 ) ) { $("div#contentMenukaart div").css("backgroundImage" , "url(menukaart/" + index + ".jpg)"); index += x; $("div#contentMenukaart img").hide(); $("div#contentMenukaart img").attr("src","menukaart/" + index + ".jpg"); $("div#contentMenukaart img").fadeIn("slow"); } if ( index == 1 ) $("div#contentMenukaart .butLeft").css("opacity" , 0); else { $("div#contentMenukaart .butLeft").css("opacity" , 1); $("div#contentMenukaart .butLeft").css("opacity" , "none"); } if ( index == 12 ) $("div#contentMenukaart .butRight").hide(); else $("div#contentMenukaart .butRight").show(); } $(document).ready(function() { $("ul#menu li a").each ( function() { $(this).click ( function(){ openDIV($(this).html()); return false; }); }); $("div#contentMenukaart .butLeft").click ( function(){ menukaart(-1); return false; }); $("div#contentMenukaart .butRight").click ( function(){ menukaart(1); return false; }); menukaart(0); $("div#contentFotos .butLeft").click ( function(){ loadPhoto(1); return false; }); $("div#contentFotos .butRight").click ( function(){ loadPhoto(-1); return false; }); loadPhotos ( ); $("div#contentDating3 .butLeft").click ( function(){ loadContact(1); return false; }); $("div#contentDating3 .butRight").click ( function(){ loadContact(-1); return false; }); loadContacts ( ); $("div#contentFotos #filiaal").change ( function () { loadPhotos ( ); }); $("textarea#dmessage").keyup ( function () { if ( $("textarea#dmessage").val().length > 200 ) { $("textarea#dmessage").val ( $("textarea#dmessage").val().substr ( 0 , 200 ) ); return false; } }); $("form#searchDate").submit ( function () { $("div[id^=content]").hide ( "slow" ); $("div#contentDating3").show("slow"); loadContacts ( ); return false; }); }); function getBackground ( s ) { switch ( s ) { case "Foto's": return "bg_fotos.jpg"; case "Franchising": return "bg_home.jpg"; case "Dating3": return "bg_dating.jpg"; default: return "bg_" + s.toLowerCase() + ".jpg"; } } function openDIV ( s ) { $("body").css("background-image","url(images/bg.jpg)"); $("div#main").css("background-image","url(images/"+getBackground(s)+")"); $("ul#menu li a.active").removeClass ( "active" ); $("div[id^=content]").hide ( "slow" ); $("ul#menu li a").each ( function () { if ($(this).html() == s) { $(this).addClass("active"); var x = $(this).html().replace("'", ""); $("div#content" + x).show("slow"); } } ); $("body").css("background-image","url(images/"+getBackground(s)+")"); } contacts = new Array ( ); function loadContacts ( ) { var xmlhttp=false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } url = "datingServlet.php?x=1"; geslacht = $("div#contentDating #geslacht").val(); leeftijd = $("div#contentDating #leeftijd").val(); contacts = new Array ( ); if ( geslacht == 'man' || geslacht == 'vrouw' ) url += "&g=" + geslacht; if ( leeftijd != '' && leeftijd > 0 && typeof leeftijd != 'undefined' ) url += "&l=" + leeftijd; if ( !xmlhttp ) { alert ( "Uw browser ondersteund geen servercommunicatie (AJAX). Installeer een nieuwere versie." ); } else { xmlhttp.open("GET", url, true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { xmlDoc = xmlhttp.responseXML; ca = xmlDoc.getElementsByTagName("contact"); len = ca.length; for ( i = 0; i < len; i++ ) { contacts[contacts.length] = new Array ( ca[i].getElementsByTagName("name")[0].childNodes[0].nodeValue, ca[i].getElementsByTagName("age")[0].childNodes[0].nodeValue, ca[i].getElementsByTagName("sex")[0].childNodes[0].nodeValue, ca[i].getElementsByTagName("message")[0].childNodes[0].nodeValue, ca[i].getElementsByTagName("id")[0].childNodes[0].nodeValue ); } curContact = 0; loadContact ( ); } } xmlhttp.send(null); } } curContact = 0; function loadContact ( i ) { if ( i == 1 && curContact < contacts.length-1 ) curContact++; if ( i == -1 && curContact > 0 ) curContact--; if ( contacts.length == 0 ) $("div#contentDating3 div#contact").html ( "
Helaas, je bent te kieskeurig geweest. Er is niemand die aan je eisen voldoet!
" ) ; else $("div#contentDating3 div#contact").html ( "" + contacts[curContact][3] + "
" ); if ( curContact >= contacts.length-1) $("div#contentDating3 .butLeft").css("opacity" , 0); else { $("div#contentDating3 .butLeft").css("opacity" , 1); $("div#contentDating3 .butLeft").css("opacity" , "none"); } if ( curContact <= 0 ) $("div#contentDating3 .butRight").hide(); else $("div#contentDating3 .butRight").show(); } function sendResponse ( id , name , email , message ) { var xmlhttp=false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } url = "datingServlet.php?x=send&id=" + id + "&name=" + name + "&email=" + email + "&message=" + message.replace ( /\n\r/g , "---" ).replace ( /\n/g , "---" ); if ( !xmlhttp ) { alert ( "Uw browser ondersteund geen servercommunicatie (AJAX). Installeer een nieuwere versie." ); } else { xmlhttp.open("GET", url, true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { resp = xmlhttp.responseText; if ( resp == "OK" ) { alert ( "Je bericht is verzonden!" ); loadContact ( ); } else { $("#rsend").removeAttr("disabled"); alert ( "Er is iets mis gegaan tijdens de verzending van je bericht! " + resp ); } } } xmlhttp.send(null); } } function reaction ( ) { $("div#contentDating3 div#contact").html(""); $("div#contentDating3 .butLeft").css("opacity" , 0); $("div#contentDating3 .butRight").hide(); $("textarea#rmessage").keyup ( function () { if ( $("textarea#rmessage").val().length > 200 ) { $("textarea#rmessage").val ( $("textarea#rmessage").val().substr ( 0 , 200 ) ); return false; } }); $("#reactionForm").submit ( function ( ) { if ( $("#rname").val() != "" ) { if ( $("#remail").val() != "" ) { if ( $("#rmessage").val() != "" ) { $("#rsend").attr("disabled","disabled"); sendResponse ( contacts[curContact][4] , $("#rname").val() , $("#remail").val() , $("#rmessage").val() ); } else { alert ( "Je hebt geen bericht ingevuld!" ); } } else { alert ( "Je hebt je e-mailadres niet ingevuld!" ); } } else { alert ( "Je hebt je naam niet ingevuld!" ); } return false; }); } photos = new Array ( ); function loadPhotos ( ) { url = "photoServlet.php"; filial = $("div#contentFotos #filiaal").val(); photos = new Array ( ); if ( filial != '--- Alles ---' ) url += "?f=" + filial; var xmlhttp=false; try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } if ( !xmlhttp ) { alert ( "Uw browser ondersteund geen servercommunicatie (AJAX). Installeer een nieuwere versie." ); } else { xmlhttp.open("GET", url, true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { xmlDoc = xmlhttp.responseXML; pa = xmlDoc.getElementsByTagName("photo"); l = pa.length; for ( i = 0; i < l; i++ ) { photos[photos.length] = pa[i].childNodes[0].nodeValue; } curPhoto = 0; loadPhoto ( 0 ); } } xmlhttp.send(null); } } curPhoto = 0; function loadPhoto ( i ) { if ( i == 1 && curPhoto < photos.length-1 ) curPhoto++; if ( i == -1 && curPhoto > 0 ) curPhoto--; if ( photos.length == 0 ) $("div#contentFotos img").attr ( "src" , "images/geenFoto.png" ); else $("div#contentFotos img").attr ( "src" , photos[curPhoto] ); if ( curPhoto >= photos.length-1) $("div#contentFotos .butLeft").css("opacity" , 0); else { $("div#contentFotos .butLeft").css("opacity" , 1); $("div#contentFotos .butLeft").css("opacity" , "none"); } if ( curPhoto <= 0 ) $("div#contentFotos .butRight").hide(); else $("div#contentFotos .butRight").show(); }