$(document).ready(function(){
						   
	/*-------------------------------
		Tile p img fix
	--------------------------------*/
	$('.tile p').has('img').css({'padding' : '0px'});
	$('.tile.home').append('<div class="arrow"></div>');
	
	
	/*-------------------------------
		Twitter Bird
	--------------------------------*/
	$('.twitter-hit').hover(function(){
		$(this).css({'width' : '260px', 'height' : '74px', 'top': '9px'})					 						 
		$('.twitter-text').stop().fadeTo(200, 1);
	}
	,
	function(){
		$('.twitter-text').stop().fadeTo(200, 0, function(){
			$('.twitter-text').hide();								  
			$('.twitter-hit').css({'width' : '20px', 'height' : '19px', 'top': '64px'})
		});
	});
	
	
	
	/*-------------------------------
		Contact Drop Down
	--------------------------------*/
	var contactOpen = false;
	$('a[title="Contact"]').click(function(){
		if(contactOpen == false)
		{
			contactOpen	= true;						
			//$(this).html(' hide ');
			$('.contact').stop().slideDown(1000);
		}
		else
		{
			contactOpen	= false;						
			//$(this).html('Contact');
			$('.contact').stop().slideUp(1000);
		}
		return false;
	});
	
	$('.contact-form .validation_message').hover(function(){
		$(this).fadeTo(100, 0, function(){$(this).hide();});
	});
	
	$('.contact-form li').hover(function(){
		$(this).find('.validation_message').fadeTo(100, 0, function(){$(this).find('.validation_message').hide();});
	});
	
	if($('.contact').find('.gfield_description.validation_message').length != 0)
	{
		var contactOpen = true;
		$('.contact').stop().show();
	}
	
	
	
	/*-------------------------------
		Post Content FancyBox
	--------------------------------*/
	$('.post-content img').each(function(){
		if($(this).attr('width') >= 530)
		{
			$(this).removeAttr('width');
			$(this).removeAttr('height');

		}
	});
	
	$('.post-content a:has(img)').fancybox({
		'padding'			: 0,
		'centerOnScroll' 	: false,
		'overlayColor'		:'#fff',
		'overlayOpacity'	: .7,
		'autoScale'			: false
	});
	
	
	
	/*-------------------------------
		Products Thumb Hover
	--------------------------------*/
	$('.products .thumb').hover(function(){
		$(this).find('a.title').stop().fadeTo(200, 1);
	}
	,
	function(){
		$(this).find('a.title').stop().fadeTo(200, 0);
	});
	
	
	/*-------------------------------
		Home Slider
	--------------------------------*/
	var currentSlide = 1;
	var totalSlides = $('.hero-image .slides li').size();
	var liWidth = 940;
	var time = setTimeout(nextSlide, 6000);
	
	$('.hero-image p.slide-nav a:first').addClass('active');
	$('.hero-image .slides').scrollLeft(0);
	
	$('.hero-image p.slide-nav a').click(function(){
		clearTimeout(time);
		clearInterval(time);
		currentSlide = parseInt($(this).attr('href'));
		$('.hero-image .slides').stop().animate({scrollLeft : (currentSlide-1) * liWidth}, 1000);
		$('.hero-image p.slide-nav a').removeClass('active');
		$(this).addClass('active');
		time = setTimeout(nextSlide, 7000);
		return false;
	});
	
	function nextSlide()
	{
		currentSlide++;
		if(currentSlide > totalSlides)
		{
			currentSlide = 1;
		}
		$('.hero-image .slides').stop().animate({scrollLeft : (currentSlide-1) * liWidth}, 1000);
		$('.hero-image p.slide-nav a').removeClass('active');
		$('.hero-image p.slide-nav a[href='+currentSlide+']').addClass('active');
		
		time = setTimeout(nextSlide, 7000);
	}
	
	$('.hero-image .slides').hover(
		function(){
			clearTimeout(time);
			clearInterval(time);
		}
		,
		function(){
			time = setTimeout(nextSlide, 2000);
		}
	);
	
	
	/*-------------------------------
		Blog Search
	--------------------------------*/
	$('.widget_search input#s').attr('value', '');
	$('.widget_search input#s').focus(function(){
		$(this).parent().find('label').fadeTo(100, 0, function(){$(this).hide();});
	});	
	$('.widget_search input#s').blur(function(){ 								  
         if ($(this).val() == ''){  
             $(this).parent().find('label').fadeTo(100, 1);
         }  
     });  
	
	
	/*-----------------------------------
		Remove Product Images Links
	------------------------------------*/
	$('.product-images a:has(img)').removeAttr('href');
	
});