/* =========================================================================

HOTELDDRAMA FUNCTIONS THAT ARE CALLED FROM HTML -> FLASH &
DATA BAR FUNCTION
	
============================================================================ */

//this function return to Flash ActiveX Object or Plugin depending upon browser
//it takes care for browser type and returns the proper reference.
//Accepts the id or name of <OBJECT> or <EMBED> tag respectively
//Taken from Colin Moock (http://www.moock.org) code base.
function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
	
  } else {
   return window.document[movieName]
  }
}


function createJSFCommunicatorObject(playerObj)
{
		//create an instance of JSFCommunicator, pass the flashMovie's reference
		//make sure flash object is loaded when you create this object with parameter otherwise
		//you can JSFCommunicator.setMovie(flashMovie) once flash object is loaded
		fc = new JSFCommunicator(playerObj);
}
function setReturnBtnImage(URL,returnPage,loc){

    bO  = new setImageURLObject(URL,returnPage,loc);
}

function fl_gotoLocation(loc, iURL)
{


    //call the goto function in the _global object 'goto' (goto.as)
    if (arguments.length==1){ 
    fc.callFunction("_level0","gotoLocation",loc);
    };
    
    fc.callFunction("_level0","gotoLocation",[loc, iURL]);
};
function fl_setNavButtonActive(index)
{
    //call the goto function in the _global object 'goto' (goto.as)
    //loc should be parsed as, "1_n" , where 1 is the location, and _n the first letter of the  direction (n,e,s,w)

    fc.callFunction("_level0","setNavButtonActive",index);
};
function fl_setButtonActive(type,name,bool)
{
    //call the goto function in the _global object 'goto' (goto.as)
    //loc should be parsed as, "1_n" , where 1 is the location, and _n the first letter of the  direction (n,e,s,w)

    fc.callFunction("_level0","setButtonActive",[type,name,bool]);
};
// this is a function to set the small navigation button set
function fl_setSmallNavButtonSet(wichSet)
{
    fc.callFunction("_level0","setSmallNavButtonSet",wichSet);
};
//AVATAR TEXT 
function fl_setAvatarTxt(a,b)
{
//cal this function in the avatarText.as -- loadTextInBalloon()
 fc.callFunction("_level0","fl_setAvatarTxt",[a,b]);
 
};

/* =========================================================================

SORTING FUNCTION (SORTS THE RESULT LISTS AND SETS THE CLASS OF THE DATABARS)
	
============================================================================ */

function setClass(ElementID,IframeName,IframeURL,ids) 
{
	var check=IframeURL.split("?").length;
	
	//Change class
	//if bar is clicked this bar should get a state and the rest should go to default
	for (var i=0; i<ids.length; i++)
	{
		if(ids[i]==ElementID)
		{
			var ActiveDataBar=document.getElementById(ids[i]).className;
			if(ActiveDataBar=='DataBar')
			{ 
				ActiveDataBar='DataBarDown'; 
				if(check>1){
					frames[IframeName].location.href=IframeURL+"&Order="+ElementID+"&Seq=DESC";
				} else {
					frames[IframeName].location.href=IframeURL+"?Order="+ElementID+"&Seq=DESC";
				}
			}
			else if(ActiveDataBar=='DataBarDown')
			{ 
				ActiveDataBar='DataBarUp'; 
				if(check>1){
					frames[IframeName].location.href=IframeURL+"&Order="+ElementID+"&Seq=ASC";
				} else {
					frames[IframeName].location.href=IframeURL+"?Order="+ElementID+"&Seq=ASC";
				}
			}
			else if(ActiveDataBar=='DataBarUp') 
			{ 
				ActiveDataBar='DataBarDown'; 
				if(check>1){
					frames[IframeName].location.href=IframeURL+"&Order="+ElementID+"&Seq=DESC";
				} else {
					frames[IframeName].location.href=IframeURL+"?Order="+ElementID+"&Seq=DESC";
				}
			}
			document.getElementById(ids[i]).className=ActiveDataBar;
		}
		else
		{
			document.getElementById(ids[i]).className='DataBar';
		}
	}	
	//alert("elementid: "+ElementID+" class: "+document.getElementById(ElementID).className);
}
