﻿// JScript File
var _skin="http://dev1.hotelaka.com/common/flash/SteelOverAll.swf";
var objLogo;
var objLogoPos;

var twLogo;
var twLogoAlpha;

var objHeader;
var oldColor = "07A9EC";
var twP, twC, twS;


function hideSections(){
    objHeader.style.backgroundColor="#"+oldColor;
    var top = parseInt(objSections.style.top);
    var end = (top==-55) ? 110 : -55;
    if(top==-55 || top==110){
        for(var i=1;i<5;i++){
            var s=document.getElementById("s"+i).style;
            s.height="54px";
        }
        var t = new Tween(objSections.style,"top",Tween.strongEaseOut,parseInt(objSections.style.top),end,2,"px"); 
        t.start();
    }
}

function moveSection(index, height, newColor){
    var section = document.getElementById("s"+index);
    var sectionHeight = (section.style.height=="") ? 54 : parseInt(section.style.height);
    var newHeight = (sectionHeight==54) ? height : 54;
    
    objHeader.style.backgroundColor="transparent";
    if(sectionHeight==54 || sectionHeight==height){
        var t = new Tween(section.style,"height",Tween.strongEaseOut,sectionHeight,newHeight,2,"px"); 
        t.start();
        
        if(index==1){                    
            twP = new ColorTween(document.body.style, 'backgroundColor', Tween.strongEaseOut, oldColor, newColor, 2);
            twP.start();
        }else if(index==2){
            twC = new ColorTween(document.body.style, 'backgroundColor', Tween.strongEaseOut, oldColor, newColor, 2);
            twC.start();                
        }else if(index==3){
            twS = new ColorTween(document.body.style, 'backgroundColor', Tween.strongEaseOut, oldColor, newColor, 2);
            twS.start();                
        }
        oldColor = newColor;
    }
}

//window.onload = function(){

 //   alert("onload");
    //objSections = document.getElementById("sections");
    //objHeader = document.getElementById("header");
    //var t = new Tween(objSections.style,"top",Tween.strongEaseOut,-55,110,2,"px"); 
    //t.start();
//}


function animInit(){
	
    //twLogoAlpha = new OpacityTween(objLogo,Tween.regularEaseOut, 0, 100, 4);
    //twLogoAlpha.start()
	timerID  = setTimeout("animObjects()", 100);
	
//	if(document.getElementById("WordOfMouth") != null)
//		document.getElementById("lnk0").setAttribute("class", "selected");
}

function animObjects(){
	timerID = 0;
	var initPos = parseInt(document.getElementById("divLogoPos").innerHTML);
	var bodyCopyText = document.getElementById("bodyCopyText");
	var encloseHome = document.getElementById("encloseHome");
    objLogo = document.getElementById("mainBannerLogo");
    objLogo.style.top = initPos+"px";
    //twLogo = new Tween(objLogo.style, "top", Tween.strongEaseOut, 300, initPos, 4, "px");
    //twLogo.start();
	
	var my_seq = new Sequence();
	if(encloseHome!=null) my_seq.addChild(new Tween(encloseHome.style,"width",Tween.strongEaseOut,100,0,2,"%"));
	my_seq.addChild(new OpacityTween(bodyCopyText,Tween.regularEaseOut, 0, 100, 1));
	my_seq.addChild(new OpacityTween(objLogo,Tween.regularEaseOut, 0, 100, 1));
	if(encloseHome!=null){
		my_seq.onMotionFinished = function(){
			doReplaceSifr();	
		}
	}
	my_seq.start()	
}

function moveLogo(x){

    //var args = x.split("?l=");
	
	//if(args[1]!=null){
	document.getElementById("locations").style.display="block";
	document.getElementById("l"+x).style.visibility = "visible";
	
    //twLogo.stop();
    //twLogo = new Tween(objLogo.style, "top", Tween.strongEaseOut, parseInt(objLogo.style.top), args[1], 1, "px");
    //twLogo.start();
	//}
}

function moveLogoOut(x){
	//var args = x.split("?l=");
	//if(args[1]!=null)
	document.getElementById("locations").style.display="none";
	document.getElementById("l"+x).style.visibility = "hidden";
}

//Image Over

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//Thumbs
var imageIndex=1;
var toggle=true;
var timerID = 0;

function loadPhoto(path){
    var photoHolder = document.getElementById("mainPhoto");
    if(document.getElementById('img_1')==null){
        var img = (document.getElementById("overViewPhoto")==null) ? path : document.getElementById("overViewPhoto").src;
        var str = "";
		str += (navigator.appVersion.indexOf("MSIE")!=-1) ? "<div>" : "<div style='margin-left:0px;'>" ; 
		str += "<div style=\"position:absolute;z-index:1\" id=\"div1\"><img id=\"img_1\" src=\"\" style='filter:Alpha(opacity=100);'/></div>";
	    str += "<div style=\"position:absolute;z-index:2\" id=\"div2\"><img id=\"img_2\" src=\""+img+"\" style='filter:Alpha(opacity=100);'/></div>";
		str += "</div>";
        photoHolder.innerHTML = str;
    }
    popNextImage(path);
}


    
function nextImage(){
    if(toggle){
	    opacityTween = new OpacityTween(document.getElementById('img_1'),Tween.regularEaseOut, 100, 0, 1);
	    opacityTween2 = new OpacityTween(document.getElementById('img_2'),Tween.regularEaseOut, 0, 100, 1);
    }else{
    
	    opacityTween = new OpacityTween(document.getElementById('img_2'),Tween.regularEaseOut, 100, 0, 1);	
	    opacityTween2 = new OpacityTween(document.getElementById('img_1'),Tween.regularEaseOut, 0, 100, 1);
    }
    opacityTween.start();
    opacityTween2.start();
}

function popNextImage(path){
    var d = document.getElementById("div1");
    var img;
    if(toggle){
	    img = document.getElementById("img_1");
	    d.style.zIndex = "3";
	    toggle=false;	
    }else{
	    img = document.getElementById("img_2");
	    d.style.zIndex = "0";
	    toggle=true;
    }
	
    img.src = path;	
    img.style['opacity'] = 0;
    img.style['-moz-opacity'] = 0;
    img.onload = function(){
        nextImage();
        imageIndex=2;
        //timerID  = setTimeout("nextImage()", 1000);
    }
    if(img.filters) img.filters.alpha['opacity'] = 0;	
}


//Home Slide Show
//var nArr = new Array("ss1.jpg","ss2.jpg","ss3.jpg","ss4.jpg","ss5.jpg","ss6.jpg","ss7.jpg","ss8.jpg","ss9.jpg");
//var imgPath = "images/slideshow/";   

    
    function nextImageH(){
        clearTimeout(timerID);
        timerID  = 0;
    
	    document.getElementById("mainPhoto").style.cursor="wait";
	    document.getElementById("mainPhoto").onclick=null;
	    if(toggle){
		    opacityTween = new OpacityTween(document.getElementById('img_1'),Tween.regularEaseOut, 100, 0, 1);
	    }else{
		    opacityTween = new OpacityTween(document.getElementById('img_2'),Tween.regularEaseOut, 100, 0, 1);	
	    }
	    opacityTween.onMotionFinished = function(){popNextImageH()};
	    opacityTween.start();
	    imageIndex++;
    	
	    if(imageIndex>=nArr.length)imageIndex=0;	
    }

    function popNextImageH(){
	    document.getElementById("mainPhoto").style.cursor="pointer";
	    document.getElementById("mainPhoto").onclick=nextImageH;
	    var d = document.getElementById("div1");
	    var img;
	    if(toggle){
		    img = document.getElementById("img_1");
		    d.style.zIndex = "0";
		    toggle=false;	
	    }else{
		    img = document.getElementById("img_2");
		    d.style.zIndex = "2";
		    toggle=true;
	    }
    	
	    img.src = imgPath+nArr[imageIndex];	
	    img.style['opacity'] = 100;
	    img.style['-moz-opacity'] = 100;
	    img.onload = function(){
			//alert("popNextImageH");
	        timerID  = setTimeout("nextImageH()", 3000);
	    }
	    if(img.filters) img.filters.alpha['opacity'] = 100;	
    }
    
    function newWindow(url, height, width) 
	{
		nameW='rules'
		if (navigator.appVersion.indexOf('4') != -1) {
			// Vars for centering the new window on Version 4 Browsers
			xTop = screen.width/2 - (width/2);
			yTop = screen.height/2 - (height/2);
			window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=' + xTop + ',top=' + yTop + '');
		} 
		else {
			window.open(url, nameW, 'height='+height+',width='+width+',scrollbars=0,resizable=0,menubar=0,toolbar=0,status=0,location=0,directories=0,left=150,top=200');
		}
	}    
    
