$(window).load(function () {
  //alert("test");
  jQuery("#lavalamp_menu").lavaLamp({
			fx: "BounceEaseOut", 
			speed: 700,
			click: function(event,menuItem) {
			return true;
			}
		});
  jQuery('#header_img').cycle({ 
		   timeout:5000, 
		    random:  1
  });
});

//lavalamp effect
/*jQuery(document).ready(function(){
	//var bodyid = jQuery('body')[0].id;
	//bodyid_new=bodyid.search("lavalampbody");
			jQuery("#lavalamp_menu").lavaLamp({
			fx: "BounceEaseOut", 
			speed: 700,
			click: function(event,menuItem) {
			return true;
			}
		});
});*/
// pretty photo
jQuery(document).ready(function(){
	jQuery("a[rel^='prettyPhoto']").prettyPhoto({ 
			animationSpeed: 'normal', 		/* fast/slow/normal */
			padding: 40, 					/* padding for each side of the picture */
			opacity: 0.35, 					/* Value betwee 0 and 1 */
			showTitle: false, 				/* true/false */
			allowresize: false, 			/* true/false */
			counter_separator_label: ' of ', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'light_rounded' 			/* light_rounded / dark_rounded / light_square / dark_square */
		});
});
// end of pretty photo

jQuery(document).ready(function(){	
		var prev='';
		
		   // Contact Form Submit Form Validations
   jQuery("#contactSubmit").click(function() {	submitContactForm(); });
		
		   /* Left News Pagination */
		   if(document.getElementById("newsList"))
		   {
				pager2 = new Pager('newsList', 3); 
				
				pager2.init(); 
				
				pager2.showPageNav('pager2', 'NewsPageNavigation'); 
				
				 pager2.showPage(1);	
        }
});
	//end of lavalamp effect

// 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 searchDisplayDivId = '';



// validated, Submit Contact Form
function submitContactForm()
{
		
		// Check for Empty
		w3isEmpty("contactName","","");
		w3isEmpty("contactName1","","");
		w3isEmpty("contactPhone","","");
		w3isEmpty("contactEmail","","");
			
		// For Invalid Email id, display text message
		w3isEmail("contactEmail","contactEmail_err","e-mail is niet geldig");
		w3isTelephone("contactPhone","contactTelephone_err","please enter valid phone");
		//alert(globalErr);
		if (globalErr==1)
		{
			hideform("contactErrorMessage");
			showform("contactFormLoader");
			
			jQuery.ajax(
			{    
				type: "post", 
				url: "_includes/_emails/contactSendMail.php", 
				data: jQuery("#contactForm").serialize(),
				success: function(msg)
				{ 	
					//alert(msg);	
					hideform("contactFormLoader");
					showform("contactFormMessage");
					// Clear the Form Values
					contactFormReset();
									
				 } 
	
			 });// End of Request 	
	
		}
		else
		{
			
			showform("contactErrorMessage");
			
		}
	
		globalErr = "1"; // reset to no error

		
}



// Clear the Contact Form Field Values
function contactFormReset()
{
	//alert(jQuery("#contactName").value);
	//jQuery("#"+id).click();
	document.contactForm.reset();
	
}

//clear clearSearchForm
function clearSearchForm()
{
	// Empty the Textbox
	jQuery("#sKey").attr("value","");
	
	// call the search to update the search key
	 submitSearchForm('searchClearClear');
	 
	 if (searchDisplayType=="overlay")
	 {
	 	if (!jQuery("#"+searchDisplayType).hasClass("hide")) 
	 		jQuery("#"+searchDisplayType).addClass("hide");
	 }
}

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

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




