﻿function pageInitialize() {
	
	// Handle clear value
	handleClearValue();
	
	// Handle Slickbox
	handleSlickbox();
	
	// Handle timeout on drop-down menu
	handleDropDown();
	
	// Handle tabs in left-sidebar
	$(".tabsContainer").pmTabs();
	
}
	
	// Apply clear value on unput focus
	function handleClearValue() {
	$(".clear-value").each(function() {
        var default_value = this.value;
	        $(this).focus(function() {
	            if(this.value == default_value) {
	                this.value = '';
	            }
	        });
	        $(this).blur(function() {
	            if(this.value == '') {
	                this.value = default_value;
	            }
	        });
	    });
	}
	
	// Apply Slickbox on language-bar
	function handleSlickbox() {
	// hides the slickbox as soon as the DOM is ready
	$('#slickbox').hide();
	 
	 // toggles the slickbox on clicking the noted link  
	 $('.slick-toggle').click(function() {
		$('#slickbox').slideToggle(400);
		$(this).toggleClass('close');
		return false;
	 });
	}
	
	
	// Apply timeout on drop-down menu
	function handleDropDown() {
	  
	  $("ul#navigation li").hover(function() {
		var timeout = $(this).data("timeout");
		if(timeout) clearTimeout(timeout);
		$(this).find("ul.subnav").slideDown('fast');
	  },
	  
	  function() {
		  $(this).data("timeout", setTimeout($.proxy(function() {
			  $(this).find("ul.subnav").slideUp();
		  }, this), 300));
	  });
		  
	  $(document).click(function() {
		  $('ul.subnav:visible').hide();
	  });
	 }

	



			
	

	

	

                     
	
	
	
	


