window.onload=init;function init(){EFFECTS.init();setRoleAttr();initDatePicker()}function myPreload(img_src){var d=document;if(d.images){if(!d.p){d.p=new Array()}var key=d.p.length;d.p[key]=new Image;d.p[key].src=img_src}}function preloadImages(){var a=preloadImages.arguments;for(i=0;i<a.length;i++){if(a[i].indexOf("#")!=0){myPreload(a[i])}}}function setRoleAttr(){if($('#header')){$('#header').attr('role','banner')}if($('#navi')){$('#navi').attr('role','navigation')}if($('#col1')){$('#col1').attr('role','complementary')}if($('#col2')){$('#col2').attr('role','complementary')}if($('#col3')){$('#col3').attr('role','main')}if($('#footer')){$('#footer').attr('role','contentinfo')}}var EFFECTS={init:function(){EFFECTS.initOnOver();if($('#pic')){EFFECTS.initOnClick();EFFECTS.initArrows();EFFECTS.pic_src=$('#pic').attr('src')}},initOnOver:function(){var data=$('img.onOver');for(var x=0;x<data.length;x++){var orig_src=data[x].src;var over_src=orig_src.replace(/.jpg/,"_hover.jpg");over_src=over_src.replace(/.gif/,"_hover.gif");over_src=over_src.replace(/.png/,"_hover.png");data[x].onmouseover=new Function("this.src ='"+over_src+"'");data[x].onmouseout=new Function("this.src ='"+orig_src+"'");myPreload(over_src)}},pic_nr:1,initOnClick:function(){var data=$('img.onClick');for(var x=0;x<data.length;x++){var new_src=$('#pic').attr('src').replace(/01/,"0"+(x+1));data[x].onclick=new Function("$('#pic').attr('src','"+new_src+"');  EFFECTS.setCurrentImg("+x+"); EFFECTS.pic_nr="+(x+1));myPreload(new_src)}if(data.length>0){EFFECTS.setCurrentImg(0)}},setCurrentImg:function(x){var data=$('img.onClick');for(y=0;y<data.length;y++){data[y].className=data[y].className.replace("onCurrent","")}data[x].className+=" onCurrent"},initArrows:function(){if($('#arrowMinus')){$('#arrowMinus').onclick=new Function("EFFECTS.minusArrow();")}if($('#arrowPlus')){$('#arrowPlus').onclick=new Function("EFFECTS.plusArrow();")}},minusArrow:function(){var pic_count=$('img.onClick').length;var minus=EFFECTS.pic_nr-1;if(minus==0){minus=pic_count}var new_src=EFFECTS.pic_src.replace(/01/,"0"+minus);$('#pic').attr('src',new_src);EFFECTS.pic_nr=minus;EFFECTS.setCurrentImg((minus-1))},plusArrow:function(){var pic_count=$('img.onClick').length;var plus=EFFECTS.pic_nr+1;if(plus==(pic_count+1)){plus=1}var new_src=EFFECTS.pic_src.replace(/01/,"0"+plus);$('#pic').attr('src',new_src);EFFECTS.pic_nr=plus;EFFECTS.setCurrentImg((plus-1))}};var url="includes/newsbox_klicks.php?param=";function handleHttpResponse(){if(http.readyState==4){results=http.responseText.split(",");alert(results[0])}}function cntNc(id){http.open("GET",url+id,true);http.send(null)}function getHTTPObject(){var xmlhttp;/*@cc_on@if(@_jscript_version>=5)try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(E){xmlhttp=false}}@else xmlhttp=false;@end@*/if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest()}catch(e){xmlhttp=false}}return xmlhttp}var http=getHTTPObject();function initDatePicker(){var sf=$("#f_date_sa").datepicker({minDate:"0",onSelect:function(){var anrDate=new Date(Date.parse($('#f_date_sa').datepicker('getDate')));var abrDate=new Date(Date.parse($('#f_date_sb').datepicker('getDate')));if(anrDate>=abrDate||$('#f_date_sb').val()==''){$('#f_date_sb').datepicker('setDate',new Date(anrDate.getTime()+86400000))}$("#f_date_sb").datepicker("option","minDate",new Date(anrDate.getTime()+86400000))}});var st=$("#f_date_sb").datepicker({minDate:"+1",onSelect:function(){var abrDate=new Date(Date.parse($('#f_date_sb').datepicker('getDate')));if($('#f_date_sa').val()==''){$('#f_date_sa').datepicker('setDate',new Date(abrDate.getTime()-86400000))}}})}

$(document).ready(function(){
	$('#thumbs_wrap').show();
	$('#gallery_down').click(function(){
		$(this).hide();
		$('#thumbs_wrap').animate({bottom:'-90'},700,function(){$('#gallery_up').fadeIn(500);});	
	});
	$('#gallery_up').click(function(){
		$(this).hide();
		$('#thumbs_wrap').animate({bottom:'0'},700,function(){$('#gallery_down').fadeIn(500);});	
	});
	if(!IE7) {
		$('#col1_content .newsbox').each(function(e){
			//init
			if(e != 1) {
				$(this).addClass('hidden');
				$(this).find('h2').removeClass('op-rot').addClass('op-gelb');
				$(this).find('.inhalt').hide();
				$(this).find('.inhalt p.text').hide();
			} 
			/////
			$(this).click(function(e){
				if($(this).find('.inhalt').css('display') == 'none') {
					$('#col1_content .newsbox').each(function(e){
						$(this).removeClass('hidden').addClass('hidden');
						$(this).find('h2').removeClass('op-rot').addClass('op-gelb');
						//$(this).find('p.text').hide();
						$(this).find('.inhalt').slideUp(400);
					});
				}
				$(this).removeClass('hidden');
				$(this).find('h2').addClass('op-rot').removeClass('op-gelb');
				$(this).find('.inhalt').slideDown(400,function(){$(this).find('p.text').show()});
			});	
		});
	}
	$('#h1_'+HEADING).css('padding-top',20).html('<img class="heading" src="images_layout/headings/'+HEADING+'.gif" alt="" />');
	$('#preise_txt1').html('<img src="images/preise_txt_zimmerpreise.gif" alt="" />');
	$('#preise_txt2').html('<img src="images/preise_txt_ausstattung.gif" alt="" />').css('margin','25px 0 29px');
	$('#preise_txt3').html('<img src="images/preise_txt_zusatzinfo.gif" alt="" />');
	$('#preise_txt2_en').html('<img src="images/amenities.gif" alt="" />');
	$('#preise_txt3_en').html('<img src="images/additional.gif" alt="" />');
	$('#preise_txt4').html('<img src="images/preise_txt_belegung.gif" alt="" />');
	$('#preise_txt5').html('<img src="images/preise_txt_kinderspielzimmer.gif" alt="" />');
	$('#holidaycheck_txt').html('<img src="images_layout/holidaycheck_txt.png" alt="" />');
});
