//HP tooltips
$(document).ready(function() {
    if ($("#chained2").length > 0){
      $("#chained2").scrollable({circular: true, mousewheel: true});
    }
});
	
// create custom animation algorithm for jQuery called "bouncy"
$.easing.bouncy = function (x, t, b, c, d) {
	var s = 1.70158;
	if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
	return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
}
	
// create custom tooltip effect for jQuery Tooltip
$.tools.tooltip.addEffect("bouncy",

	// opening animation
	function(done) {
		this.getTip().animate({top: '+=15'}, 500, 'bouncy', done).show();
	},

	// closing animation
	function(done) {
		this.getTip().animate({top: '-=15'}, 500, 'bouncy', function()  {
			$(this).hide();
			done.call();
		});
	}
);
		
$(document).ready(function() {
	$("#f6_b a[title]").tooltip({effect: 'bouncy'});
});

//Popups
function openContactInfo(){
        window.open("/sites/streetshirts.co.uk/content/contactpopup.aspx","Window1","width=650,height=450,scrollbars=yes,menubar=no,toolbar=no");
}
function openTerms(){
        window.open("/sites/streetshirts.co.uk/content/termspopup.aspx","Window1","width=650,height=450,scrollbars=yes,menubar=no,toolbar=no");
}
//Measure text width
$.fn.textWidth = function(){
  var sensor = $('<div />').css({margin: 0, padding: 0, width:'100%'});
  $(this).append(sensor);
  var width = sensor.width();
  sensor.remove();
  return width;
};

//Facebook
//$(document).ready(function(){
//    var url = 'http://apps.facebook.com/inflatableicons/image_preview.html?y=120';
//    jQuery("#fblikeblock").html('<fb:like id="fbLike" href="http://www.facebook.com/streetshirts" send="false" width="450" show_faces="false" font="arial"></fb:like>');
 //   FB.XFBML.parse(document.getElementById('fblikeblock'),function(){
 //        $('#fb-root').css({overflow:'hidden', height:'28px', marginBottom:'2px'});
 //        $('.fb_ltr').width('197px').css({overflow:'hidden'});
//    });
//    $('.fb_ltr').width('197px').css({overflow:'hidden'});
//    $('#fb-root').css({overflow:'hidden', height:'28px',  marginBottom:'2px'});
//});

//Overlays
$(document).ready(function(){
    var triggers = $('a[rel]:not([rel="nofollow"])').overlay({

	    // some mask tweaks suitable for modal dialogs
	    mask: {
		    color: '#efefef',
		    loadSpeed: 200,
		    opacity: 0.7
	    },

	    closeOnClick: true
    });
});
