  /******************************/
 /*********Slide Right Wrapper ****/
/******************************/

var slideAction = 'stop';
var intervalID = 0;
function slideRightWrapper(action){
	slideAction = action;
	
	if(action=='up' || action=='down'){
		intervalID = setInterval("slideRight();",15);
	}
	if(action=='stop'){
		clearInterval(intervalID);
	}
}
function slideRight(){
	var rW = getElement('rightScrollWrapper');
	if(slideAction == 'down'){
		rW.style.marginTop = (parseInt(rW.style.marginTop.substr(0,(rW.style.marginTop.length-2))) - 15) + "px";
	}
	if(slideAction == 'up'){
		rW.style.marginTop = (parseInt(rW.style.marginTop.substr(0,(rW.style.marginTop.length-2))) + 15) + "px";
	}
}



//*********************
//Check Input Fields
//*********************

/* functie die middels een array van id's checkt of er iets  in staat zo ja dan gaat de callback in werkeing
	 vb <a href="#" onclick="return checkFields(
		[
		 {'id':'bedrijfsnaam','nA':'Bedrijfsnaam *'},
		 {'id':'contactpersoon','nA':'Contactpersoon *'},
		 {'id':'e-mail','nA':'E-mail *'}
		 ],
		'document.forms.contact.submit();');" class="redarrow">Verzenden</a>
	 dus checkFields(array, callback)
	 */
	function checkFields(idArray, callback){
		var ok = true;
		for(i=0; i<idArray.length; i++){
			if(document.getElementById(idArray[i]['id'])){
				if(document.getElementById(idArray[i]['id']).value.length == 0 || document.getElementById(idArray[i]['id']).value == idArray[i]['nA']){
					ok = false;
				}
			}
		}
		if(ok){
			eval(callback);
		}else{
			alert('U heeft niet alles goed ingevuld!');	
		}
		return false;
	}

//************************
//* Input field onBlur
//************************

function inpFocus(obj, stdText) {
 if (obj.value == stdText) {
    obj.value = '';
 }
}

function inpBlur(obj, stdText) {
 if (obj.value == '') {
    obj.value = stdText;
 }
} 


//*********************
//Sidebars 100% + scrollbar
//*********************
function SetDivSizes(){

	var theheight = getPageHeight();
	var thewidth = document.body.scrollWidth;
//minimale hoogte
	if (theheight < 500){
		theheight = 500; 
		document.body.scroll="yes";
	}
	else{
		document.body.scroll="no";
	} 
//Background
	document.getElementById('pageBackground').style.height = theheight+"px" ;
//Centreer routerplanner Div
	document.getElementById('plannerHolder').style.marginTop= ((theheight-400)/2)+"px";
	document.getElementById('plannerHolder').style.marginLeft= ((thewidth-800)/2)+"px";
//Sidepanels
	document.getElementById('sbLbackground').style.height = theheight+"px" ;
	if(document.getElementById('invisibleRight')){
		document.getElementById('invisibleRight').style.height = theheight+"px" ;
	}
	if(document.getElementById('sbRbackground')){
		document.getElementById('sbRbackground').style.height = theheight+"px" ;
	}
}

//*********************
//Rollover homepage
//*********************

function doOver(id,url){
	object = document.getElementById(id);
	object.src=url ;

	}

//*********************
// Toon rollover
//*********************

function showSub(item,status){

obj = document.getElementById(item);

if (status == 'on'){obj.style.display = 'block';}
else{obj.style.display = 'none';}
}

function togglePanels(){
	var left = getElement('sidebarLeft');
	if(left.style.left != '-301px'){
		$("#sidebarLeft").animate({ left : "-301px"}, 500 );
	}else{
		$("#sidebarLeft").animate({ left : "0px"}, 500 );
	}	

}

//*********************
// Slidepanel LINKS
//*********************
function slidepanelleft() {
		var $lefty = $('#leftSlideTrigger').next();
		$lefty.animate({
			left: parseInt($lefty.css('left'),10) == 0 ?
				(-$lefty.outerWidth()+59) :
				0
		});
}

//*********************
// Slidepanel RECHTS
//*********************
	// sidebar laten scrollen
	function sidebarClick(arrow){
		var sb = document.getElementById('rightSlideTrigger');
		if(sb.style.marginRight == "-118px" || sb.style.marginRight == ""){
			$("#rightSlideTrigger").animate({ 
				marginRight: "0px"
			  }, 500 );
			arrow.className = "active";
		}else{
			$("#rightSlideTrigger").animate({ 
				marginRight: "-118px"
			  }, 500 );
			arrow.className = "arrow";
		}		
	}
	// hulpfuncties
	function getPageHeight() {
		if (window.innerHeight && window.scrollMaxY) { // Firefox
			yWithScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
			yWithScroll = document.body.scrollHeight;
		} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
			yWithScroll = document.body.offsetHeight;
		}
		return yWithScroll;
	}


function is4_setSelected(selectId, selectVal) {
   var selectList;
   var retVal = 0;
   if (selectId) {
      selectList = document.getElementById(selectId);
   }
   if (selectList) {
         var optList = selectList.options;
         for(o = 1; o < optList.length && !retVal; o++) {
             if (optList[o].value == selectVal) {
                     optList[o].selected = true;
                     retVal = 1;
             }
         }
   }
   return retVal;
}