var tsX = 0;
var intro;
var introArr = new Array('noise','head','menu','content','foot');
var introHeadArr = new Array('breadcrumbs','langmenu','langmenu2');
// JavaScript Document
$(document).ready(function() {

	//set search
	//$('#search img').click(function(){alert("search");});
	
	//set lang
	 
	 $('#langmenu').bind('mouseenter',function(){$('#langmenu ul').slideDown('fast');});
	 $('#langmenu').bind('mouseleave',function(){$('#langmenu ul').slideUp('fast')});
 	
 	$('#langmenu2').bind('mouseenter',function(){$('#langmenu2 ul').slideDown('fast');});
	$('#langmenu2').bind('mouseleave',function(){$('#langmenu2 ul').slideUp('fast')});
 	
	//set back if IE6
	if(isIE6()){
		var dH = $(document).height();
		$('#noise').css('height',dH+'px');
		$('#backstretch').css('height',dH+'px');
	}
	
	//replace e-mail
	$('#foot a').each(function(){
		if($(this).attr('href')){
			var lnk = $(this).attr('href').replace('[(ad)]','@').replace('[(dot)]','.');
			$(this).attr('href',lnk); 
			var txt = $(this).html().replace('[(ad)]','@').replace('[(dot)]','.'); 
			$(this).html(txt);
		}
	});

	//set intro
	if(intro){
		//noise is set to display:none with nested style in intro.tpl!
		$('#noise').show();
		//
		for(i=0; i<introArr.length; i++){
			$('#'+introArr[i]).hide();
		}
		doIntro();
	}
	
});


function isIE6(){
	if($.browser.msie && $.browser.version < 7){
		return true;
	} else {
		return false;
	}
}

function doIntro(){
	
	if(isIE6()){
		$('#'+introArr[0]).delay(2000, function(){$(this).show();});
		$('#'+introArr[0]).delay(2000, function(){$(this).show();});
		$('#'+introArr[1]).delay(3000, function(){$(this).show();});
		$('#'+introArr[2]).delay(6000, function(){$(this).show();});
		$('#'+introArr[3]).delay(7000, function(){$(this).show();});
		$('#'+introArr[4]).delay(8000, function(){$(this).show();});
	}else{
		$('#head').css({'overflow':'hidden','width':'240px'});
		$('#'+introArr[0]).delay(2000).fadeIn('slow');
		$('#'+introArr[1]).delay(3000).fadeIn('slow').animate({width:'970px'},'slow')
		setTimeout("$('#'+introArr[1]).css('overflow','visible');",6000); 
		$('#'+introArr[2]).delay(6000).fadeIn('slow');
		$('#'+introArr[3]).delay(7000).fadeIn('slow');
		$('#'+introArr[4]).delay(8000).fadeIn('slow');
	}
}

