

jQuery(document).ready(function() {

	
	


	/* alles schrott
    // reload png images for better support of transparency
    if (jQuery.browser.msie && (parseInt(jQuery.browser.version.substr(0, 1)) > 7)) {
      // ie8, ie9
      jQuery(".rollOverImage img, .rollOver img").each(function(){
        //var opacity = parseFloat(jQuery(this).css("opacity")) * 100;
        //if (isNaN(opacity)) { opacity = 100; }
        //jQuery(this).css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +jQuery(this).attr('src') + "', sizingMethod='image');"+"progid:DXImageTransform.Microsoft.Alpha(opacity="+opacity+");").attr("src", "/fileadmin/convisual/images/basics/transparent.gif");
	});
    }
    if (jQuery.browser.msie && (parseInt(jQuery.browser.version.substr(0, 1)) <= 7)) {
      // ie7, 6 or 5
      jQuery(".rollOverImage img, .rollOver img").each(function(){
        jQuery(this).css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + jQuery(this).attr('src') + "', sizingMethod='image');").attr("src", "/fileadmin/convisual/images/basics/transparent.gif");
      });
    }
	*/



	

	/*navigation*/
	jQuery("#mainnavi").hover(function(){
		jQuery('#mainsubnavi-Bg').show().stop(true, false).animate({ height: "185px" },'slow');
	}, function() {
		jQuery('#mainsubnavi-Bg').stop(true, false).animate({ height: "0" },'slow');
	});


	jQuery(".li_main").hover(function() {
		jQuery(this).children('ul').show().stop(true, false).animate({ height: "185px" },'slow');
		jQuery(this).children('a').addClass('active');
	}, function() {
		//jQuery(this).children('ul').stop(true, false).animate({ height: "0" },'slow');
		jQuery(this).children('ul').stop(true, false).css('height','0');
		jQuery(this).children('a').removeClass('active');
	});



	/*rollOver Produkte*/



	if (!jQuery.browser.msie) {
		
		jQuery(".rollOver").hover(function() {
	
			jQuery(this).css('cursor','pointer');
			jQuery(this).stop(true, false).animate({ 
				opacity: 0.20
			},
			'slow');
	
			jQuery('.rollOverImage').show().stop(true, false).animate({ 
				opacity: 1
			},
			'slow');
		}, function() {
			jQuery(this).stop(true, false).animate({ 
				opacity: 1.00
			},
			'slow');
			
			jQuery(this).pulsieren({zustand: 0});
	
	
			jQuery('.rollOverImage').show().stop(true, false).animate({ 
				opacity: 0
			},
			'slow');
		});
	
	}
	
	else {
		
		jQuery(".rollOver").hover(function() {
			jQuery(this).css('cursor','pointer');
			jQuery('.rollOverImage').show();
		}, function() {
			jQuery(this).css('cursor','pointer');
			jQuery('.rollOverImage').hide();
		});
	
		
	}	





	// Set default values for form elements
	jQuery("#name").DefaultValue("Name");
	jQuery("#email").DefaultValue("E-Mail (wird nicht angezeigt)");


	var subwords = [];
	jQuery('#subnavi li a').each(function(i) {
		subwords[i] = jQuery(this).html();
	});
	jQuery('.thumbNav a').each(function(i) {
		jQuery(this).html(subwords[i]);
	});

	

	// Pulsierende Rollover aktivieren
	if (!jQuery.browser.msie) {
		jQuery(".rollOver").pulsieren();
	}
		
	
	
	// validate signup form on keyup and submit
	jQuery("#newCommentForm").validate({
	
		submitHandler: function(form) {
       		// do other stuff for a valid form
   			form.submit();
   		},
		rules: {
			
			"tx_ffblog_pi1[newComment][firstname]": {
      			required: function(element) {
        			return jQuery("#name").val() != "Name";
      			}
    		},
      
			nameXX: {
				required: true
			},
			"tx_ffblog_pi1[newComment][email]": {
				required: true,
      			email: true
			}
		},
		
		messages: {
			"tx_ffblog_pi1[newComment][firstname]": {
				required: 'Bitte einen gültigen Namen eingeben'
			},			
			"tx_ffblog_pi1[newComment][email]": {
				required: 'Bitte eine gültige Email-Adresse eingeben',
				email: 'Bitte eine gültige Email-Adresse eingeben'
			}
		}
		
	});
	

});



//footer bottom setzen, wenn inhalt kleiner als body
function updateOrientation() {
	var width  = jQuery(window).width();
	var height = jQuery(window).height();
	
	var fakX = width / 1600;
	var fakY = height / 1300;
	var footerHeight = jQuery('#footer').height()
	

	if( fakX > fakY ) {
	//	jQuery("#backgroundDiv").height( 1200 * fakX );
	//	jQuery("#backgroundDiv").width( width );
	} else {
	//	jQuery("#backgroundDiv").height( height );
	//	jQuery("#backgroundDiv").width( 1600 * fakY );
	}
	
	/*alert( jQuery('#all').height() + " ; " + jQuery(window).height());*/
	
	if( jQuery('#all').height() + footerHeight > jQuery(window).height())
	{
		jQuery("#footer").css('position', "");	
	}else{
		jQuery("#footer").css('position', "fixed");
	}
}

jQuery(document).ready( updateOrientation );
jQuery(window).resize( updateOrientation );




jQuery.fn.pulsieren = function(){

jQuery(this).each(function(){

	if (this.zustand) {

		this.zustand = 0;

		jQuery(this).animate({
			opacity: 1.00
		}, 2000, 
		function(){
			jQuery(this).pulsieren();
		});
				
	} else {


		this.zustand = 1;
	
		jQuery(this).animate({
			opacity: 0.5
		}, 2000, 
		function(){
			jQuery(this).pulsieren();
		});
	
	
	}	

});
		
}

