jQuery.noConflict();
jQuery(function($){
	
	/* PSEUDO_SELECTIONS: */
		
		$('a').click(function(){
			$(this).blur();
		});
		
	/* :PSEUDO_SELECTIONS */
	
	/* BOX_LIST_ANIMATION: */
		
		$("#box h2.flap").click(function () {
			$(this).next().slideToggle("slow");
		});
		
		
	/* :BOX_LIST_ANIMATION */
	
	/*ALLG FLAPS : LAST +CLASS "LAST"*/
var last = function(){
	jQuery.each( jQuery('div.content'), function(){
       jQuery(this).find('div.flap_inhalt:last').toggleClass('last abstand clearfix');
       jQuery(this).find('h2.flap:last').toggleClass('last');
    });
}

last();
/*:ALLG FLAPS : LAST +CLASS "LAST"*/

/*INPUTS MIT INHALT "ANZAHL" ODER NICHT*/
jQuery('div.row_infomaterial input').blur(function(){

if( jQuery(this).val()!='' ){
  jQuery(this).addClass('voll');
}else {
  jQuery(this).removeClass('voll');
}

});

/*:INPUTS MIT INHALT "ANZAHL" ODER NICHT*/
	
	/* WERBEMITTEL ALLES KLICKBAR:	 */
	
	jQuery('.kampagne_bild').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_2').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_3').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_4').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_5').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_6').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_7').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_9').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_10').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_11').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_12').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_13').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_14').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_15').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_16').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_17').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_18').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_19').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_20').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});	
	
	jQuery('.kampagne_bild_21').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_30').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_31').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_32').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_33').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_34').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_35').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_36').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_37').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_38').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_39').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_40').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_41').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_42').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_43').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_44').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_45').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_46').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_47').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_48').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_47_1').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_48_1').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_49').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_50').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_51').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_52').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_53').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_54').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.kampagne_bild_55').click(function(){
		tb_show(null, jQuery(this).parent().find('a').attr('href'), false);
	}).css({cursor:'pointer'});
	
	jQuery('.drp').change(function(){
		jQuery(this).next().find('a').attr('href', jQuery(this).val());
	});
	
	
	
	if (window.location == "http://www.suchtpraevention-zh.ch/publikationen/magazin-laut-leise/magazin-laut-leise/?ziel=abonnieren"){
    		jQuery('#Abonnieren').click();
	}
	
	if (window.location == "http://www.suchtpraevention-zh.ch/publikationen/magazin-laut-leise/magazin-laut-leise/?ziel=aendern"){
    		jQuery('#Aendern').click();
	}
	
	if (window.location == "http://www.suchtpraevention-zh.ch/publikationen/magazin-laut-leise/magazin-laut-leise/?ziel=loeschen"){
    		jQuery('#Loeschen').click();
	}
	
	jQuery("p.more_lang a").click(function () {
	jQuery(this).parent().parent().next().slideToggle("slow");
	return false;
	});
	
	
	
	
	
	
	/* :WERBEMITTEL ALLES KLICKBAR */
	
	/* VALIDIERUNG BESTELLFORM -> WENN OBERN NOCH NICHTS EINGETRAGEN DAS UNTEN NICHT KLICKBAR */
		
		var testFormWerbemittel = function(){
			var empty = 0;
			//jQuery.each( jQuery('div.werbemittel input, div.werbemittel_rahmen input'), function(){
			jQuery.each( jQuery('div.werbemittel_rahmen input, #info_form_list input, #kampagne_form_list input'), function(){
				var $this = jQuery(this);
				if( $this.is(':checkbox') ){
					if( !$this.is(':checked') ){ empty++; }
				}else{
					if( $this.val()=='' ){ empty++; }
				}
			});
			//console.log(jQuery('div.werbemittel input, div.werbemittel_rahmen input').length +' < '+ empty);
			//if( jQuery('div.werbemittel input, div.werbemittel_rahmen input ').length > empty ){
			if( jQuery('div.werbemittel_rahmen input, #info_form_list input, #kampagne_form_list input').length > empty ){
				jQuery('table.werbemittel input').attr('disabled', '');
				jQuery('table.werbemittel').css({opacity:1});
			}else{
				jQuery('table.werbemittel input').attr('disabled', 'disabled');
				jQuery('table.werbemittel').css({opacity:.5});
			}
		}
		
		testFormWerbemittel();
		jQuery('div.werbemittel input, div.werbemittel_rahmen input, #info_form_list input, #kampagne_form_list input').keyup(testFormWerbemittel);
		
	/* :VALIDIERUNG BESTELLFORM -> WENN OBERN NOCH NICHTS EINGETRAGEN DAS UNTEN NICHT KLICKBAR */
	
		
	
	/* FORM_ENHANCEMENTS: */
		
		$('#meta form input.txtInput').focus(function(){
			var $this = $(this);
			if( $this.val()==$this.attr('title') ){
				$this.val('');
			}
		}).blur(function(){
			var $this = $(this);
			if( $this.val()=='' ){
				$this.val( $this.attr('title') );
			}
		}).attr('title', $('#meta form input.txtInput').attr('value'));
		
	/* :FORM_ENHANCEMENTS */
		
	/* IE6_STUFF: *
		
		if( typeof($.ifixpng)!='undefined' ){
			$.ifixpng('fileadmin/templates/images/pixel.gif');
			$('img[src$=.png], #lnkFavoriten, .favStar').ifixpng();
			//$('#box h1, #textBox h1, #box, #textBox').ifixpng();
		}
		
	/* :IE6_STUFF */
	
	/* HOME_REPLACEMENTS: *
		
		jQuery('#home h1').addClass('replacement');
		if( !$.browser.msie || ( $.browser.msie && parseInt($.browser.version)>6 ) ){
			jQuery('#home_projekte h3').addClass('replacement');
		}
		
	/* :HOME_REPLACEMENTS */
	
	/* ARROW HANDLING */
	$("h2.flap").click(function () {
		$(this).toggleClass("open_arrow");
	});
	/* :ARROW HANDLING */
	
	/* LANG_DROPDOWN: */
		jQuery('.dropdown select').change(function(){
			jQuery(this).parent().next().find('a').attr('href', jQuery(this).val());
		});	
	/* :LANG_DROPDOWN */
	
	/* MOVIE_BOX: *
		$(".movie").jqvideobox({
			flvplayer: '/fileadmin/templates/movies/flvplayer.swf',
			initialWidth: 320,
			initialHeight: 240,
			defaultWidth: 320,
			defaultHeight: 240,
			defaultOverLayFade: 0.75
		});
	/* :MOVIE_BOX */

										$('.flap2_container h2').click(function(){
											if( $(this).parent().hasClass('flap2_open') ){
												$(this).next().slideToggle(function(){
													$(this).parent().toggleClass('flap2_open');
												});
											}else{
												$(this).parent().toggleClass('flap2_open');
												$(this).next().slideToggle();
											}
										});
	
	jQuery.each(jQuery('.mark_last_flap'), function(){
		jQuery(this).find('li:last').addClass('last');
	});
	
	/* FLAPS_HASH: */
		
		var url = document.location.href;
		var hashPos = url.indexOf('#Flap/');
		if( hashPos>0 ){
			var i = parseInt(url.substring(hashPos+6));
			jQuery('.flap2_container > li:eq(' + i + ') > h2').click();
		}
		
	/* :FLAPS_HASH */
	
});