// JavaScript Document

var d=document;
d.Id=function(x){return this.getElementById(x)}
d.dE=d.documentElement;
var undefined='undefined';
/*** Get abs pos of top-left & bottom-right coords of nested obj ***/
/*var leftX=0; // left-most X pos of obj
var rightX=0; // right-most X pos of obj
var topY=0; // top-most Y pos of obj
var bottomY=0; // bottom-most Y pos of obj
function findPosXY(o){
	topY=0;
	leftX=0;
	if(o.offsetParent){
		leftX = parseInt(o.offsetLeft);
		topY = parseInt(o.offsetTop);
		while(o = o.offsetParent){
			topY+=parseInt(o.offsetTop);
			leftX+=parseInt(o.offsetLeft);
		}
	}
	else if(o.y){
		topY+=parseInt(o.y);
		leftX+=parseInt(o.x);
	}
}
function getRectCoords(o){
	findPosXY(d.Id(o));
	var w=parseInt(d.Id(o).offsetWidth);
	var h=parseInt(d.Id(o).offsetHeight);
	rightX=leftX+w;
	bottomY=topY+h;
}
function showLThumb(v_id,num){
	getRectCoords('mediumThumb_'+v_id);
	d.Id('lThumb').style.left=leftX+'px';
	if(d.Id('mediumThumb_'+v_id).getAttribute('title')=="notLastRow"){
		d.Id('lThumb').style.top=topY+'px';
	}else{
		d.Id('lThumb').style.top=(topY-210)+'px';
	}
	d.Id('lThumb').style.backgroundImage='url(\'images/inventory/'+v_id+'/'+num+'_l.jpg\')';
	d.Id('lThumb').style.visibility='visible';
}
function hideLThumb(){
	d.Id('lThumb').style.visibility='hidden';
}
function changeMThumb(v_id,num){
	d.Id('mediumThumb_'+v_id).setAttribute('src','images/inventory/'+v_id+'/'+num+'_m.jpg');
	d.Id('mediumThumb_'+v_id).onclick=function(){showLThumb(v_id,num);}
}
function sThumbOver(v_id,num){
	d.Id('smallThumb_'+v_id+'_0').onclick=function(){changeMThumb(v_id,num);}
}*/
function menuItemMouseEvents(id,url,imgOver,imgOut){
	d.Id(id).onclick=function(){d.location.href=url;}
	d.Id(id).onmouseover=function(){d.Id(id).style.backgroundImage='url('+imgOver+')';}
	d.Id(id).onmouseout=function(){d.Id(id).style.backgroundImage='url('+imgOut+')';}
}
function declareMenuEvents(curPage){
	var numMenuItems=8;
	var page=new Array();
	page.length=numMenuItems+1;
			page[1]='index.html';
			page[2]='accomm.php';
			page[3]='http://www.ichotelsgroup.com/h/d/hi/1/en/hotel/plmhi?_requestid=425840';
			page[4]='restaurant.php';
			page[5]='photo_gallery.php';
			page[6]='local.php';
			page[7]='career.php';
			page[8]='contact.php';
	for(i=1; i<numMenuItems+1; i++){
		if(curPage==i){
			d.Id('nav'+i).style.backgroundImage='url(images/nav'+i+'_over.jpg)';
		} else {
			menuItemMouseEvents('nav'+i,page[i],'images/nav'+i+'_over.jpg','images/nav'+i+'_norm.jpg');
		}
	}
}

// EMAIL FUNCTION

function JSMailTo(email_username,email_domain){
			var email_address=email_username+'@'+email_domain;
			document.write('<a href="mailto:'+email_address+'">'+email_address+'</a>');
}