
//popup initiatisatie

$(document).ready(function() {
    $("a[@rel*=fancyvideo]").fancybox({
        overlayShow: true,
        frameWidth:560,
        frameHeight:335
    });
});

$(document).ready(function() {
    $("a[@rel*=fancyshirt]").fancybox({
        overlayShow: true
    });
});


$(document).ready(function() {
 $("a.overlay-flash").fancybox({
        overlayShow: true,
        frameWidth:560,
        frameHeight:335
 });
});

//flashanims tonen
var flashvars = {};
var params = {
  menu: "false",
  wmode: "transparent",
  quality: "high",
  bgcolor: "#00aeef"
};
var attributes = {};

swfobject.embedSWF("/images/anim_world.swf", "anim_world", "249", "126", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("/images/anim_walk.swf", "anim_walk", "110", "249", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
swfobject.embedSWF("/images/anim_left.swf", "anim_left", "107", "407", "9.0.0", "expressInstall.swf", flashvars, params, attributes);


//fancy laten werken vanuit flash
//http://outburst.jloop.com/2009/08/06/call-fancybox-from-flash/
function callFancy(my_href) {
var j1 = document.getElementById("hiddenclicker");
j1.href = my_href;
$('#hiddenclicker').trigger('click');
}

//preload images
if (document.images) {
    preload_image_object = new Image();
    image_url = new Array();
    image_url[0] = "images/menu_home_on.png";
    image_url[1] = "images/menu_winkel_on.png";
    image_url[2] = "images/menu_informatie_on.png";
    image_url[3] = "images/menu_overons_on.png";
    image_url[4] = "images/menu_friends_on.png";
    image_url[5] = "images/menu_contact_on.png";
    
    var i = 0;
    for(i=0; i<=5; i++) 
    preload_image_object.src = image_url[i];
}

function submitForm() {
  if (document.forms[0].elements['naam'].value==''||document.forms[0].elements['adres'].value==''||document.forms[0].elements['postcode'].value==''||document.forms[0].elements['woonplaats'].value==''||document.forms[0].elements['telefoon'].value==''||document.forms[0].elements['email'].value=='') {
    alert('Alle velden moeten ingevuld zijn voordat u kunt afrekenen. Probeer het nog eens.');
  }
  else if (echeck(document.forms[0].elements['email'].value)==false) {
    alert('Het ingevulde e-mail adres is niet geldig. Probeer het nog eens.');
  }
  else {
    document.forms[0].submit();
  }
}

function echeck(str) {

  var at="@";
  var dot=".";
  var lat=str.indexOf(at);
  var lstr=str.length;
  var ldot=str.indexOf(dot);
  
  if (str.indexOf(at)==-1){
   return false;
  }
  
  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
   return false;
  }
  
  if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
    return false;
  }
  
  if (str.indexOf(at,(lat+1))!=-1){
    return false;
  }
  
  if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
    return false;
  }
  
  if (str.indexOf(dot,(lat+2))==-1){
    return false;
  }
  if (str.indexOf(" ")!=-1){
    return false;
  }
  return true;				
}

function Verhuller() {
document.write('<a href="mailto:info@chuckyshirt.nl">info@chuckyshirt.nl</a>');

}