$(document).ready(function() {
	initfancybox();
	
/*if(window.location.hash.replace(urldef,"")!=""){
$("#iframefake").fancybox({
'zoomSpeedIn': 300,
'zoomSpeedOut': 300,
'overlayShow': true,
'frameWidth' : 600,
'frameHeight' : 500,
'overlayOpacity':0.5,
'easingIn' : 'easeOutBack',
'callbackOnClose':function(){window.location.hash ="init";}});
$("#iframefake").trigger('click');
}*/
 
});

function initfancybox(){
	$("a.products").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': true,
		'frameWidth' : 670,
		'frameHeight' : 600,
		'overlayOpacity':0.5,
		'easingIn' : 'easeOutBack',
		'showCloseButton':false,
		'callbackOnClose':function(){window.location.hash ="init";},
		'callbackOnStart':function(){window.location.hash ="init";}
		});
	
	$("a.shop").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': true,
		'frameWidth' : 470,
		'frameHeight' : 300,
		'overlayOpacity':0.5,
		'easingIn' : 'easeOutBack',
		'showCloseButton':false,
		'callbackOnClose':function(){window.location.hash ="init";}
		});
	
	$("a.events").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': true,
		'frameWidth' : 670,
		'frameHeight' : 400,
		'overlayOpacity':0.5,
		'easingIn' : 'easeOutBack',
		'showCloseButton':false,
		'callbackOnClose':function(){window.location.hash ="init";}
		});
	
	if(window.location.hash.indexOf("prod=")==1){
		if(window.location.hash.replace("#prod=","")!=""){
			var lnk=window.location.hash.replace("#prod=","");
			setTimeout("executefancybox('"+lnk+"')",1000);
	     	}
	}
}

function executefancybox(id){
	var ldng = document.createElement("a");
	ldng.id = "fakefancybox";
	ldng.className="iframe";
	ldng.innerHTML="<img src='images/void.gif' border='0'>";
	ldng.href="http://www.universalmusic.pt/products.php?id="+id;
	document.getElementById("headerup").appendChild(ldng);
	$("#fakefancybox").fancybox({
		'zoomSpeedIn': 300,
		'zoomSpeedOut': 300,
		'overlayShow': true,
		'frameWidth' : 670,
		'frameHeight' : 600,
		'overlayOpacity':0.5,
		'easingIn' : 'easeOutBack',
		'hideOnContentClick':false,
		'showCloseButton':false,
		'callbackOnClose':function(){window.location.hash ="init";},
		'callbackOnStart':function(){window.location.hash ="init";}
		});
	$("#fakefancybox").trigger('click');
}
