
	
	/*
	JavaScript Include

	Name:	 	: lv.js
	Address		: http://www2.leidschendam-voorburg.nl	
	Copyright	: Your Company Name
	Author	 	: Johan den Ouden
	Created	 	: 2009-11-10T12:04:32

	About this JavaScript include:
	...
*/

jQuery(document).ready(function() {
	//tablet addon
	jQuery('#menu li').click(
		function() {
			if(jQuery(this).hasClass("hover")) {
				jQuery(this).removeClass("hover")
			} else {
				jQuery(this).addClass("hover")
			}
		}
	);	

	
	jQuery('#wijzer a').click(function(event) {
		event.preventDefault();
		jQuery.get(this.href + '#content', function(data){
			jQuery("#extra_text").html(jQuery('div.item',data).text());
		});
	});

	jQuery("#print_button").click(function(event){
		event.preventDefault();
		window.print();
	});

	jQuery("#send_mail_page").validate({
	submitHandler: function() {
		jQuery("#send_mail_page").hide("slow");
		var querystring;
		var url;
		querystring = "&sender_name=" + escape(jQuery("#sender_name").val());
		querystring = querystring + "&sender_email=" + escape(jQuery("#sender_email").val());
		querystring = querystring + "&reciever_name=" + escape(jQuery("#reciever_name").val());
		querystring = querystring + "&reciever_email=" + escape(jQuery("#reciever_email").val());
		querystring = querystring + "&additional_text=" + escape(jQuery("#additional_text").val());
		querystring = querystring + "&itemcode=" + escape(jQuery("#itemcode").val());
		url="http://www2.leidschendam-voorburg.nl/smartsite.net?id=STUURDOOR" + querystring;
		jQuery("#mailboxcontent").load(url);
		jQuery("#mailboxcontent").show();
	}
	});

	jQuery(".validate").validate(); 


	jQuery("a[href^='http']").not("#wob_holder a").not(".noexternal a").not('.breadcrumbs li a').not(".logo a").addClass("externallink").communited_externallink();
	jQuery("a[href$='.doc'],  a[href$='.docx'],  a[href$='.pdf'],  a[href$='.xls'],  a[href$='.xlsx']").not("#wob_holder a").not(".noexternal a").not(".externallink").addClass("optieb").communited_externallink();

	jQuery(".noexternal a").addClass("optiec");
	clearInputs();
	jQuery("#emailpage").click(function () {
		jQuery("#sender_name").val("");
		jQuery("#sender_email").val("");
		jQuery("#reciever_name").val("");
		jQuery("#reciever_email").val("");
		jQuery("#additional_text").val("");
		jQuery("#send_mail_page").show();
		jQuery("#mailbox").show("slow");
	});
	jQuery("#closemailbox").click(function(){
		jQuery("#mailbox").hide("slow");
		jQuery("#mailboxcontent").hide();
	});

	jQuery("#button_clear_mail").click(function(ev){
		ev.preventDefault();
		jQuery("#sender_name").val("");
		jQuery("#sender_email").val("");
		jQuery("#reciever_name").val("");
		jQuery("#reciever_email").val("");
		jQuery("#additional_text").val("");
	});


	$.each($.browser, function(i, val) {
	if (i=="msie" && $.browser.version.substr(0,1)=="6" )
	{
	     jQuery("div #ie6message").show();
	 }
	});

	jQuery("#addPrikbord").click(function(event){jQuery("#prikbord").slideToggle();event.preventDefault();});
	jQuery(".sound").click(
		function(e) {
			e.preventDefault();
			var href=document.location.href;
			href=href.replace("http://");
			href=href.substr(href.indexOf('/'));
			href='http://www.leidschendam-voorburg.nl'+href;
			window.open("http://app.readspeaker.com/proreader/proreader.php?cid=5347&amp;lang=nl_nl&amp;url="+escape(href)+"&amp;selhtml="+escape(selectedString), "prwin", "width=190, height=120, resizable=1, scrollbars=1, screenX=0, screenY=0, left=0, top=0");
		}
	);

	jQuery(".int ul.ad a").click(
		function() {
			var t=jQuery("span", this).text();
			_gaq.push(['_trackEvent','LVhome','banners',t]);
		}
	);

});

/*--- clear inputs function ---*/
var searchvalue;
function clearInputs(){

/*
Communited PeterW 2010-12-13: code aangepast zodat deze alleen afgaat bij zoekbox ipv ALLE text inputs.
Het was met oud script niet mogelijk om normale formulieervelden leeg te maken: een NO-GO dus
*/

jQuery("input").focus(function(){jQuery(this).addClass("gotfocus")});
jQuery("input").blur(function(){jQuery(this).removeClass("gotfocus")});
	
	jQuery("#search").focus(function() {
		searchvalue = jQuery("#search").val();
		jQuery("#search").val("");
	});

	jQuery("#search").blur(function() {
		
		window.setTimeout(function(){jQuery("#search").val(searchvalue);}, 1000);
	});

/*
	var _list = document.getElementsByTagName('input');
	for(var i = 0; i  < _list.length; i++){
		if(_list[i].type == 'text' || _list[i].type == 'password'){
			_list[i].val = _list[i].value;
			_list[i].onfocus = function(){
				if(this.value == this.val) this.value = '';
			}
			_list[i].onblur = function(){
				if(this.value == '') this.value = this.val;
			}
		}
	}
*/
}

