
// -----------------------------------------------------------------------------------------------------
function sendRequest(action, id)
{

	try {
		req = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch (e) {
		//Kein AJAX Support
	}

	req.onreadystatechange = handleResponse;
	req.open('get', 'output.php?s='+ encodeURI(action)+'&id='+id);
	req.send(null);
}

function handleResponse()
{
	if((req.readyState == 4) && (req.status == 200))
	{
		document.getElementById('contentChange').innerHTML = req.responseText;
	}
}

//---------------------------------------------------------------------------------------------------------------------------------------     

//-------------------------Accordion Menu ----------------------------------------------------------------------------------------------

$(document).ready(function(){
	
	$(".accordion h3:first").addClass("active");
	$(".accordion p:not(:first)").hide();

	$(".accordion h3").click(function(){
		$(this).next("p").slideToggle(300)
		.siblings("p:visible").slideUp(300);
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});

});

//------------------------------------------------------------------------------------------------------------------------------------

function onBefore() { 
    $('#output').html("Scrolling image:<br>" + this.src);
    $("#s1").animate({ opacity: 0.3 }, 300); 
} 
function onAfter() { 
    $('#output').html("Scroll complete for:<br>" + this.src) 
        .append('<h3>' + this.alt + '</h3>');
	$("#s1").animate({ opacity: 1 }, 300); 
} 



		$(document).ready(function() {

			//Set css in Firefox (Required to use the backgroundPosition js)
			$('#shutter1').css({backgroundPosition: '0px 0px'});
			$('#shutter2').css({backgroundPosition: '0px 0px'});
			$('#shutter3').css({backgroundPosition: '0px 0px'});
			$('#shutter4').css({backgroundPosition: '0px 0px'});
			$('#shutter5').css({backgroundPosition: '0px 0px'});


			//Animate the shutter  
			$(".link").hover(function(){
			      $(this).parent().animate({backgroundPosition: '(0px -100px)'}, 500 );
			    }, function() {
			      $(this).parent().animate({backgroundPosition: '(0px 0px)'}, 700 );
			}); 
		 });

/**
 * @author Alexander Farkas
 * v. 1.02
 */
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
            
           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);

// --------------------------------------------------------- MATTEX MEUE 1 ------------------------------------------------------

function menu1(seite1,step,warengruppe,ware) {

			$("#top_slider").slideUp(600);
			$("#topWrap").slideUp(400);
			
setTimeout(function(){
			$("#menu1").show();
			$("#openCloseWrap").show();			
			$("#top_menu").hide();
			$("#topWrap").hide();

			
			if ($("#openCloseIdentifier").is(":hidden")) {
			$("#topMenuImage").html('<img src="design/open.png" alt="open" />');
			if ($(".slider1").is(":visible")) {
			$(".slider1").animate({ 
				marginLeft: "-190px"
				}, 600);
			}
			
			$("#slider").animate({ 
				marginLeft: "0px"
				}, 600, function(){ change(seite1) } );
			$("#openCloseIdentifier").show();
			} 

			
			if ($("#openCloseIdentifier").is(":visible")) {
				$("#slider").animate({ 
				marginLeft: "190px"
				}, 600, function(){ change(seite1) } );
				$("#topMenuImage").html('<img src="design/open.png" alt="open" />');
				$("#openCloseIdentifier").hide();
				$("#openCloseWrap").fadeIn(500);
			}
			}, 500);


function change(seite1){
    $.ajax({
      url: seite1,
      type: 'GET',
	  data: 'id='+step,
      success: function( neueDaten ) {
        $('#sliderContent').html( neueDaten );
      },
      complete: function(){
      $('#sliderContent').show();
      }
    });

  }

} 

$(document).ready(function() {
		$("#openCloseWrap").click( function() {
				$(".slider1").animate({ 
				marginLeft: "-190px"
				}, 400);
				$("#slider").animate({ 
				marginLeft: "0px"
				}, 600);
				$("#openCloseIdentifier").hide();
				$("#openCloseWrap").fadeOut(500);
});
});

// ------------------------------------------- MENU OBEN ---------------------------------------------------------------------------

function menu2(seite1,step,warengruppe,ware) {

				$(".slider1").animate({ 
				marginLeft: "-190px"
				}, 300).hide();
				$("#slider").animate({ 
				marginLeft: "0px"
				}, 400);

setTimeout(function(){
		    $("#menu1").hide();
			$("#top_menu").show();
			$("#topWrap").show();
			$("#openCloseWrap").hide();
			
			if ($("#top_Identifier").is(":hidden")) {
			$("#topMenuImage").html('<img src="design/open.png" alt="open" />');
			$("#top_slider").slideDown(600);
			$('#top_Content').fadeOut(500, function(){ change2(seite1) } );
			
// ----------------------------------------------------------
/*			  $.ajax({
		      url: seite1,
 		      type: 'GET',
			  data: 'id='+step,
		      success: function( neueDaten ) {
		        $('#sliderContent').html( neueDaten );
 		     },
		      complete: function(){
		      $('#sliderContent').show();
		      }
		    });
*/
// ---------------------------------------------------------
			$("#top_Identifier").show();
			} 
			
			if ($("#top_Identifier").is(":visible")) {
				$("#top_slider").slideDown(600);
				$('#top_Content').fadeOut(500, function(){ change2(seite1) } );
				$("#topMenuImage").html('<img src="design/open.png" alt="open" />');
				$("#top_Identifier").hide();
				$("#topWrap").fadeIn(500);
			}
			}, 500);

function change2(seite1){
    $.ajax({
      url: seite1,
      type: 'GET',
	  data: 'id='+step,
      success: function( neueDaten ) {
        $('#top_Content').html( neueDaten );
      },
      complete: function(){
      $('#top_Content').fadeIn(500);
      }
    });

  }

} 

$(document).ready(function() {
		$('#topWrap').click( function() {

				$("#top_slider").slideUp(600);
				$("#top_Identifier").hide();
				$("#topWrap").slideUp(400);
});
});

// --------------------------------------------------- FORMULAR SENDEN --------------------------------------------------

(function($) {
   $.fn.found = function(myFunction) {
      if(this.length) {
         myFunction.call(this);
      }
   };
})(jQuery);

// ----------------------------------------------------------------------------------------------------------------------

function getData(seite11, layer, nummer, name, foto) {
	$(layer).fadeTo(500, 0, function(){ change11(seite11) } );
	if ($("#headfoto").attr("class") != foto) {
	$('#headfoto').fadeTo(700, 0);
	}

function change11(seite11){
    $.ajax({
      url: seite11,
      type: 'POST',
	  data: 'id='+nummer+'&name='+name+'&textid='+foto,
	  cache: false,
      success: function( neueDaten ) {
        $(layer).html( neueDaten );
      },
      complete: function(){
	  var layerHeight = $(".contentChangeLeft").innerHeight();	
        $(".contentChangeRight").height(layerHeight);

        $(layer).fadeTo(500, 1);
		if ($("#headfoto").attr("class") != foto) {
		$("#headfoto").removeClass().addClass(foto);
		$('#headfoto').fadeTo(700, 1);
		}
      }
    });
  }
}

// ------------------------------------------------------------------------------------------------------------------

    jQuery.fn.setPNGTransparenz4IE6 = function(){
        return this.each(function(e){
                if(!$.browser.msie){
                    return this;
                }else if(parseInt($.browser.version) != 6){
                    return this;
                }
                var div = $("<div />");
                for(var n in this.attributes){
                    if(this[n] != "" && this[n] != null){
                        if(n.substr(0,2)=="on"){
                            div.bind(n.substr(2), this[n]);
                        }else if(n != "src"){
                            div.attr(n, this[n]);
                        }
                    }
                }
                div.attr("style", this.style.cssText);
                div.css({
                    width       : this.width + "px",
                    height      : this.height + "px",
                    filter      : "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='scale')"
                });
                if(this.align == "left"){ div.css("float", "left"); }
                if(this.align == "right"){ div.css("float", "right"); }
                if(this.parentNode.href){ div.css("cursor", "hand"); }
                this.parentNode.replaceChild( div[0], this );
            });
    }
$(document).ready(function(e){     
    $("img[src$='png']").setPNGTransparenz4IE6();
});

// --------------------------------------------------------------------------------------------------------------------



// ---------------------------------------------------------------------------------------------------------------------------
