function openWin(url,w,h,s){
	var l=(screen.width-w)/2;
	var t=(screen.height-h)/2;

	if(window.thiswin != undefined){
		thiswin.close();
	}
	thiswin = window.open(url,"popupwin",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars='+s+',resizable=0,width='+w+',height='+h+',left='+l+',top='+t);
}

function changeThumb(img){
	for(var i=1;i<=4;i++){
		document.getElementById("new_image_"+i).style.display="none";
	}
	if(img != 0){
		document.getElementById("new_image_"+img).style.display="";
	}
}

function viewImage(id,img,enq_type){
	var w=850;
	var h=700;
    var l=(screen.width-w)/2;
	var t=(screen.height-h)/2;

	if(window.thiswin != undefined){
		thiswin.close();
	}
	thiswin = window.open("/enlarge_images.php?id="+id+"&num="+img+"&enq_type="+enq_type,"popupwin",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width='+w+',height='+h+',left='+l+',top='+t);
}

function checkDelete(url,desc) {
	temp = window.confirm("Are you sure you want to delete "+desc+"?");
	if (temp == true){
		window.location=url;
	}
}

function showHideDisplay(id,display){
    if(display == 1){
		document.getElementById(id).style.display = "";
	}else{
		document.getElementById(id).style.display = "none";
	}
}

function sendtofriend(vehicle,enq_type){
    var w=430;
	var h=255;
    var l=(screen.width-w)/2;
	var t=(screen.height-h)/2;
	if(window.fuelwin != undefined){
		fuelwin.close();
	}
	fuelwin = window.open("/enquiry/sendtofriend.php?reg="+vehicle+"&enq_type="+enq_type+"","popupwin",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+w+',height='+h+',left='+l+',top='+t);
}

function getDirections(id){
	if(document.getElementById("yourpostcode"+id).value==""){
		window.alert("Please enter your postcode!");
		document.getElementById("yourpostcode"+id).focus();
	}else{
		window.open("http://www.google.co.uk/maps?f=d&source=s_d&saddr="+document.getElementById("yourpostcode"+id).value+"&daddr="+document.getElementById("destpostcode"+id).value+"&hl=en&geocode=&mra=ls&sll=53.800651,-4.042969&sspn=18.388688,38.100586&ie=UTF8&t=h&z=7","openDirWin","width="+screen.width+",height="+screen.height+",menubar=1,resizable=1,location=1,status=1,scrollbars=1,toolbar=1");
	}
}

function homepopDisplay(){
	var thisheight = document.getElementById("homepopwindowcont").offsetHeight;
	document.getElementById("homepop_shadowinner").style.height = (thisheight + 1) + "px";
	document.getElementById("homepopwin").style.visibility = "visible";
}
