function sendPic(picture)
	{
	ext = 'width=620,height=680,top=0'
	ur = 'sendpic2.php?p='+picture
	send = window.open(ur,'Send',ext);
	
    //alert(picture);
	}
//=======================================================================	
function printPic(picture)
	{
	//alert(picture)
	ext = 'width=620,height=530,top=10'
	ur = 'printpic.php?p='+picture
	send = window.open(ur,'Print',ext);
	}
//=======================================================================	
function WisselKleur(what,onoff,kleur)
	{
	if (onoff == 1) what.style.backgroundColor = kleur;
	if (onoff == 0) what.style.backgroundColor = '';
	}
	
//=======================================================================	
function upd_pict(nr)
{
document.getElementById('mainpic').src = '../upload/'+nr;

}
//=======================================================================	
function bigger()
{
document.getElementById('picture').style.display = 'block';
}	
//=======================================================================
function closediv()
{
document.getElementById('picture').style.display = 'none';
}
//=======================================================================
function CheckEmpty(what)
{
if (what == "") return false;
else return true;
}
//=======================================================================
function PrintCar(id)
{
url = 'printcar.php?id='+id;
ext = 'width=700, height=500';
w = window.open(url,'print',ext);
}
//=======================================================================
function ShowBigger(pic,w,h)
{
w = w + 20;
h = h + 60;

widthmid = screen.availWidth / 2;
heightmid = screen.availHeight / 2;
left = widthmid - (w / 2);
boven = heightmid - (h / 2);


ext = 'width='+w+',height='+h+',left='+left+',top='+boven;
url = '../upload/'+pic;
win = window.open('./xhtml/blank.html','',ext);
win.document.write('<body style="background-color:#EDF4D3;font-family:Verdana;font-size:11px;">');
win.document.write('<img src="'+url+'" border="1" style="border-color:#00432C;padding:2px;"><p />');
win.document.write('<div align="center"><a href="javascript:window.close();" style="color:#00432C;">Sluit venster</a></div>');
}
//=======================================================================
function sendLink(name, email)
{
url = 'sendlink.php?n='+name+'&e='+email;
ext = 'width=100,height=100';
wo = window.open(url,'send',ext);
wo.blur();
window.focus();
}
//=======================================================================
function formCheck(formobj){
	//1) Enter name of mandatory fields
	var fieldRequired = Array("Naam","Adres","Plaats","Telefoon");
	//2) Enter field description to appear in the dialog box
	var fieldDescription = Array("Naam","Adres","Woonplaats","Telefoon");
	//3) Enter dialog message
	var alertMsg = "Wilt u de volgende velden a.u.b. invullen:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}


//=======================================================================
function formCheck2(formobj){
	//1) Enter name of mandatory fields
	var fieldRequired = Array("aanhef","initialen","achternaam","plaats","telefoon","email","merk", "model", "max_prijs");
	//2) Enter field description to appear in the dialog box1
	var fieldDescription = Array("Aanhef","Initialen","Achternaam","Plaats","Telefoon","E-mailadres","Merk", "Model", "Maximale prijs");
	//3) Enter dialog message
		var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}



