var scrollLeftLoop;
var scrollRightLoop;

var youtubecounter = 0;
var youtube = new Array();
youtube[0] = new Array("YwiQk3V1LHA","carp fishing tips &amp; tackle");
youtube[1] = new Array("G9JY5T6n0VE","nash siren rs-1 bite");
youtube[2] = new Array("ihLdWMUHF_c","nash new tackle 2011");
youtube[3] = new Array("MJmZTOoVZE8","nash tackle");
youtube[4] = new Array("i7v-q8G3gbg","indulgence bed chair ultimate");
youtube[5] = new Array("-ssViAr0dMk","monster carp cradle");
youtube[6] = new Array("oBeEh9d6nMg","cobra throwing sticks");


$(document).ready(function() {
     $('#slide_container').cycle({
          fx: 'scrollRight' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
     });
     
     display_youtube(0);
     
     $('#youtube_left').click(function(){
        display_youtube(-1); 
     });
     $('#youtube_right').click(function(){
        display_youtube(1); 
     });
     
     
     
     $('#nieuwsbrief_knop').click(function(event){
         if ($('#nieuwsbrief').val()=='Geef uw emailadres ...') {
         } else {
             window.location = "/nieuwsbrief.php?email="+$('#nieuwsbrief').val();
         }
         event.preventDefault();
     })
       // zoeken met enter
        $('#nieuwsbrief').keypress(function(event) {
            if (event.keyCode == '13') {
                window.location = "/nieuwsbrief.php?email="+$('#nieuwsbrief').val();
                event.preventDefault();
            }
        });
        
     $('#zoeken_knop').click(function(event){
         if ($('#zoek').val()=='Geef een zoekopdracht ...') {
         } else {
              window.location = "/index.php?zoek="+$('#zoek').val();
         }
         event.preventDefault();
     })
       // zoeken met enter
     $('#zoek').keypress(function(event) {
       if (event.keyCode == '13') {
              window.location = "/index.php?zoek="+$('#zoek').val();
              event.preventDefault();
       }
     });
        
     
     
     
     
});

function display_youtube(skip) {
     if (skip>0 && youtubecounter<(youtube.length-1)) {
         youtubecounter++;
     }
     if (skip<0 && youtubecounter>0) {
         youtubecounter--;
     }
    
     $('#youtube_wrapper').html(
                     '<object width="340" height="213">'+
                       '<param name="movie" value="http://www.youtube.com/v/'+youtube[youtubecounter][0]+'?fs=1&amp;hl=nl_NL&amp;color1=0x234900&amp;color2=0x4e9e00"></param>'+
                       '<param name="allowFullScreen" value="true"></param>'+
                       '<param name="allowscriptaccess" value="always"></param>'+
                       '<embed src="http://www.youtube.com/v/'+youtube[youtubecounter][0]+'?fs=1&amp;hl=nl_NL&amp;color1=0x234900&amp;color2=0x9a8b43" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="340" height="213"></embed>'+
                     '</object>');
      $('#youtube_titel').html(youtube[youtubecounter][1]);
      
      $('#youtube_teller').html((youtubecounter+1)+' / '+youtube.length);
}

function scrollLeft2()
{
  document.getElementById('brochures_wrapper').scrollLeft-=5;
  scrollLeftLoop=setTimeout("scrollLeft2()",20);
}
function scrollRight()
{
  document.getElementById('brochures_wrapper').scrollLeft+=5;
  scrollRightLoop=setTimeout("scrollRight()",20);      
}


function release()
{
    clearTimeout(scrollLeftLoop)
    clearTimeout(scrollRightLoop)
}


