function Katalog_starten () {
    window.open (baseURL + "static/swf/pageflip/pageflip.php", "AmaKatalog","width=960,height=656,scrollbars=yes,resizable=yes,status=no");
}

function Katalog_starten_goTo_Page (page)
{
    window.open (baseURL + "static/swf/pageflip/pageflip.php?page=" + page, "AmaKatalog","width=960,height=656,scrollbars=yes,resizable=yes,status=no");
}

function Broschuere_starten () {
    window.open (baseURL + "static/swf/pageflip_kaesebroschuere/pageflip.php", "AmaBroschuere","width=960,height=656,scrollbars=yes,resizable=yes,status=no");
}

function Broschuere_starten_goTo_Page (page)
{
    window.open (baseURL + "static/swf/pageflip_kaesebroschuere/pageflip.php?page=" + page, "AmaBroschuere","width=960,height=656,scrollbars=yes,resizable=yes,status=no");
}

$(document).ready (function ()
{

/*var enteredUser = "";
    var enteredPass = "";

	var ajaxRequest = false; 
	var naviRecipeTop = "";
	var naviRecipeTopOrig = "";
	var openTitle = "";
	
	var container = $('div.sliderGallery');
	var ul = $('ul', container);
	var itemsWidth = null;		
	itemsWidth = ((136 * parseInt(ul.find("li").size())) - container.outerWidth());
	
	//$(document).pngFix();
	
	if (!jQuery.browser.msie)
	{
		itemsWidth = itemsWidth + 20;
		if (parseInt(ul.find("li").size()) > 10)
			itemsWidth = itemsWidth + 10;
		if (parseInt(ul.find("li").size()) > 20)
			itemsWidth = itemsWidth + 15;
		if (parseInt(ul.find("li").size()) > 30)
			itemsWidth = itemsWidth + 20;
	}
	else
	{
		itemsWidth = itemsWidth - 20;
		if (parseInt(ul.find("li").size()) > 10)
			itemsWidth = itemsWidth - 20;
		if (parseInt(ul.find("li").size()) > 20)
			itemsWidth = itemsWidth - 40;
		if (parseInt(ul.find("li").size()) > 30)
			itemsWidth = itemsWidth - 20;		
	}
	
	//alert(itemsWidth);
	$('.slider', container).slider(
	{
		minValue: 0,
		maxValue: Math.abs (itemsWidth),
		handle: '.handle',
		stop: function (event, ui)
				{
					ul.animate({'left' : ui.value * -1}, 500);
				},
		slide: function (event, ui)
				{
					ul.css('left', ui.value * -1);
				}
	});
	
	if (parseInt(ul.find("li").size()) <= 4 && jQuery.browser.msie)
	{
		$('.slider').hide();
	}

	$('.recipeRow').click(function()
	{	
		if(ajaxRequest == false)
		{
			recipeId = $(this).attr("id");
			categoryId = $(this).attr("catid");
			task = "recipe";
			jsonUrl = baseURL + "index.php?task=" + task + "&categoryId=" + categoryId + "&id=" + recipeId + "&show=detail&request=json";

			ajaxRequest = true;
			if( $('#product_detail_' + recipeId).css("display") == "none")
			{
				$("#recipeIcon_" + recipeId).hide();
				$("#recipeIconLoading_" + recipeId).show();
	
				$.getJSON(jsonUrl, function(data)
									{
										$('#product_detail_content_' + recipeId).html(data.HTML_DATA);
										ajaxRequest = false;
										$('#product_detail_' + recipeId).toggle('blind', { direction: "vertical" }, 800, function ()
																															{
																																$("#recipeIcon_" + recipeId).show();
																																$("#recipeIconLoading_" + recipeId).hide();
										});
									});
			}
			else
			{
				ajaxRequest = false;
				$('#product_detail_' + recipeId).toggle('blind', { direction: "vertical" }, 800);
			}
		}
	});
	
	
	$('.productRow').click(function()
	{
		if(ajaxRequest == false)
		{
			recipeId = $(this).attr("id");
			categoryId = $(this).attr("catid");
			task = "product";
			jsonUrl = baseURL + "index.php?task=" + task + "&categoryId=" + categoryId + "&id=" + recipeId + "&show=detail&request=json";

			ajaxRequest = true;
			if( $('#product_detail_' + recipeId).css("display") == "none")
			{
				$("#recipeIcon_" + recipeId).hide();
				$("#recipeIconLoading_" + recipeId).show();
				$.getJSON(jsonUrl, function(data)
									{
										$('#product_detail_content_' + recipeId).html(data.HTML_DATA);
										ajaxRequest = false;
										$('#product_detail_' + recipeId).toggle('blind', { direction: "vertical" }, 800, function ()
																															{
																																$("#recipeIcon_" + recipeId).show();
																																$("#recipeIconLoading_" + recipeId).hide();
										});
									});
			}
			else
			{
				ajaxRequest = false;
				$('#product_detail_' + recipeId).toggle('blind', { direction: "vertical" }, 800);
			}
		}
	});
	
	
	
	// Erster HIJAX Versuch
	$('a.loadViaJson').click(function()
	{
		/*if(ajaxRequest == false)
		{
			$(".galleryTabTwoActive").attr("class", "galleryTab");
			$(".galleryTabTitleActive").attr("class", "galleryTabTitle");
			
			$(this).parent().attr("class", "galleryTabTitleActive");
			$(this).parent().parent().attr("class", "galleryTabTwoActive");
			
			jsonUrl = $(this).attr("href") + "&request=ajax";

			ajaxRequest = true;
			
			$('#recipeCatContent').toggle('blind', { direction: "vertical" }, 800, function () {
																							 	$('#recipeCatLoading').toggle('blind', { direction: "vertical" }, 800);
																							 });
	
			$.getJSON(jsonUrl, function(data)
								{
									//alert(data.HTML_DATA);
									$('#recipeCatContent').html(data.HTML_DATA);
									ajaxRequest = false;
									$('#recipeCatLoading').toggle('blind', { direction: "vertical" }, 800, function () {
																													 	$('#recipeCatContent').toggle('blind', { direction: "vertical" }, 800);
																													 });
								});
		}
		//return false;
	});
	
	*/
	
/*
	$(".producerRow").click(function ()
	{
		$('#' + $(this).attr("id") + '_detail').toggle('blind', { direction: "vertical" }, 800);
	});


	$(".recipeHeadline").click(function()
	{
		if($(document).getUrlParam("show") == "archiv")
		{
			showPastDates = "&show=archiv";
		}
		else
		{
			showPastDates = "";
		}
		window.location.href = baseURL + "index.php?task=news" + showPastDates + "&id=" + $(this).attr("id");
	});

	$(".newsHeadline").click(function()
	{
		window.location.href = $(this).attr("id");
	});

	$(".tipsHeadline").click(function()
	{
		window.location.href = $(this).attr("id");
	});


	$(".dateRow").click(function()
	{
		window.location.href = $(this).attr("id");
	});

	$("#pastDate").click(function()
	{
		if($(this).attr("checked"))
		{
			showPastDates = "Vergangene/";
		}
		else
		{
			showPastDates = "";
			if ($.browser.msie && $.browser.version <= 7)
			{
				showPastDates = "../";
			}			
		}
		
		if ($.browser.msie && $.browser.version <= 7)
		{
			window.location.href = "../" + showPastDates + "Termine/";
		}
		else
		{
			window.location.href = showPastDates + "Termine/";
		}
		
	});

	$(".searchSectionLink a").click(function ()
	{
		$(".searchContainer").hide();
		$($(this).attr("href")).show();
		return false;
	});
	
	
	/*$(".toolTipImage").hover(function ()
	{
		$(this).attr("src", "img/Eingabefeld_icon.png");
	}, function () {
		$(this).attr("src", "img/Eingabefeld_icon.png");
	});
	
	$("#requestRecipeForm").validate();
	$("#sendRecipeForm").validate();
	$("#contactForm").validate();
	$(".sendRecipe").fancybox();
	
	$(".toolTipImage").tooltip({ 
		track: true,
		delay: 0,
		showURL: false,
		showBody: " - ",
		extraClass: "pretty fancy",
		fixPNG: true,
		opacity: 0.95,
		left: -120
	});
	
	$('#loginLink').click (function () {
    	$('#loginArea').toggle('blind', { direction: "vertical" }, 800);
	});
	
	$('#loginLinkLeft').click (function () {
    	$('#loginArea').toggle('blind', { direction: "vertical" }, 800);
		return false;
	});

	
	$(".newsImgBox").fancybox({'hideOnContentClick': true});
	
	$("#tipsImgBox").fancybox({'hideOnContentClick': true});
	$(".fancyImage a").fancybox({'hideOnContentClick': true});
	$(".passwordRemindLink").fancybox({
									  'hideOnContentClick': false,
									  frameWidth: 400,
									  frameHeight: 100
									  });

	$("#searchTabContainer > div > ul").tabs();
	$("#newsTabContainer > div > ul").tabs();
	$("#productTabContainer > ul").tabs();

    if ($('#loginLink').position() != undefined)
    {
	    var container = $('#userForm div.errorContainer');
	    container.css("top", (parseInt($('#loginLink').position().top)-50));
        var validator = $("#userForm").validate({
		    errorContainer: container,
		    errorLabelContainer: $("ul", container),
		    wrapper: 'li',
		    meta: "validate",
		    errorClass: "errorUserLogin",
			onfocusout: false,
			onclick: false,
			onkeyup: false,
		    rules: {
		        loginName: {
		            required: true,
		            remote: baseURL + "index.php?task=login&request=ajax"
		        },
		        loginPass: {
		            required: true
		            //remote: "index.php?task=login&request=ajax&loginUser=" + enteredUser
		        }
		    },
		    messages: {
                loginName: {
                    required: "Sie haben keinen Usernamen eingegeben",
                    remote: "Falscher Username"
                },
                loginPass: {
                    required: "Sie haben kein Passwort eingegeben"
                    //remote: "Falsches Passwort"
                }
            }
	    });
	}
	
	$("#pwdRemindForm").validate();
	
	/*var mouseOverTitle = false;
	
	$(".hoverTitle").hover(function() {
		mouseOverTitle = true;
	}, function() {
		mouseOverTitle = false;
	});*/
});

