var domain = "www.freistilreisen.de";


path = new Array();
path.push('/resources/includes/js/jquery.js');
path.push('/resources/includes/js/facebox.js');
path.push('/resources/includes/js/prototype.js');
path.push('/resources/includes/js/ajax.js');
path.push('/resources/includes/js/animator.js');
path.push('/resources/includes/js/slider.js');
path.push('/resources/includes/js/imgreplace.js');
path.push('/resources/includes/js/swfobject.js');
path.push('/resources/includes/js/lightbox.js');
path.push('/resources/includes/js/effects.js');
path.push('/resources/includes/js/scriptaculous.js');
path.push('/resources/includes/js/rightbox.js');
path.push('/resources/includes/js/md5.js');
path.push('/resources/includes/js/xsearch.js');
loadScrips(path);

function onDocumentLoad ()
{
	replaceHeading("h2");
	replaceHeading("h1");
	replaceHeading("em");
	jQuery(document).ready(function($) {
  		$('a[rel*=facebox]').facebox()
	});
}

window.onload = onDocumentLoad;

function loadScrips(path)
{	
	for(i=0;i<path.length;i++)
	{
		document.write('<script type="text/javascript" src="' + path[i] + '"></script>');
	}
}

function setOpacity(element,value) {
	element.style.opacity = value/100;
	element.style.filter = 'alpha(opacity=' + value + ')';
}

var intervalId = null;

function showMenu (id)
{

	hideAllMenus();

	obj = $('nav_' + id);
	var posElement = obj.positionedOffset();
	var xpos = posElement[0]-4; 
	
	if(parseInt(xpos) > 620)
	{
		xpos = 620;
	}
	
	if($('dropup_' + id).getElementsByTagName("a").length > 1)
	{
		$('dropupBackground').style.display = 'block';
		$('dropupBackground').style.left = parseInt(xpos) + "px";
		setOpacity($('dropup_' + id),0);
		$('dropup_' + id).style.left = parseInt(xpos) + "px";
		$('dropup_' + id).style.display = "block";
		
		ex9 = new Animator({transition: Animator.makeEaseOut(3),duration: 1000});
		ex9.addSubject(new NumericalStyleSubject($('dropup_' + id), 'opacity', 0, 1));
		ex9.play();
		
		intervalId = setInterval("hideAllMenus()",5000);
		
		$('dropup_' + id).onmouseout = function ()
		{
			intervalId = setInterval("hideAllMenus()",2000);
		}
		
		$('dropup_' + id).onmouseover = function ()
		{
			clearInterval(intervalId);
		}
	}
}

function hideAllMenus ()
{
	clearInterval(intervalId);
	$('dropupBackground').style.display = 'none';
	divs = $('dropup').getElementsByTagName("div");
	for (i=0;i<divs.length;i++)
	{
		setOpacity(divs[i],0);
		divs[i].style.display = 'none';
	}
}

function displayError(errField, errText, show) {
	if (show) {
		document.getElementById('err_' + errField + '_inner').innerHTML = errText + '...';
		document.getElementById('err_' + errField).style.visibility = 'visible';
	} else {
		document.getElementById('err_' + errField + '_inner').innerHTML = '';
		document.getElementById('err_' + errField).style.visibility = 'hidden';
	}
}

function showError(errField, errText) {
	document.getElementById(errField + '_inner').innerHTML = errText + '...';
	document.getElementById(errField).style.visibility = 'visible';
}

function hideError(errField) {
	document.getElementById(errField + '_inner').innerHTML = '';
	document.getElementById(errField).style.visibility = 'hidden';
}

function loadAjaxPage(url) {
	new Ajax.Updater('content', url, { method: 'get' });
}