// Showroom new file
function showshowroom() { // Open Showroom
    $("#showroombg").fadeTo(1, 0).hide().fadeTo(500, 0.75);
    $("#showroom").css({"width": "100%", "height": "650px"}).fadeTo(500, 1);
    $("#showroom-content").css({"width": "1000px", "height": "650px"}).fadeTo(500, 1);
    $("html,body").animate({scrollTop: $("#logo").offset()}, 500); 
    $("#mycontent").css({"width": "1000px", "height": "650px"});
    $("#pdf-download").delay(2000).fadeIn("fast");	
    			
    return false;
}

function closeshowroom() { // Close Showroom
    $("#showroombg").fadeTo(500, 0, function() { $(this).hide(); });
    $("#showroom").fadeTo(500, 0);
    $("#showroom-content").fadeTo(1, 0);
    $("#showroom").css({"width": "0px", "height": "0px"});
    $("#showroom-content").css({"width": "1px", "height": "1px"});
    $("#mycontent").css({"width": "1px", "height": "1px"});
    return false;
}

$(document).ready(function() {
	
		loadISSUU();
		
		$("#showroom").fadeTo(1, 0);
		$("#showroom-content").fadeTo(1, 0);
		
		
		//Load Issuu
		    
   		function loadISSUU() {
   		   	
   		   	var attributes = {
   		   	  id: "issuuViewer"
   		   	};
   		   	
   		   	var params = {
   		   		allowfullscreen: "true",
   		   		allowScriptAccess: "always",
   		   		menu: "false",
   		   		wmode: "transparent"
   		   	};
   		
   		   	var flashvars = {
   		   		jsAPIInitCallback: "issuuloaded",
   		   		jsAPIClientDomain: "http://hotel.rosenthal.de",
				mode: "embed",
   		   		layout: "http://hotel.rosenthal.de/issuu/layout/layout.xml",
   		   		showFlipBtn: "true",
   		   		documentId: "111102131024-04e948929afc4e749ec511c5d870778e",
   		   		docName: "rosenthal_hotel_katalog",
   		   		username: "code64",
   		   		loadingInfoText: "in%20best%20hands%20-%20Rosenthal%20Hotel%20%26%20Restaurant%20Service%202012%2F2013",
   		   		et: "1299845474729",
   		   		er: "35"
   		   	};
   		   	
   		  	swfobject.embedSWF("http://static.issuu.com/webembed/viewers/style1/v1/IssuuViewer.swf", "myContent", "930", "660", "9.0.0","http://www.rosenthal.de/javascripts/swfobject/expressInstall.swf", flashvars, params, attributes);
   		  };
        
   		$(".sortimentAuswahl").bind("click", function() { // Showroom Link
   		 
   		 	showshowroom(); // Showroom �ffnen
			
			var setPage = $(this).find("a").attr("rel");
			
			$(function() {
			  	setTimeout(loadPage, 1500);
			});
			
			function loadPage() {
			  	document.getElementById("issuuViewer").setPageNumber(setPage);
			}
			
			return false;
		}); 
		
		$(".sortimentAuswahl2").bind("click", function() { // Showroom Link
   		 
   		 	showshowroom(); // Showroom �ffnen
			
			var setPage = $(this).find("a").attr("rel");
			
			$(function() {
			  	setTimeout(loadPage, 1500);
			});
			
			function loadPage() {
			  	document.getElementById("issuuViewer").setPageNumber(setPage);
			}
			
			return false;
		}); 
		$(".showroom").bind("click", function(){
			showshowroom();
		});		

		//Close-Button
		$("#closure-sr").bind("click", function() {
		    closeshowroom();
		    return false;
		});	
		
		// Close Slider with ESC
	$(document).bind("keydown", function(e){
		if(e.which==27){
			closeshowroom();
	        }
	        else {
	          //
	        }
	});
    });
