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 addInterest(type,id,details,bpv){
	if(document.getElementById("addbutval_"+type+"_"+id).value == 0){

		if(document.getElementById("nintdisp")){
			var amount = document.getElementById("nintdisp").innerHTML;
			document.getElementById("nintdisp").innerHTML = parseFloat(amount)+1;
			document.getElementById("intbutton").style.display = "";
		}else{
			var amount = document.getElementById("nintdisp_header").innerHTML;
		}
		document.getElementById("nintdisp_header").innerHTML = parseFloat(amount)+1;
		document.getElementById("addbutval_"+type+"_"+id).value = 1;
		document.getElementById("intbutton_header").style.display = "";
		if(details == 1){
			document.getElementById("addbut_"+type+"_"+id).className = "dt_interest_button_added";
		}else{
			if(type=="used" || bpv == 1){
				document.getElementById("addbut_"+type+"_"+id).src = "http://www.kent-vauxhall.co.uk/images/but-res-addedlist.gif";
			}else{
				document.getElementById("addbut_"+type+"_"+id).src = "/images/but-res-addedlist.gif";
			}
			document.getElementById("addbut_"+type+"_"+id).className = "";
		}
		frames["interestlistframe"].location.href = "/interest_add.php?type="+type+"&id="+id;
	}
}

function removeInterest(type,id){
	temp = window.confirm("Are you sure you want to remove this vehicle from your Interest List?");
	if (temp == true){
		document.getElementById("introw_"+type+"_"+id).style.display = "none";
        var amount = document.getElementById("nintdisp").innerHTML;
		document.getElementById("nintdisp").innerHTML = parseFloat(amount)-1;
		if(document.getElementById("nintdisp").innerHTML == 0){
			document.getElementById("inticons").style.display = "none";
		}
		frames["interestlistframe"].location.href = "/interest_add.php?type="+type+"&id="+id+"&remove=1";
		window.opener.location.reload(true);
	}
}

function clearInterest(){
    temp = window.confirm("Are you sure you want to clear your whole Interest List?");
	if (temp == true){
		window.location = "/interest_add.php?clear=1";
	}
}

function openInterest(url){
	window.opener.location.href=url;
	window.opener.focus();
}