// Necessary Js for all page on this website
/*
	Declare Global Variables
	on Load 
		Initialise for Prettyphoto
		set the Left Menu Height, 
		Reset Search Highlight
		Search Textbox OnKeyup, KeyPress 	-> call reset_highlight
		Search Submit 						-> call submitSearchForm
	
	Other Functions 
		submitSearchForm()					-> Submit SearchForm
		submitContactForm()					-> Submit ContactForm
		showform()							-> Show Div
		hideform()							-> Hide Div	
*/

// Global Variables 
var globalErr 			= 1;  // Contact Form Validation 
var SearchType 			= "partial"; //exact, whole, partial - Search method
//var searchDisplayType  	= "newpage"; // overlay =  below search textbox , newpage = on to the same page
var searchDisplayDivId = (searchDisplayType	=="overlay")?"search_dropdown":"content";//search_dropdown = overlay below search textbox , content = same page

var pager1 = new Pager('overlaySearchResultId', 3); // initialize, the Overlay Search Pagination

jQuery(document).ready(function() 
{
    // url for header images with url validation
      jQuery('.banner').click(function(){
          strVisibleImgId=jQuery('.banner_images').children(':visible').attr('id');//alert(strVisibleImgId);
          strlength=strVisibleImgId.indexOf("_"); //alert(strlength);
          intImagePos=strVisibleImgId.substr(strlength+1); //alert(intImagePos);
          var urlregex = new RegExp("^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([0-9A-Za-z]+\.)");
          strLinkUrl=jQuery('#link_'+intImagePos).val();
          site='http://'+strLinkUrl;
          if(urlregex.test(site))
          {
                 window.location=site; //open link in a same window
               // window.open(site);     //open link in new window
          }
//          if(!strLinkUrl=="")
//          {
//            window.location='http://'+strLinkUrl;
//          }
      });
	
	// fade in fade out banner effect
	jQuery('#banner_images').cycle({ 
		   timeout:5000, 
		    random:  1
	});
	
	
	
	//chk_heights();
	var loc = location.href;
	loc=loc.split("/");
	var flag = true;
	for(i=0;i<loc.length;i++)
	{
		if(loc[i]=='nieuws')
			flag=false;
	}
	if(flag)
		chk_heights();
	else
		var t=setTimeout("chk_heights()",500);	
	
	var v = $(".jcarousel-skin-tango").length;
	
	//if(v!=0)
	//setTimeout("chk_heights()",1000);
  });


$(window).load(function () {
	  //alert("test");
	
	jQuery("#lavalamp_menu").lavaLamp({
				fx: "BounceEaseOut", 
		  		//fx: "backout", 
				speed: 700
				,
				click: function(event,menuItem) {
				return true;
				}
				
			});
	  
	  
	  
	 // $(function() { $("#lavalamp_menu").lavaLamp({ fx: "backout", speed: 700 })});
	  
	// Show or Hide lavalamp according to respect lavalamp_menu clicks
		//alert(jQuery('#lavalamp_menu').find('.lamp_activated')[0]);
	  		
		if(jQuery('#lavalamp_menu').find('.lamp_activated')[0]==undefined)
		{
			jQuery('#lavalamp_menu').find(".back").hide(); 
			//jQuery('#lavalamp_menu').find("li").css('color','#2E348F');
			//alert(jQuery('#lavalamp_menu').children(".back").html());
			//alert(jQuery('#lavalamp_menu').find('.lamp_activated')[0].innerHTML);
		}
		
	  
	  
	});


function chk_heights()
{
	/*
	  $('div.left_inner').css({
		  'paddingBottom':$('ul.clients').height()+10	
		  });
	  */
//console.log($('div.left_container_middle').height() + " " +	 $('div.right_container_middle').height()); return;
		  	    
		         v = $(".banner_bg").length;
		       var he =parseInt(-40);
		        if(v>0)
		        { 
					
		      	  //var he = $('div.left_container_middle').height();
		      	  //$('div.left_container_middle').css({"height":parseInt(he)+267});
				  he=parseInt(227);
		        } 
				
				var av = (parseInt($('div.right_container_middle').height())+parseInt(he) ) - parseInt($('div.left_container_middle').height())  ;
				
				if($('div.left_container_middle').height() > $('div.right_container_middle').height()+he)
					{
						av=Math.abs(av);
					  
						$('div.right_container_middle').css({
							'height':$('div.right_container_middle').height()+av
						});
					}
					else if(($('div.right_container_middle').height()+parseInt(he) ) > ($('div.left_container_middle').height()) )
					{ av=Math.abs(av);
						$('div.left_container_middle').css({
							'height':$('div.left_container_middle').height()+av
						});
					}
					
		  	var prev='';
		  	if(document.getElementById("gallery_right"))
		  	{
		  		//jQuery("#gallery_right").css({height:"196px",width:"196px"});
		  	}

}
// Show div
function showform(id)
{
	document.getElementById(id).style.display="block";
}

// Hide Div
function hideform(id)
{
	document.getElementById(id).style.display="none";
}

function showLanguageDropdown()
	{
	if(!jQuery("#language_dropdown").hasClass('show'))
		{
		//document.getElementById("language_dropdown").style.display="block";
	 	jQuery("#language_dropdown").removeClass("hide");
	 	jQuery("#language_dropdown").addClass("show");
		}
	}
	
function hideLanguageDropdown()
	{
	if(!jQuery("#language_dropdown").hasClass('hide'))
		{
		//document.getElementById("language_dropdown").style.display="block";
	 	jQuery("#language_dropdown").removeClass("show");
	 	jQuery("#language_dropdown").addClass("hide");
		}
	}






