/**************************************************************************
	AUTHOR:  Alan Fong @ 5176
	DATE:	 Aug10 - 07
	Tooltip 
	Parameter:  Message, 
				Objects(DIV,SPAN, TD), 
				Event(onmouseover-default), 
				Size (px)
***************************************************************************/


var doc;
var xsl;
var oVirtual;

var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all
var mid=0;
var flashID=12;

//=========================
function LoadVTDescriptions() {

     oVirtual = new VirtualTour();
     oVirtual.Initialize();
}

//=========================
function VirtualTour(){
	
	//IE
	if (window.ActiveXObject) 
	{ 
      doc = new ActiveXObject("MSXML2.DOMDocument");
      xsl = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
    }
   // code for Mozilla, firefox, Opera, etc. 
	else if (document.implementation && document.implementation.createDocument) 
	{ 
		 doc = document.implementation.createDocument("","",null);
		 xsl = document.implementation.createDocument("","",null);
    }
    
    this.Initialize = Initialize;
    return(this);
    function Initialize(){
        doc.async = false;
        doc.load("../360Videos/GetVirtualTour.aspx");
    }
}

//=====================================
function ietruebody(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

//=====================================
function getposOffset(what, offsettype){
		//var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
		var totaloffset = event.clientX+ietruebody().scrollLeft;
		var parentEl=what.offsetParent;
		while (parentEl!=null){
		//totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		totaloffset=(offsettype=="left")? event.clientX+ietruebody().scrollLeft : event.clientY+ietruebody().scrollTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

//===============================
function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

//==============================
function clearbrowseredge(obj, whichedge){

	var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
	if (whichedge=="rightedge"){
	var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
	dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
	if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
	edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
	var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
	dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
	if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
	edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
	}
	return edgeoffset
}

//===================================
function showhint(menucontents, obj, e, tipwidth, pic, dn){
	if ((ie||ns6) && document.getElementById("hintbox")){
		dropmenuobj=document.getElementById("hintbox")
		var node = doc.selectSingleNode("//Virtuals/Virtual[@vid='" + pic + "']/Descriptions")
		if (node){
		    menucontents = node.text
		}    
		dropmenuobj.innerHTML=menucontents
		dropmenuobj.style.left=dropmenuobj.style.top=-500
		if (tipwidth!=""){
			dropmenuobj.widthobj=dropmenuobj.style
			dropmenuobj.widthobj.width=tipwidth
		}
		
		dropmenuobj.x=getposOffset(obj, "left")
		dropmenuobj.y=getposOffset(obj, "top")
		
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
		dropmenuobj.style.visibility="visible"
		obj.onmouseout=hidetip
		//Show Picture & clear description
		if ( dn == "1"){
		    var daynode = doc.selectSingleNode("//Virtuals/Virtual[@vid='" + pic + "']/DayLink")
		    dropmenuobj.innerHTML = menucontents + "<img src='" + daynode.text + "' height=100, width=100 />"
		}else{
		     var nightnode = doc.selectSingleNode("//Virtuals/Virtual[@vid='" + pic + "']/NightLink")
		    dropmenuobj.innerHTML = menucontents + "<img src='" + nightnode.text + "' height=100, width=100 />"
		}
				
	}
}




function showmouseout()
{
     //document.getElementById("Picture").src = "../Images03/Initial.jpg" 
     document.getElementById("ContentID").style.visibility = "hidden";
}

//====================================
function hidetip(e){
	dropmenuobj.style.visibility="hidden"
	dropmenuobj.style.left="-500px"
}

//=======================================
function createhintbox(){
	var divblock=document.createElement("div")
	divblock.setAttribute("id", "hintbox")
	document.body.appendChild(divblock)
}

function ShowMap(pic,dn)
{
   //alert(dropmenuobj.x + ':' + dropmenuobj.y);
   if(pic == "1"){

	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1720&FlashID=1&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1720&FlashID=1&MID=14"
	    }       
	}else if(pic == "2"){

		    if (dn == "1"){
		        window.location = "NygardCay.aspx?id=1722&FlashID=2&MID=14"
		    }else{
		         window.location = "NygardCayNight.aspx?id=1722&FlashID=2&MID=14"
		    }      
	}else if(pic == "3"){
//	    document.getElementById("Picture").src = "../Images03/Temple_of_Jaguar.JPG"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1724&FlashID=3&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1724&FlashID=3&MID=14"
	    }       
	}else if(pic == "4"){
//	    document.getElementById("Picture").src = "../Images03/Cabana_Outside.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1726&FlashID=4&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1726&FlashID=4&MID=14"
	    }           
	}else if(pic == "5"){
//	    document.getElementById("Picture").src = "../Images03/BeachCabana.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1728&FlashID=5&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1728&FlashID=5&MID=14"
	    }          
	}else if(pic == "6"){
//	    document.getElementById("Picture").src = "../Images03/BlueLagoon.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1730&FlashID=6&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1730&FlashID=6&MID=14"
	    }          
	}else if(pic == "7"){
//	    document.getElementById("Picture").src = "../Images03/Seascape.jpg" 
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1732&FlashID=7&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1732&FlashID=7&MID=14"
	    }         
	}else if(pic == "8"){
//	    document.getElementById("Picture").src = "../Images03/Celestial.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1734&FlashID=8&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1734&FlashID=8&MID=14"
	    }     
	}else if(pic == "10"){
//	    document.getElementById("Picture").src = "../Images03/NewTileWalkway.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1736&FlashID=10&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1736&FlashID=10&MID=14"
	    }          
	}else if(pic == "11"){
//	    document.getElementById("Picture").src = "../Images03/GrandHall.jpg"
	   if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1738&FlashID=11&MID=14";
	    }else{
	         window.location = "NygardCayNight.aspx?id=1738&FlashID=11&MID=14";
	    }          
	}else if(pic == "12"){  
//	    document.getElementById("Picture").src = "../Images03/ConversationRoom.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1710&FlashID=12&MID=14" 
	    }else{
	         window.location = "NygardCayNight.aspx?id=1710&FlashID=12&MID=14"
	    }        
	}else if(pic == "13"){
//	    document.getElementById("Picture").src = "../Images03/Bar.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1740&FlashID=13&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1740&FlashID=13&MID=14"
	    }          
	}else if(pic == "14"){
//	    document.getElementById("Picture").src = "../Images03/DiningArea.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1742&FlashID=14&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1742&FlashID=14&MID=14"
	    }          
	}else if(pic == "16"){
//	    document.getElementById("Picture").src = "../Images03/MorningRoom.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1744&FlashID=16&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1744&FlashID=16&MID=14"
	    }           
	}else if(pic == "18"){
//	    document.getElementById("Picture").src = "../Images03/Theatre.jpg"
	   if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1746&FlashID=18&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1746&FlashID=18&MID=14"
	    }               
	}else if(pic == "19"){
//	    document.getElementById("Picture").src = "../Images03/GrandHallStairs.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1748&FlashID=19&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1748&FlashID=19&MID=14"
	    }  
	}else if(pic == "20"){
//	    document.getElementById("Picture").src = "../Images03/Lagoon.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1750&FlashID=20&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1750&FlashID=20&MID=14"
	    }  
	}else if(pic == "21"){
//	    document.getElementById("Picture").src = "../Images03/SwimmingPool.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1752&FlashID=21&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1752&FlashID=21&MID=14"
	    }  
	}else if(pic == "22"){
//	    document.getElementById("Picture").src = "../Images03/Sunset.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1754&FlashID=22&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1754&FlashID=22&MID=14"
	    }  
	}else if(pic == "23"){
//	    document.getElementById("Picture").src = "../Images03/PoolBar.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1756&FlashID=23&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1756&FlashID=23&MID=14"
	    }      
	}else if(pic == "24"){
//	    document.getElementById("Picture").src = "../Images03/VolleyBallCourt.jpg"
	   if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1758&FlashID=24&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1758&FlashID=24&MID=14"
	    }  
	}else if(pic == "25"){
//	    document.getElementById("Picture").src = "../Images03/BoatBasin.jpg"
	   if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1712&FlashID=25&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1712&FlashID=25&MID=14"
	    }               
	}else if(pic == "26"){
//	    document.getElementById("Picture").src = "../Images03/Beach.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1808&FlashID=26&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1808&FlashID=26&MID=14"
	    }  
	}else if(pic == "28"){
//	    document.getElementById("Picture").src = "../Images03/Yacht.jpg" 
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1764&FlashID=28&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1764&FlashID=28&MID=14"
	    }  
	}else if(pic == "29"){
//	    document.getElementById("Picture").src = "../Images03/BeachSteps.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1714&FlashID=29&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1714&FlashID=29&MID=14"
	    }   
	}else if(pic == "30"){
//	    document.getElementById("Picture").src = "../Images03/BeachTip.jpg"
	    if (dn == "1"){
	        window.location = "NygardCay.aspx?id=1714&FlashID=30&MID=14"
	    }else{
	         window.location = "NygardCayNight.aspx?id=1714&FlashID=30&MID=14"
	    }         
	}                        

}



//=========================================
if (window.addEventListener)
	window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
	window.attachEvent("onload", createhintbox)
else if (document.getElementById)
	window.onload=createhintbox


