$(document).ready(handler)

function handler()
{
	initNewWindow();
	initCalender();
	// more functions
}

function initNewWindow()
{
	$("a.newwindow").each(function(index, value)
	{
		setNewWindow(value);
	})
}

function initCalender()
{
	$("input.datepicker").each(function(index, value)
	{		
		setDatePicker(value);
	})
}

function setDatePicker(obj)
{
	$(obj).datepicker(
		{
			dateFormat: 'dd-mm-yy',
			currentText: 'Vandaag',
			monthNames: ['januari', 'februari', 'maart', 'april', 'mei', 'juni','juli', 'augustus', 'september', 'oktober', 'november', 'december'],
			monthNamesShort: ['jan', 'feb', 'maa', 'apr', 'mei', 'jun','jul', 'aug', 'sep', 'okt', 'nov', 'dec'],
			dayNames: ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag'],
			dayNamesShort: ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat'],
			dayNamesMin: ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za'],
			yearRange:   'c-100:c+100',
			changeMonth: true,
			changeYear: true
		});
}

function setNewWindow(obj)
{
	setTitle(obj, 'opent in een nieuw venster'); 
	addNewWindowImage(obj);
	obj.onclick 	= newwin;	
}

function setTitle(obj, title)
{
	if(obj.getAttribute('title'))
		obj.setAttribute('title', obj.getAttribute('title') + ', ' + title);  
	else
		obj.setAttribute('title', title); 
}

function addNewWindowImage(obj)
{
	if(obj.innerHTML != '')
		obj.innerHTML 	= obj.innerHTML + '<img alt="(Deze link opent in een nieuw venster)" src="/style/images/newwindow.png">';
}

function match_value(value, value2)
{
	var pattern = new RegExp(value2);
	if (value.match(pattern))
		return true;		
	return false;
}

function newwin()
{	
	window.open(this.href,'Offerte', 'menubar=0, location=0, status=0, scrollbars=1, resizable=0, width=800, height=600');
	return false;
}


<!--
  conBrowser=0;
  function display(stuff) { window.status = stuff; }
//-->

<!--
  conBrowser=1;

  switch1on  = new Image(100,100);  switch1on.src  = '/style/images/buttons/button_offertes_on.gif';
  switch1off = new Image(100,100);  switch1off.src = '/style/images/buttons/button_offertes.gif';
  switch1sta = new Image(100,100);  switch1sta.src = '/style/images/buttons/button_offertes_on.gif';
  
  switch2on  = new Image(100,100);  switch2on.src  = '/style/images/buttons/button_demo_on.gif';
  switch2off = new Image(100,100);  switch2off.src = '/style/images/buttons/button_demo.gif';
  switch2sta = new Image(100,100);  switch2sta.src = '/style/images/buttons/button_demo_on.gif';  

  switch3on  = new Image(100,100);  switch3on.src  = '/style/images/buttons/button_contact2_on.gif';
  switch3off = new Image(100,100);  switch3off.src = '/style/images/buttons/button_contact2.gif';
  switch3sta = new Image(100,100);  switch3sta.src = '/style/images/buttons/button_contact2_on.gif'; 
  
  switch4on  = new Image(100,100);  switch4on.src  = '/style/images/buttons/button_contact_on.gif';
  switch4off = new Image(100,100);  switch4off.src = '/style/images/buttons/button_contact.gif';
  switch4sta = new Image(100,100);  switch4sta.src = '/style/images/buttons/button_contact_on.gif'; 

  switch5on  = new Image(100,100);  switch5on.src  = '/style/images/buttons/button_offertes_kl_on.gif';
  switch5off = new Image(100,100);  switch5off.src = '/style/images/buttons/button_offertes_kl.gif';
  switch5sta = new Image(100,100);  switch5sta.src = '/style/images/buttons/button_offertes_kl_on.gif'; 

  switch6on  = new Image(100,100);  switch6on.src  = '/style/images/buttons/button_demo_kl_on.gif';
  switch6off = new Image(100,100);  switch6off.src = '/style/images/buttons/button_demo_kl.gif';
  switch6sta = new Image(100,100);  switch6sta.src = '/style/images/buttons/button_demo_kl_on.gif'; 

  switch7on  = new Image(100,100);  switch7on.src  = '/style/images/buttons/button_contact2_kl_on.gif';
  switch7off = new Image(100,100);  switch7off.src = '/style/images/buttons/button_contact2_kl.gif';
  switch7sta = new Image(100,100);  switch7sta.src = '/style/images/buttons/button_contact2_kl_on.gif'; 

  switch8on  = new Image(100,100);  switch8on.src  = '/style/images/buttons/button_afsluiten_on.gif';
  switch8off = new Image(100,100);  switch8off.src = '/style/images/buttons/button_afsluiten.gif';
  switch8sta = new Image(100,100);  switch8sta.src = '/style/images/buttons/button_afsluiten_on.gif'; 
  
  switch9on  = new Image(100,100);  switch9on.src  = '/style/images/buttons/button_demo_scholen_on.gif';
  switch9off = new Image(100,100);  switch9off.src = '/style/images/buttons/button_demo_scholen.gif';
  switch9sta = new Image(100,100);  switch9sta.src = '/style/images/buttons/button_demo_scholen_on.gif'; 
  
  switch10on  = new Image(100,100);  switch10on.src  = '/style/images/buttons/button_contact2_on_scholen.gif';
  switch10off = new Image(100,100);  switch10off.src = '/style/images/buttons/button_contact2_scholen.gif';
  switch10sta = new Image(100,100);  switch10sta.src = '/style/images/buttons/button_contact2_on_scholen.gif'; 
  
  switch11on  = new Image(100,100);  switch11on.src  = '/style/images/buttons/button_offertes_on_scholen.gif';
  switch11off = new Image(100,100);  switch11off.src = '/style/images/buttons/button_offertes_scholen.gif';
  switch11sta = new Image(100,100);  switch11sta.src = '/style/images/buttons/button_offertes_on_scholen.gif';
  
  switch12on  = new Image(100,100);  switch12on.src  = '/style/images/buttons/button_contact_scholen_on.gif';
  switch12off = new Image(100,100);  switch12off.src = '/style/images/buttons/button_contact_scholen.gif';
  switch12sta = new Image(100,100);  switch12sta.src = '/style/images/buttons/button_contact_scholen_on.gif'; 


//-->

<!--

	var whichbutton = 0
	
  	function HighLight(musswitch) {
        if (conBrowser) {
                switchnavn = eval(musswitch + "on");
                document [musswitch].src = switchnavn.src;
                }
        }

	function UndoHighLight(musswitch) {
        if (conBrowser) {
                switchnavn = eval(musswitch + "off");
                document [musswitch].src = switchnavn.src;
                
				  }	
        }

	function Static(musswitch) {
        if (conBrowser) {
                switchnavn = eval(musswitch + "sta");
                document [musswitch].src = switchnavn.src;
				  }
        }

   function Change() {
	       if (conBrowser) {
				  if (whichbutton == 1) UndoHighLight('switch1');
				  if (whichbutton == 2) UndoHighLight('switch2');
				  if (whichbutton == 3) UndoHighLight('switch3');	
				  if (whichbutton == 4) UndoHighLight('switch4');
  				  if (whichbutton == 5) UndoHighLight('switch5');	
  				  if (whichbutton == 6) UndoHighLight('switch6');	
  				  if (whichbutton == 7) UndoHighLight('switch7');	
				  
				  if (whichbutton == 9) UndoHighLight('switch9');	
  				  if (whichbutton == 10) UndoHighLight('switch10');	
  				  if (whichbutton == 11) UndoHighLight('switch11');			  				  				  
  				  if (whichbutton == 12) UndoHighLight('switch12');			  				  				  
				  }
		 }
//-->

//function to display or hide a given element
function showHideItems(myItem, myLink){

var myItem = document.getElementById(myItem);

var myLink = document.getElementById(myLink);

	if (myItem.style.display != "none") {

		//items are currently displayed, so hide them
		myItem.style.display = "none";
		myLink.style.fontWeight= "normal";
	}
	else {

		//items are currently hidden, so display them
		myItem.style.display = "block";
		myLink.style.fontWeight= "bold";
	}
}


function ShowSegment(id)
{
	var i;
	for (i = 1; i < 7; i++)
	{
		document.getElementById("menu" + i).style.display = "none";
		document.getElementById("verzekering0").style.display = "none";
		document.getElementById("verzekering" + i).style.display = "none";
	}

	if (id.value)
	{
			document.getElementById("menu" + id.value).style.display = "block";
			document.getElementById("verzekering" + id.value).style.display = "block";
	}
	else
	{
		document.getElementById("menu1").style.display = "none";
		document.getElementById("verzekering1").style.display = "none";
		document.getElementById("verzekering0").style.display = "block";
	}

}

// open Questionnaires
function openQuestionnaire(quest)
{
	//window.open('/' + quest, 'Offerte', 'menubar=0, location=0, status=0, scrollbars=1, resizable=0, width=800, height=600');
	window.open('http://questionnaire.marshdirect-bizz.nl/' + quest, 'Offerte', 'menubar=0, location=0, status=0, scrollbars=1, resizable=0, width=800, height=600');
}

function openMelfidor(quest)
{
	//window.open('/questionnaires/marshdirect/' + quest + '.htm', 'Offerte', 'menubar=0, location=0, status=0, scrollbars=1, resizable=0, width=820, height=755');
	window.open('http://questionnaire.marshdirect-bizz.nl/questionnaires/marshdirect/' + quest + '.htm', 'Offerte', 'menubar=0, location=0, status=0, scrollbars=1, resizable=0, width=820, height=755');
}

/*
 * handleValue bekijkt de standaard waarde.
 * @param: obj  = object
 * @param: devv = default value
 */
function handleValue(obj, devv)
{
	if(obj.value == '')
		obj.value	= devv;
	else if(obj.value == devv)
		obj.value	= '';		
}

