
var nProduct_list = 1;

$(document).ready(function(){
    

	
    //add additional li to menu top and bottom for borders
        $("#mainNav ul li:first-child").before("<li class=\"navDividerBorderFix-top\"></li>");
        $("#mainNav ul li:last-child").after("<li class=\"navDividerBorderFix-bottom\"></li>");
      
        
        if (jQuery.browser.msie && jQuery.browser.version < 7) { 
            
            // ieHoverFix
               $("ul#mainNav li").hover( 
               function() {
                   $(this).addClass("ieHoverFix");
               },
               function() {
                   $(this).removeClass("ieHoverFix");      
           });  
           
           
        }


		$(document).ready(function(){

		    $("a[rel^='prettyPhoto']").prettyPhoto();

			$("#mailerform").validate({
			  rules: {
			    "mailer[firmenname]": "required",
			    "mailer[name]": "required",
			    "mailer[telefon]": "required",
			    "mailer[from]": "required email",
				"mailer[bestellung]": "required"
			  }
			});

			$("#contactform").validate({
			  rules: {
			    "mailer[name]": "required",
			    "mailer[telefon]": "required",
			    "mailer[from]": "required email",
			    "mailer[nachricht]": "required"
			  }
			});
			
			$('.delete_product').live('click', function() {
				
				Check = confirm("Wollen Sie den Produkte-Eintrag löschen?");
				if (Check == true)
			    	$(this).closest('li').remove();
			});

				
			$('#new_product').click(
				function() {
					
					nProduct_list++;

					$('#product_list').append('<li><input type="text" value="" required="false" class="formInput artikelnr" id="artikelnr" name="mailer[bestellung'+nProduct_list+'_1artikelnr]"><input type="text" value="" required="false" class="formInput produktename" id="produktename" name="mailer[bestellung'+nProduct_list+'_2produktename]"><input type="text" value="" required="false" class="formInput anzahl" id="anzahl" name="mailer[bestellung'+nProduct_list+'_3anzahl]"><div class="delete_product"></div></li>');
				});

		 });
		
		
		$("li.link").css("cursor","pointer");
		
		$("#news li.link").hover(
		  function () {
	        $(this).addClass("newsEntryHover");
	      }, 
	      function () {
	        $(this).removeClass("newsEntryHover");
	      }
	    );
		$("li.link").click( function (){
			window.location = ($(this).find("a.moreLink").attr("href"));
		});


	  $("#video").mouseover(function() {
			$('#video img.play').attr('src','images/play_on.png');
	  }).mouseout(function(){
			$('#video img.play').attr('src','images/play_off.png');
	  });

		var FullscreenrOptions;
		
		if ((screen.width>=1024)) {
			// You need to specify the size of your background image here (could be done automatically by some PHP code)
			FullscreenrOptions = {  width: 1920, height: 1719, bgID: '#bgimg' };
		} else {
			$('#bgimg').attr('src', '/images/bg_1024.jpg');
			// You need to specify the size of your background image here (could be done automatically by some PHP code)
			FullscreenrOptions = {  width: 1024, height: 768, bgID: '#bgimg' };			
		}

		// This will activate the full screen background!
		jQuery.fn.fullscreenr(FullscreenrOptions);

});


