function toggleCurrency(display,currency){
	if (!display){
		if (currency == "showEuro"){
			$("div.prices p.amount").html('<img src="../_assets/img/pricing-euro.png" width="243" height="190" alt="28 Euro" />');	
			$("div.prices p.notice span").hide();
		}
		else {
			$("div.prices p.amount").html('<img src="../_assets/img/pricing-us.png" width="243" height="190" alt="38 USD" />');	
			$("div.prices p.notice span").show();
		}
		$("#showUS").toggleClass("on");	
		$("#showEuro").toggleClass("on");			
	}					
}

$(document).ready(function(){
	
	$(".launch-video").click(function() {
	   $.fancybox({
		 autoscale : false,
		 type : 'iframe',
		 transitionOut: 'none',
		 padding : 0,
		 width  : 640,
		 height : 480,
		 href   : $(this).attr('href'),
		 padding:0, margin:5, titleShow: false, overlayOpacity:0.7
	 });
	 
	  return false;
	});
	
	
	$(".gallery").fancybox({
		 autoscale : false,
		 transitionOut: 'none',
		 padding : 0,
		 padding:0, margin:5, titleShow: false, overlayOpacity:0.7
	 });
	 
	var preload = new Array();
	$('img.roll').each(function (i) {
		//let's preload
		var img = new Image();
		img.src = this.src.replace(/([_-])off([._-])/, '$1over$2');
		preload.push(img);
	});
	$('img.roll').live("mouseover", function () { // over
		$(this).attr('src',this.src.replace(/([_-])off([._-])/, '$1over$2'));
	});
	$('img.roll').live("mouseout", function () { // out
		$(this).attr('src',this.src.replace(/([_-])over([._-])/, '$1off$2'));
	});
	
	//Tips
	$("a.tip").each(function(){
		$(this).tipTip({maxWidth:'300px', content: $("#"+$(this).attr('rel')).html()});
	}).click(function(){return false;});
	
	/*$("a.tip-top").each(function(){
		$(this).tipTip({maxWidth:'300px', defaultPosition:'top'});
	}).click(function(){return false;});
	*/
	
	
	//Expanders
	$(".expandTarget").hide();
	$("a.expand").click(function(){
		var target = $(this).attr('href');
		$(target).slideToggle(300);
		return false;
	});
	
	$("a.tip-top").twipsy({
		placement:'above',
		offset:4
	}).click(function(){return false;});
	
	//popOvers
	$("a.popover-box").popover({
		placement:'above',
		html: true
	}).click(function(e) {
		e.preventDefault()
    });
	
	//Pricing Page
	$("#showEuro, #showUS").click(function(){
		toggleCurrency($(this).hasClass("on"),$(this).attr("id"));
		return false;
	});
	
});
