$(document).ready(function(){$('a.popup').live('click',function(){newwindow=window.open($(this).attr('href'),'','height=500,width=600,left=20,top=50');if(window.focus){newwindow.focus()}return false});$('#albumlightboxIframe').live('click',function(){$('#lbOverlay').css({zIndex:'500'}).fadeTo('fast',0.9);$('#albumSlider').css({zIndex:'0'});var target=this.href;var height=$(window).height()-150;var width=$(window).width()-150;if(width>1000){width=1000}if(height>800){height=800}var closeButton='<img onclick="albumlightboxIframeClose();" style="display:block;z-index:9999;position:absolute; top:-23px; right:-23px; cursor:pointer;" src="http://www.vielsaitig.eu/site/images/fancy_closebox.png"/>';$('body').append('<div style="left:50%;top:50%; margin-left:-'+(width/2)+'px; margin-top:-'+((height+20)/2)+'px;" id="slimboxIframe"><div id="albumlightboxIframeControles">'+closeButton+'<iframe width="'+width+'" height="'+height+'" src="'+target+'"></iframe></div></div>');return false});$('#lbOverlay').click(function(){albumlightboxIframeClose()});$('#albumSlider').hover(function(){$(this).stop(true,true).animate({left:'-1px'},{duration:400,easing:'easeInOutExpo',complete:function(){$('#lbOverlay').css({zIndex:'500'}).fadeTo('fast',0.9)}});$('#innerAlbumSlider').fadeTo('fade',1)},function(){$(this).delay(300).animate({left:'-216px'},{duration:600,easing:'easeOutBounce',complete:function(){$('#innerAlbumSlider').delay(200).stop(true,true).fadeTo('slow',0);$('#lbOverlay').fadeOut(function(){$(this).css({zIndex:'999'})})}})});$(".navigation a").hover(function(){$(this).stop(true,true).animate({left:'10px'},{duration:400,easing:'easeInOutBack'})},function(){$(this).delay(200).animate({left:'0px'},{duration:600,easing:'easeOutBounce'})});$("#logo").hover(function(){$(this).animate({top:"-45px"},{duration:400,easing:'easeOutBack'})},function(){$(this).stop(true,true).animate({top:"-100px"},{duration:400,easing:'easeInOutBack'})});$("#content_text a[href$='.pdf']").addClass('iconPdf');$("#content_text a[href$='.jpg']:not(.lightbox)").addClass('iconJpg');$("#content_text a[href$='.png']:not(.lightbox)").addClass('iconJpg');$("#content_text a[href$='.gif']:not(.lightbox)").addClass('iconJpg');$("#content_text a[href$='.zip']").addClass('iconZip');$("#content_text a[href^='mailto']").addClass('iconMail');$('.previewEvent').find('img').animate({opacity:0.5});$('.previewEvent').hover(function(){$(this).find('a,p').stop(true,true).animate({color:"#222"});$(this).find('img').stop(true,true).animate({opacity:1});$(this).stop(true,true).css({backgroundColor:"#fff"});$(this).find('.previewToday').stop(true,true).animate({left:"150px"});$(this).find('.previewTomorrow').stop(true,true).animate({left:"150px"})},function(){$(this).find('a,p').stop(true,true).animate({color:"#666"});$(this).find('img').stop(true,true).animate({opacity:0.5});$(this).stop(true,true).css({backgroundColor:""});$(this).find('.previewToday').stop(true,true).animate({left:"14px"});$(this).find('.previewTomorrow').stop(true,true).animate({left:"12px"})});$('.previewEvent').click(function(){var link=$(this).find("a").attr("href");window.location=link});Date.firstDayOfWeek=1;Date.format='dd.mm.yyyy';$('#event_date').datePicker().val(new Date().asString()).trigger('change');removeh2Date();$('#feedback').hide();$('#feedbackTrigger').click(function(){$('#feedback').slideToggle()});$('.terminScroller').bind("click",function(event){event.preventDefault();var ziel=$(this).attr("href");$('html,body').animate({scrollTop:$(ziel).offset().top},1000,function(){location.hash=ziel})});

$(".sortGallery").sortable({
	delay:100,
	opacity:0.5,
	axis:'x',
	cursor:'move',
	handle:'.dragHandle',
	update:function(data){
		var order=$(this).sortable("serialize")+'&galsort=updateSort';
		$.ajax({type:'POST',url:"http://www.vielsaitig.eu/site/includes/capcha.inc.php",
		data:order,
		success:function(data){
		if(data){if(data==1234){$(".sortGallery").addClass('sendTrue');$('input[name="check"]').val('true')}else{$(".sortGallery").removeClass('sendTrue');$('input[name="check"]').val('')}}}})}
});


$('#validMail').blur(function(){if($(this).val()!=''){validateEmail(this.value)}});$('#validMail').focus(function(){$('#validMail').removeClass('valide');$('#validMail').removeClass('invalide')});$('input[type=text]:not(#payform input[type=text]),input[type=password]').focus(function(){this.select()});$('input[type="text"]:not(#ical,#payform input[type=text]),textarea').focus(function(){if(this.value==this.defaultValue){this.value=''}if(this.value!=this.defaultValue){this.select()}});$('input[type="text"]:not(#ical),textarea').blur(function(){if($.trim(this.value)==''){this.value=(this.defaultValue?this.defaultValue:'')}});$('input[name="email"],input[name="event_email_text"]').blur(function(){validateEmail($(this).val())});$(window).scroll(function(){if($(window).scrollTop()>1500){$('#backtotopWrapper').fadeIn(600)}else{$('#backtotopWrapper').fadeOut(600)}});$(".lightbox,#albumCoverSlider").hover(function(){$(this).stop().animate({opacity:0.8,},200)},function(){$(this).stop().animate({opacity:1,},200)});$('.vs_feedbackkomment img').css({opacity:"0.7"});$('#socialKontactWrapper li').hover(function(){$(this).stop().animate({paddingLeft:'8px'},'fast')},function(){$(this).stop().animate({paddingLeft:'0px'},'slow')});var title='';$('a:not(.lightbox, .sitemap, .impressum, #rssIconFeed, .eventWrapper *,.fotoeventWrapper *)').addClass('clickdown');$('#vsTweet, #rssIconFeed, #icalIcon_').hover(function(){$(this).stop(true,true).animate({top:"-18px"},{duration:400,easing:'easeOutBounce'});$('.iconTitle').remove();title=$(this).attr('title');$(this).append('<p style="display:none;" class="iconTitle">'+title+'</p>');$('.iconTitle').fadeIn(500)},function(){$(this).stop(true,true).animate({top:"0px"},{duration:800,easing:'easeOutQuart'});$('.iconTitle').fadeOut(700)});var date=new Date();var dd=date.getDate();$('#icalIcon_').append('<p id="setCurrentDate">'+dd+'</p>');loadLightbox()});function checkform(){var name=$('input[name="name"]').val();var check=$('input[name="check"]').val();var email=$('input[name="email"]').val();var text=$('textarea[name="msg"]').val();if(check=='true'){if(name&&text&&validateEmail(email)){return true}else{return false}}else{return false;alert('Bitte sortier das Capcha.')}}function validateEmail(email){if(/^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,4})$/.test(email)){$('input[name="email"],input[name="event_email_text"]').addClass('valide');$('input[name="email"],input[name="event_email_text"]').removeClass('invalide');return(true)}else{$('input[name="email"],input[name="event_email_text"]').addClass('invalide');$('input[name="email"],input[name="event_email_text"]').removeClass('valide');alert('Bitte eine Valide E-Mail Adresse eintragen!');return(false)}}function checkformContact(){var name=$('#form_name').val();var nname=$('#form_nname').val();var email=$('#form_email').val();var betreff=$('#form_betreff').val();var text=$('#form_text').val();if(name!='Vorname*'&&nname!='Nachname*'&&validateEmail(email)&&text!='Nachricht*'){return true}else{alert('Pflichtfelder nicht ausgefüllt!');return false}}function removeh2Date(){for(i=10;i<30;i++){$('.dateH2_20'+i+':first').removeClass('dateH2_20'+i);$('.dateH2_20'+i).remove()}$('.dateH2_2009:first').removeClass('dateH2_2009');$('.dateH2_2009').remove();$('.dateH2_2008:first').removeClass('dateH2_2008');$('.dateH2_2008').remove();$('.dateH2_2007:first').removeClass('dateH2_2007');$('.dateH2_2007').remove();$('.dateH2_2006:first').removeClass('dateH2_2006');$('.dateH2_2006').remove();$('.dateH2_2005:first').removeClass('dateH2_2005');$('.dateH2_2005').remove();$('.dateH2_2004:first').removeClass('dateH2_2004');$('.dateH2_2004').remove()}function loadLightbox(){$("a.lightbox").slimbox({overlayOpacity:0.9,imageFadeDuration:500,resizeEasing:"easeOutBack",captionAnimationDuration:1,counterText:"Foto {x} von {y}"},null,function(el){return(this==el)||((this.rel.length>8)&&(this.rel==el.rel))})}function backToTop(){$('html,body').animate({scrollTop:0},'slow')}function albumlightboxIframeClose(){$('#slimboxIframe').fadeOut('fast',function(){$(this).remove()});$('#lbOverlay').fadeOut(function(){$(this).css({zIndex:'999'})});$('#albumSlider').css({zIndex:'600'})}
