// JavaScript Document LeasPlan Occasions


// Setting height of right collum if its there
function setRightColHeight() {
	if(document.getElementById('rightCol') != null) {
		var hL = document.getElementById('leftCol').offsetHeight;
		if(document.getElementById('content').offsetHeight > hL) {
			hL = document.getElementById('content').offsetHeight;
		}
		document.getElementById('rightCol').style.height = hL + "px";
	}
}

window.onload = setRightColHeight;


// DETAIL scripts
function goDetail(dir) {
	var sid; 
	if(dir == -1) {
		if(curCar > 0) {
			sid = sids[curCar-1];
			detail_form.curIndex.value = curCar-1;
			detail_form.sid.value      = sid;
			detail_form.submit();
		}
	} else {
		if(curCar < sids.length-1) {
			sid = sids[curCar+1];
			detail_form.curIndex.value = curCar+1;
			detail_form.sid.value      = sid;
			detail_form.submit();
		}
	}
}

function formatNumber(type, str) {
	var nr = "";
	if(type == "cur") {
		tmpArr = str.split(".");
		_str   = tmpArr[0].toString();
		nr     = _str.substr(0, _str.length-3) + "." + _str.substr(_str.length-3, _str.length);
	}
	if(type == "mile") {
		_str   = String(str);
		nr     = _str.substr(0, _str.length-3) + "." + _str.substr(_str.length-3, _str.length);
	}
	
	return nr;
}

function openBig(fileName, start) {
	Slimbox.open(fileName, start);
}

function sendCar(ref) {
	var str     = "toolbar=no,status=no,menubar=no,location=no,scrollbars=yes,resizable=yes,height=320,width=500"
	var dataURL = "http://www.leaseplan.nl/occasions/detail-gevonden-occasion.asp?sid=" + ref;
	var url     = "tell_a_friend.asp?page=" + dataURL;
	tellaFriend = window.open(url, "TellObj", str);
    tellaFriend.opener = top;
}

