var laatsteActieveGeswitchte;



function init(){
	
}

function zetSwitchItemUit(id){
	if(id){
		document.getElementById('switch_a_'+id).style.display = 'none';
		document.getElementById('switch_b_'+id).style.display = 'none';
	}
	
		var IfrRef = document.getElementById('DivShim');
		IfrRef.style.display = "none";
}

function switchItems(id,actie){

	if(document.getElementById('switch_a_'+id).style.display == 'none' || document.getElementById('switch_a_'+id).style.display == ''){

		document.getElementById('switch_a_'+id).style.display = 'block';
		document.getElementById('switch_b_'+id).style.display = 'block';
	} else {
		document.getElementById('switch_a_'+id).style.display = 'none';
		document.getElementById('switch_b_'+id).style.display = 'none';
	}

	if(laatsteActieveGeswitchte != id){
		zetSwitchItemUit(laatsteActieveGeswitchte);
	}

	laatsteActieveGeswitchte = id;
		 
   	
   	var IfrRef = document.getElementById('DivShim');
   	var DivRef = document.getElementById('switch_b_'+id);
	IfrRef.style.width = DivRef.offsetWidth;
	IfrRef.style.height = DivRef.offsetHeight;
	
	IfrRef.style.top = DivRef.style.top;
	IfrRef.style.left = DivRef.style.left;
	
	IfrRef.style.top = '179px';
	IfrRef.style.marginLeft = '-372px';
	
	
	IfrRef.style.display = "block";
   
}



function somethingselected(oList){
	
	
	var curform = oList.form; // get the containing form
  	clearCombo(curform.land); // clear the downstream list
  	var newvalue = oList.name + "=" + oList.options[oList.selectedIndex].value;
	fillCombo(curform.land, newvalue); // fill the downstream list
	
}


function clearCombo(oList){
	
	for (var i = oList.options.length - 1; i >= 0; i--){
		oList.options[i] = null;
	}
  	
  	oList.selectedIndex = -1;
}


function fillCombo(oList, vValue){
	
	if (vValue != "" && assocArray[vValue]){
	
    	var arrX = assocArray[vValue];
    	
    	for (var i = 0; i < arrX.length; i = i + 2){
      		oList.options[oList.options.length] = new Option(arrX[i + 1], arrX[i]);
    	}
    	
	} else oList.options[0] = new Option("None found", "");
	
}

function check() {
	if(document.form.continent.value>0) {
		somethingselected(document.form.continent)
	}	
	
}

function getVar(name){
	get_string = document.location.search;         
	return_value = '';
	
	do { //This loop is made to catch all instances of any get variable.

	   name_index = get_string.indexOf(name + '=');
	   
	   if(name_index != -1){

	     get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index);
	     end_of_value = get_string.indexOf('&');
	     
	     if(end_of_value != -1) value = get_string.substr(0, end_of_value);                
	     else value = get_string;                
	       
	     if(return_value == '' || value == '') return_value += value;
	     else return_value += ', ' + value;
		}
	} while(name_index != -1)
	space = return_value.indexOf('+');
	while(space != -1){ 
		
	     return_value = return_value.substr(0, space) + ' ' + 
	     return_value.substr(space + 1, return_value.length);

	     space = return_value.indexOf('+');
	}

	return(return_value);
}

function SetCookie (name, value) {
        var argv = SetCookie.arguments;
        var argc = SetCookie.arguments.length;
        var expires = (argc > 2) ? argv[2] : null;
        var path = (argc > 3) ? argv[3] : null;
        var domain = (argc > 4) ? argv[4] : null;
        var secure = (argc > 5) ? argv[5] : false;
        document.cookie = name + "=" + escape (value) +
                ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
                ((path == null) ? "" : ("; path=" + path)) +
                ((domain == null) ? "" : ("; domain=" + domain)) +
                ((secure == true) ? "; secure" : "");
	return;
}

function zetKoek(uid){
	if (uid != null) {
		pathname = location.pathname;
		myDomain = pathname.substring(0,pathname.lastIndexOf('/')) +'/';
		var largeExpDate = new Date ();
		largeExpDate.setTime(largeExpDate.getTime() + (60 * 60 * 24 * 30 * 1000)); // 60sec * 60min * 24uur * 30dg * 1000milisec
		SetCookie('uid['+cid+']',uid,largeExpDate,myDomain);
	}
	return;
}