//***************************************
//************** Open Ajax Content
//***************************************

function openContent(file) 
{
	if(file == "empty")
	{
		new Ajax.Updater('content','/content/'+file+'.php', {asynchronous: true, evalScripts: true});
		//new Effect.Fade('content');	
		$('content').hide();
	}
	else
	{
		new Ajax.Updater('content','/content/'+file+'.php', {asynchronous: true, evalScripts: true});
		new Effect.Appear('content');
		//$('content').show();
		
		trackHRS(file,'');
		
	}
}

function openSMSContent(file,posx,posy) 
{
	if(file == "empty")
	{
		new Ajax.Updater('smscontent','/content/'+file+'.php', {asynchronous: true, evalScripts: true});
		//new Effect.Fade('content');	
		$('smscontent').hide();
	}
	else
	{
		var smscontent=document.getElementById('smscontent');
		smscontent.style.top = posy + "px";
		smscontent.style.left = posx + "px";		
		new Ajax.Updater('smscontent','/content/'+file+'.php', {asynchronous: true, evalScripts: true});
		new Effect.Appear('smscontent');
		
		
		//$('content').show();
	}
	
}




var searchstatus = false;


//***************************************
//************** Hotelsuche
//***************************************

function showSearch(lang)
{
	if(!searchstatus) {
		document.getElementById('hotelsuche').style.zIndex = 5;
		new Effect.Move('suche_content', { x: 0, y: 0, mode: 'absolute' });
		document.images['suchebutton'].src = '/img/'+lang+'hotelsuche_button_down.gif';
		document.images['suchebutton1'].src = '/img/'+lang+'hotelsuche_button_down.gif';
		searchstatus = true;
	}
	else {
		new Effect.Move('suche_content', { x: 0, y: 270, mode: 'absolute', afterFinish: function() {
			document.getElementById('hotelsuche').style.zIndex = 0;																						
		}});
		document.images['suchebutton'].src = '/img/'+lang+'hotelsuche_button.gif';
		document.images['suchebutton1'].src = '/img/'+lang+'hotelsuche_button.gif';
		searchstatus = false;
	}
}


//***************************************
//************** Call Flash
//***************************************

function getFlashMovie(movieName)
{
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}
 
function closeFlash()
{
	//var text = "video";
	$('content').hide();
	new Ajax.Updater('content','/content/empty.php', {asynchronous: true, evalScripts: true});	
	getFlashMovie("flashcontent").closeContentJS();
}
function closeSMSFlash()
{
	//var text = "video";
	$('smscontent').hide();
	new Ajax.Updater('smscontent','/content/empty.php', {asynchronous: true, evalScripts: true});	
	getFlashMovie("flashcontent").closeSMSContentJS();
}

function openContentImpressum(str)
{
	var target = str;
	getFlashMovie("flashcontent").openContentJS(target);
}



//***************************************
//************** Resizing
//***************************************

function resize()
{
	var flashcont=document.getElementById('flashcontainer');
	var footer=document.getElementById('footer');
	var suche=document.getElementById('hotelsuche');
	var suchebutton=document.getElementById('hotelsuche_button');
	var content=document.getElementById('content');
	var bodytag=document.getElementById('body');

	var contheight = 0;
	var contenttop = 0;
	var footerheight = 0;
	var ratio = 0;

	var screenx = 0;
	var screeny = 0;

	// Get Screen Sizes
	if(self.innerHeight)
	{
		screenx=self.innerWidth;
		screeny=self.innerHeight;
	}
	else if(document.documentElement&&document.documentElement.clientHeight)
	{
		screenx=document.documentElement.clientWidth;
		screeny=document.documentElement.clientHeight;
	}
	else if(document.body)
	{
		screenx=document.body.clientWidth;
		screeny=document.body.clientHeight;
	}

	// Set Positions
	contheight = screenx * 0.5;
	footerheight = contheight + 101 - 8;

	if(footerheight > screeny - 70)
	{
		footerheight = screeny - 70;
		contheight = screeny - 62 - 101;
	}

	if(footerheight < 630) 
	{
		footerheight = 630;
		contheight = 630 - 62;
	}

	// Place Objects
	flashcont.style.height = contheight + "px";
	footer.style.top = footerheight + "px";
	suche.style.top = footerheight - 300 + 8 + "px";
	suchebutton.style.top = footerheight - 30 + 8 + "px";
	
	// Place Content
	contenttop = ((contheight / 2) - 205) + 101;
	content.style.top = contenttop + "px";
	
	// Place BG Image
	bodytag.style.backgroundPosition = "left " + (footerheight + 70) + "px";

}

//***************************************
//************** DREAMWEAVER FUNCTIONS
//***************************************

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_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_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];}
}
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


