function getElementPosition(e){
	var o={x:0,y:0};
	while(e){
		o.y+=e.offsetTop;
		o.x+=e.offsetLeft;
		e=e.offsetParent;
	}
	return o;
}
function positionPin(p,px,py) {
	if(p && px>0 && py>0) {
		p.style.left=px-5+'px';
		p.style.top=py-5+'px';
		p.style.zIndex=99;
		p.style.visibility='visible';
 	}
}
function positionPins() {
	var map=document.getElementById('map');
	if(map) {
		var mapc=getElementPosition(map);
		var i=1,p;
		while(p=document.getElementById('pin-'+i)) {
			var c=document.getElementById('pin-pos-'+i).title.split('_');
			c[0]=c[0]*map.width;
			c[1]=c[1]*map.height;
			var x=parseInt(c[0])+parseInt(mapc.x);
			var y=parseInt(c[1])+parseInt(mapc.y);
			positionPin(p,x,y);
			i++;
		}
	}
}
function showPinDetails(pin) {
	var p=document.getElementById(pin);
	var i=document.getElementById('image-'+pin);
	p.style.width='192px';
	p.style.height='auto';
	p.style.zIndex=100;
	if(i.src=='http://media.venturevancouver.com/brown-gem.png') i.src='http://media.venturevancouver.com/green-gem.png';
}
function hidePinDetails(pin) {
	var p=document.getElementById(pin);
	var i=document.getElementById('image-'+pin);
	p.style.width='18px';
	p.style.height='12px';
	p.style.zIndex=99;
	if(i.src=='http://media.venturevancouver.com/green-gem.png') i.src='http://media.venturevancouver.com/brown-gem.png';
}
function pinBoxMessage(path) {
	if(navigator.appName == 'Microsoft Internet Explorer') {
		document.write('Click the pin to view photos, maps, hours &amp; rates');
	} else {
		document.write('<a class="pinBoxLink" href="' + path + '">Click here to view photos, maps, hours &amp; rates</a>');														
	}
}
