// JavaScript Document

var ROOT;
  
function check_site_height(){

	var myWidth = 0;
	var myHeight = 0;
	  if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	  }

	if (myHeight < 800){
		//alert(myHeight);
		jQuery(".logo-groot").css("margin", "12px 0 0 32px");
		jQuery(".header").height(100);
		jQuery(".header").css("background-position", "576px 59px");
	}
}


function CufonReplace() {
	/*Cufon.replace('h1', { fontFamily: 'thesans', hover: true } );
	Cufon.replace('h2', { fontFamily: 'thesans', hover: true } );*/
	
	
	Cufon.replace('.header-tekst-kop');
	Cufon.replace('.tekst-kop');
	Cufon.replace('.downloads-kop');
	Cufon.replace('.contact-kop');
	Cufon.replace('.nieuws-kop');
	Cufon.replace('.menu ul li a');
	Cufon.replace('.inhoud h1');
	Cufon.replace('.menu-logos ul li a span');
	Cufon.replace('.glidecontent2 h3');
	Cufon.replace('.welcome h1');
	Cufon.replace('.lp_welcome h1');
	Cufon.replace('.rightpli h2');
}

function isValidEmailAddress(emailAddress) {
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}


var myWidth = 0;
var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }


$(document).ready(function(){ 
						   						   
	/* 
	
	geheugensteuntje
	
	$("#id").click(function(){
	  $("#id2").animate({ 
        left: "-67"
      }, 500, "swing" );
	  $("#id").val("");
    });
	
	$("#id").click(function(event){
	  $("#id2").animate({ 
        left: "-657px"
      }, 1000, "swing" );
	  event.preventDefault();
    });
	
	
	$("#id").click(function(){
	  $("#id2").css("display", "none");
    });	
	
	$(".class").live('click',function(){
	  $(this).parent().parent(".colors").children(".selected").css("display", "none");							
	  $(this).children(".selected").css("display", "block");
		  $(".class2").animate({ 
        	top: "30"
      		}, 500, "swing",function(){ $("#alert-mask").css("display", "none");} );
    });
	*/
	
	var hoofh = jQuery(".hoofddiv").height();
	//alert(hoofh + " ? " + myHeight);
	if (hoofh < myHeight){
		var dif = myHeight - hoofh;
		var hh = parseInt(dif/2);
		jQuery(".hoofddiv").css("margin-top", hh+"px");
	}
	
	jQuery("a.prodvideolink").live("click", function(event){
		event.preventDefault();
		var p = jQuery("a#ank");
		var offset = p.offset();
		if(offset.top > 0){
			//jQuery()
			//alert(offset.top);
			//jQuery("body,html").scrollTop(offset.top);
			jQuery('html').animate({scrollTop : offset.top},'slow');
		}
		var l_id = jQuery(this).attr("id");
		jQuery.ajax({
			url: ROOT + 'getProdVideo',
			data: 'id='+l_id,
			type: 'POST',
			async: false,
			success: function(data){
				jQuery("#product_video").stop(true, true).hide('fast');
				jQuery("#product_video").empty;
				jQuery("#product_video").html(data);
				//jQuery("#product_video").stop(true, true).show('slow');
				jQuery("#product_video").stop(true, true).fadeIn('slow');
				//jQuery("#product_video").stop(true, true).animate({ display: 'block' }, 2000, function(){});
			}
		});
	});
	
});
