var openWins = new Object();
function popWin(winURL, winAttribs, winName) {
	try { openWins[winName].close(); }
	catch(e) {}
	openWins[winName] = window.open(winURL, winName, winAttribs);
}

// Open pop-up for help info (add onclick="return infoWin(this);" to link)
function infoWin(objLink, winAttribs)
{
	if(!winAttribs)
	{
		winAttribs = 'width=600,height=600,scrollbars=1';
	}
	popWin(objLink.href, winAttribs, 'helpWin');
	return false;
}

// Add title lines to category drop-down ...
function addTitles(objSel) {
	with(objSel) {
		for(var i=0; i<options.length; i++) {
			with(options[i]) {
				if(value=='-' && text!='') {
					style.background = '#00B2E7';
					style.color = 'white';
				}
			}
		}
	}
}

// Cross-browser quirks-mode-corrected cursor position ...
var mouse_pos = {x:0,y:0};
function getCursorPosition(e) {
	if(document.all) {		
		mouse_pos.x = event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
		mouse_pos.y = event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	} else {
		mouse_pos.x = e.pageX;
		mouse_pos.y = e.pageY;
	}
//	window.status = "x:" + mouse_pos.x + ", y:"+mouse_pos.y;
}

// Start mouse tracking - stores co-ords in mouse_pos ...
function trackMouse() {
	if (!document.all) document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove = getCursorPosition;
}

// Find position of element relative to screen
function getPosition(obj) {
	var pos = {x:0,y:0};
	while(obj && obj.nodeName != "BODY")
	{
			pos.x += obj.offsetLeft;
			pos.y += obj.offsetTop;
			obj = obj.offsetParent;		
	}
	return pos;
}

// Function used as part of the email-hiding code
function getV(arr) {
	var str = "";
	for(var i=0; i<arr.length; i++) {
		str += "%" + arr[i];
	}
	return unescape(str);
}

/**
 *	Scripts for rental pages
 */

function help_mouseover(elLink, src)
{
    var img = elLink.getElementsByTagName('img')[0];
    var old_src = img.src;
    elLink.onmouseout = function() { img.src = old_src; };
    img.src = src;
}
