/*
    *************************
      MAD BEAUTY JAVASCRIPT 
	*************************
	
	Version: 1.0
	Created by: Flipflop Design
	URL: http://www.flipflopdesign.co.uk
	Date: April 2011
	
*/

jQuery.fn.center = function () {  
	$(this).css({'position': 'absolute'}); 
//	var $thisvert = ($(this).parent().height()-$(this).height())/2;
	var $thishori = ($(this).parent().width()-this.width())/2;
//	this.css({'top': $thisvert + 'px'});  
	this.css({'left':50+'%'});
	this.css({'marginLeft':-($(this).width()/2)+'px'});
	return this;
}
	$('.centerthis').center(); 
	$('#sub-nav-bar').css({zIndex : 300});

	
jQuery(document).ready(function($) {
	
		$('.centerthis').center(); 
// Presets
	$('.show').css({opacity : 0});
	$('.opacity-25').css({'opacity' : 0.25});	
	$('.opacity-50').css({'opacity' : 0.5});
	$('.opacity-75').css({'opacity' : 0.75});

	$('.scrolling-content').jScrollPane({
				verticalDragMinHeight: 15,
			verticalDragMaxHeight: 15,
			horizontalDragMinWidth: 15,
			horizontalDragMaxWidth: 15
});
    $("a[rel^='prettyPhoto']").prettyPhoto({
		slideshow: 2500

	});
	
	$('.slide').stop(false,true).slideUp();
	$('.fade').fadeOut();	

	$('.frame-style-1, .frame-style-2, .frame-style-3, .frame-style-4').hover(function(){ 
		$('div', this).addClass('over').removeClass('up');
	},function(){ 
		$('div', this).addClass('up').removeClass('over');
	});	
	
	$('ul#products-list li').biggerlink({
		otherstriggermaster:true
	});
	
	onfocus="this.blur()";
	onclick="this.blur()";
	
	$('.footer-social-networking-link a, .social-networking-link a,').each(function(index, title) {
		var shorten = $(this).attr('title');
		if (shorten.length >= 41) {
			shorten = shorten.substr(0,40);
			$(this).attr('title', shorten);
		};
	});
	
// Hover Functions
	$('.submitBtn').hover(function(){ 
		$(this).addClass('submitBtnHover'); 
	},function(){ 
		$(this).removeClass('submitBtnHover'); 
	});	

	$('.opacity-25').hover(function() {
		$(this).stop(true, false).animate({opacity : 1}, 350);
	}, function() {
		$(this).stop(true, false).animate({opacity : 0.25}, 350);
	});	

	$('.opacity-50').hover(function() {
		$(this).stop(true, false).animate({opacity : 1}, 350);
	}, function() {
		$(this).stop(true, false).animate({opacity : 0.5}, 350);
	});	

	$('.opacity-75').hover(function() {
		$(this).stop(true, false).animate({opacity : 1}, 350);
	}, function() {
		$(this).stop(true, false).animate({opacity : 0.75}, 350);
	});	
	
	$('input, textarea').hover(function() {
		$(this).toggleClass('input-hover');
	}, function() {
		$(this).toggleClass('input-hover');
	});

		$('#single-cart-button input, #navMainSearch input[type="submit"], #Suggestions input[type="submit"], #cartAdd input[type="submit"], .cart-button a, .forward input[type="submit"], .back a, .forward a, .continue-shop-but a').addClass('out');
	$('#single-cart-button input, #navMainSearch input[type="submit"], #Suggestions input[type="submit"], #cartAdd input[type="submit"], .cart-button a, .forward input[type="submit"], .back a, .forward a, .continue-shop-but a').hover(function(){ 
		$(this).removeClass('out').addClass('over');
	}, function(){
		$(this).removeClass('over').addClass('out');
	});
	
/* let's tidy a couple of things up when the browser is resized
	$(window).resize(function() {
		
		$('.centerthis').center();
		
	});
*/
	$("a[href='mailto:%20spam%20protector%20active']").attr('href', 'mailto:sales@madbeauty.com');
	
}); // END DOCUMENT

/*
    ******************************
      END: MAD BEAUTY JAVASCRIPT 
	******************************
*/
