  //variables
  var btn_active = '0';
  //functions  
  function setResolution() {
	w = window.screen.availWidth;
	h = window.screen.availHeight;
	window.resizeTo(w,h);
	window.moveTo(0,0);
	window.focus();
  }

  function writeEmailAddress(nme, dom, cou, cla){
           document.write("<a href='mailto:"+nme+"@"+dom+"."+cou+"' class="+cla+" >"+nme+"@"+dom+"."+cou+"</a>");
  }
  
  function changeTitle(tit){
			document.title = tit;
  }

 function changePhoto(img, btn_id){
	document.getElementById('btn'+btn_active).className="menulink";
	btn_active = btn_id;
	document.getElementById('btn'+btn_active).className="menulink_active";
	document.getElementById('photo').innerHTML='<img src="'+img+'" alt="" />';
	window.focus();
 }
 
 function hideDiv(id){
	document.getElementById(id).style.display="none";
 }
 
 function showDiv(id){
	document.getElementById(id).style.display="block";
 }
 
 function changeQuality(img, btn, btn_img, basepath){
	switch(btn){
		case 'original': document.getElementById('content_ref').innerHTML = 'F'; break;
		case 'v2': document.getElementById('content_ref').innerHTML = 'F2V'; break;
		case 'v4': document.getElementById('content_ref').innerHTML = 'F4V'; break;
		case 'shipdeck': document.getElementById('content_ref').innerHTML = 'FSV'; break;
		case '4vp': document.getElementById('content_ref').innerHTML = 'P4V'; break;
		default: document.getElementById('content_ref').innerHTML = 'F'; break;
	}
	document.getElementById('quality').src=img;
	//reset btns
	if(document.getElementById('original')){document.getElementById('original').src=basepath+'media/img/original_up.gif';};
	if(document.getElementById('v2')){document.getElementById('v2').src=basepath+'media/img/2v_up.gif';};
	if(document.getElementById('v4')){document.getElementById('v4').src=basepath+'media/img/4v_up.gif';};
	if(document.getElementById('shipdeck')){document.getElementById('shipdeck').src=basepath+'media/img/shipdeck_up.gif';};
	if(document.getElementById('v4p')){document.getElementById('v4').src=basepath+'media/img/4vp_up.gif';};
	//set btn active
	document.getElementById(btn).src=btn_img;
 }

 //another wonderfull script by Karel "bigger than Jesus" Bouvyn
  function setSize(minW, minH){
			if(document.body.clientHeight<minH){
				document.getElementById("flashcontent").style.height = minH-1+"px";
			} else {
				document.getElementById("flashcontent").style.height = "100%";
			}
			if(document.body.clientWidth<minW){
				document.getElementById("flashcontent").style.width = minW-1+"px";
			} else {		
				document.getElementById("flashcontent").style.width = "100%";
			}
			void(0);
  }
  
  
function checkvalues(){
	var naam = document.getElementById('naam');
	var straat = document.getElementById('straat');
	var postcode = document.getElementById('postcode');
	var plaats = document.getElementById('plaats');
	var land = document.getElementById('land');	
	var telefoon = document.getElementById('telefoon');
	var gsm = document.getElementById('gsm');
	var email = document.getElementById('email');
	var informed = document.getElementById('informed');
	var opmerking = document.getElementById('opmerking');

	
	//check naam	
	/*if(naam.value.length==0){
		window.alert("Fill in your name");
		return false;
	}
	//check straat
	if(straat.value.length==0){
		window.alert("Fill in your street and number");
		return false;
	}
	//check postcode
	if(postcode.value.length==0){
		window.alert("Fill in your postalcode");
		return false;
	}
	//check plaats
	if(plaats.value.length==0){
		window.alert("Fill in your city");
		return false;
	}
	//check land
	if(land.value.length == 0){
		window.alert("Fill in your country");
		return false;
	}
	//check telefoon
	if(telefoon.value.length==0){
		window.alert("Fill in your telephone number");
		return false
	}
	//check telefoon
	if(gsm.value.length==0){
		window.alert("Fill in your mobile number");
		return false
	}*/
	//check email
	if(!validMail(email.value)){
		window.alert("Fill in a correct mail adress");
		return false;
	}
	//check land
	if(land.value.length == 0){
		window.alert("Fill in your country");
		return false;
	}
	//check telefoon
	/*if(opmerking.value.length==0){
		window.alert("Fill in your message");
		return false
	}*/
	
	//submit	
	return true;
}

function checkDealervalues(){
	
	var naam = document.getElementById('naam');
	var straat = document.getElementById('straat');
	var postcode = document.getElementById('postcode');
	var plaats = document.getElementById('plaats');
	var land = document.getElementById('land');	
	var telefoon = document.getElementById('telefoon');
	var gsm = document.getElementById('gsm');
	var email = document.getElementById('email');
	var confirmmail = document.getElementById('confirmmail');
	var informed = document.getElementById('informed');
	var opmerking = document.getElementById('opmerking');

	/*/check naam
	if(naam.value.length==0){
		window.alert("Fill in your name");
		return false;
	}
	//check straat
	if(straat.value.length==0){
		window.alert("Fill in your street and number");
		return false;
	}
	//check postcode
	if(postcode.value.length==0){
		window.alert("Fill in your postalcode");
		return false;
	}
	//check plaats
	if(plaats.value.length==0){
		window.alert("Fill in your city");
		return false;
	}*/
	//check land
	if(land.value.length == 0){
		window.alert("Fill in your country");
		return false;
	}
	/*
	//check telefoon
	if(telefoon.value.length==0){
		window.alert("Fill in your telephone number");
		return false
	}
	//check telefoon
	if(gsm.value.length==0){
		window.alert("Fill in your mobile number");
		return false
	}*/
	//check email
	if(!validMail(email.value)){
		window.alert("Fill in a correct mail adress");
		return false;
	}
	//check mail
	if(email.value != confirmmail.value){
		window.alert("Email adressen komen niet overeen");
		return false;
	}
	/*/check telefoon
	if(opmerking.value.length==0){
		window.alert("Fill in your message");
		return false
	}*/
	
	//submit	
	return true;

}

function validMail(str){
	var at="@";
	var dot=".";
	var lat=str.indexOf(at);
	var lstr=str.length;
	var ldot=str.indexOf(dot);
	if(str.indexOf(at)==-1){return false;}
	if(str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){return false;}
	if(str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){return false;}
	if(str.indexOf(at,(lat+1))!=-1){return false;}
	if(str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){return false;}
	if(str.indexOf(dot,(lat+2))==-1){return false;}	
	if(str.indexOf(" ")!=-1){return false;}
	return true;		
}
