
jQuery.noConflict();


jQuery(window).load(function () {
	jQuery("#kontaktflyer").show();
	jQuery("#kontaktflyer").animate({
		left: "-435px"
	},500)
	.animate({
		left: "-516px"
	},300)
	.animate({
		left: "-510px"
	},100);
	
	
	jQuery("#kontaktflyer-open a").click(function(event){
		event.preventDefault();
		jQuery("#kontaktflyer-open").hide();
		jQuery("#kontaktflyer-close").show();
		jQuery("#kontaktflyer").animate({ left: "-40px" }, 500)
		.animate({ left: "-53px" }, 300)
		.animate({ left: "-50px" }, 120);
	});
	jQuery("#kontaktflyer-close a").click(function(event){
		event.preventDefault();
		jQuery("#kontaktflyer-close").hide();
		jQuery("#kontaktflyer-open").show();
		jQuery("#kontaktflyer").animate({ left: "-516px" }, 300)
		.animate({ left: "-507px" }, 280)
		.animate({ left: "-510px" }, 140);
	});
});

















/*
jQuery.noConflict();

var minHeadHeight = 350;

var maxContentHeight = 550;
var minContentHeight = 150;

var maxContentHeightNews = 280;

var prevContentHeight = null;

var pageMapId = new Array();
pageMapId["359"] = "news";
pageMapId["360"] = "news";
pageMapId["363"] = "brautmode";
pageMapId["364"] = "abendmode";
pageMapId["365"] = "accessoires";
pageMapId["366"] = "designer";
pageMapId["367"] = "ueberuns";
pageMapId["368"] = "kontakt";
pageMapId["369"] = "kontakt-danke";
pageMapId["371"] = "jobs";
pageMapId["372"] = "anfahrt";
pageMapId["373"] = "branchentipps";
pageMapId["374"] = "impressum";

var pagename;


jQuery(document).ready(function($) {
	$('.content').addClass("hidden");
	
	pagename = "news";
	
	var pageid = querySt("id");
	if (pageMapId[pageid] != null) {
		pagename = pageMapId[pageid];
	}
	
	var pagehash = self.document.location.hash.substring(1);
	
	if (pagehash.substring(0,8) == "content-") {
		pagename = pagehash.substring(8);
	}

	$('.content.active, a.page-link-to.active').removeClass("active");
	$(".content#content-" + pagename + ", a#" + pagename + ".page-link-to").addClass("active");
	
	$('.content.active').show();
	
	
	var curwidth = $("#content-wrap").width();
	$("#content-wrap").css("padding-left","210px");
	$("#content-wrap").width(curwidth - 210);	
	initPageLinks();
	updateCrossPageLinks("content-" + pagename);
	
	$(window).resize(function() {
		$("#content-wrap").css("padding-left","0px");
		$("#content-wrap").css("width","100%");
		
		var curwidth = $("#content-wrap").width();
		$("#content-wrap").css("padding-left","210px");
		$("#content-wrap").width(curwidth - 210);	
	
	  resetContentHeight();
	});

});

jQuery(window).load(function () {
	prevContentHeight = jQuery("#content-wrap").height();
	resetContentHeight();
});
*/
function initPageLinks() {
	jQuery("a.page-link-to").click(function(e){
		switchPageTo(jQuery(this).attr("id"));
		/* e.preventDefault(); */
	});
}

function updateCrossPageLinks(page) {
	jQuery("a").each(function(){
	
		var link = jQuery(this).attr("href");
		if (link) {
			if (link.substr(0,9) == "index.php") {
				// Hash bereits vorhanden?
				if (link.indexOf("#") >= 0) {
					link = link.substr(0,link.indexOf("#")) + "#" + page;
					jQuery(this).attr("href",link);
				} else {
					jQuery(this).attr("href",link + "#" + page);
				}
			}
		}
	});
}

function switchPageTo(page) {
	prevContentHeight = jQuery("#content-wrap").height();
	
	jQuery("#content-wrap .content.active, a.page-link-to.active").removeClass("active");
	jQuery("#content-wrap #content-" + page + ".content, a#" + page + ".page-link-to").addClass("active");
	
	jQuery("#content-wrap").scrollTop(0);
	
	pagename = page;
	
	resetContentHeight();
	
	updateCrossPageLinks("content-" + page);  
}
	
function resetContentHeight() {
	var newContentHeight = jQuery("#content-wrap .content.active").height()+30;	
	
	var maxHeight = maxContentHeight;
	
	if (pagename == "news")
		maxHeight = maxContentHeightNews;
	
	var setContentHeight = max(minContentHeight,min(newContentHeight,maxHeight));
	
	var plannedSetContentHeight= setContentHeight;
	
	var actHeadHeight = $("#image-top-outer").height();
	
	var heightDiff = plannedSetContentHeight - prevContentHeight; /* Wächst um heightDiff Pixel */
	var plannedHeadHeight = actHeadHeight - heightDiff;
	
	
	if (plannedHeadHeight < minHeadHeight) {
		setContentHeight = jQuery(window).height() - minHeadHeight;
	}

	/*
	alert("Available vertical Screen Space: " + jQuery(window).height() + "\n\nprevContentHeight: " + prevContentHeight + "\nplannedSetContentHeight: " + plannedSetContentHeight + "\nheightDiff: " + heightDiff + "\n\nplannedHeadHeight: " + plannedHeadHeight + "\nminHeadHeight: " + minHeadHeight + "\n\n\nFINAL setContentHeight: " + setContentHeight);
	*/
	
	
	/* AB HIER NUR Animationslogik */
	
	var bumpBackGap = 10;
	var bumpBackTime = 130;
	if (jQuery("#content-wrap").height() > setContentHeight)
		bumpBackGap *= -1;
	else if (jQuery("#content-wrap").height() == setContentHeight)
		bumpBackGap = 0;
	
	if (bumpBackGap != 0) {
		/* Animierter Wechsel (slide) */
		jQuery("#content-wrap").animate({
			height: setContentHeight + bumpBackGap
		}, 400).animate({
			height: setContentHeight
		}, bumpBackTime);

		jQuery("#image-top-outer").animate({
			bottom: setContentHeight + bumpBackGap
		}, 400).animate({
			bottom: setContentHeight
		}, bumpBackTime);
	}
}

function max(a,b) {
	return a>b?a:b;
}

function min(a,b) {
	return a<b?a:b;
}

function querySt(ji) {
	hu = window.location.search.substring(1);
	gy = hu.split("&");
	for (i=0;i<gy.length;i++) {
	ft = gy[i].split("=");
	if (ft[0] == ji) {
	return ft[1];
	}
	}
}
