﻿var deeplink ="";

/* ----------------------------------------------------------------------------------------
	jQuery - PlugIn - Init 
---------------------------------------------------------------------------------------- */
$(document).ready(function() {

	/* Facebox */
 	$('a[rel*=facebox]').facebox({
        loadingImage : 'media/_interface/loading.gif',
        closeImage   : 'media/_interface/close_square.jpg'
	});

	
	// Deep Link mit Hash direkt eingegeben, oder via bookmark
	if(document.location.hash.length>1)
		{
			var hash = document.location.hash.replace( /^#/, '' );
			document.location.assign(hash);
			
		}
		
	
}); /*jQuery ready - ende */



$(document).bind('afterReveal.facebox', function() { 
	if(document.location.pathname.length <= 1){
		//alert(deeplink);
		document.location.hash =deeplink;
	}
 
})

$(document).bind('close.facebox', function() { 
		document.location.hash ="";
		if(document.location.pathname.length > 1){
			//alert(document.location.pathname.length);
			document.location.pathname="";
		}
})


function setDeepLink(dl){
	//alert("set");
	deeplink = dl;
}





/* ----------------------------------------------------------------------------------------
	Javascript
---------------------------------------------------------------------------------------- */
/* Flash */
var flashvars = {};				
var params = {};
var attributes = {};
var date = new Date();

flashvars.source 	= "media/cases/images/thumb/images.xml?noCache="+date.getTime;
params.wmode 		= "transparent";

swfobject.embedSWF("media/cases/rotation.swf", "flash", 910, 545, "9.0.0", "", flashvars, params, attributes);	

function getFlashMovie(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[movieName] : document[movieName];
}

function openFaceBox(link){	
    var delink = link.replace(".case",".case_dl");
	setDeepLink(delink);
	jQuery.facebox({ iframe: link, rev: "iframe|545"});
}


