/* 
* Skeleton V1.0
* Created by Dave Gamache
* www.getskeleton.com
* 5/15/2011
*/	
	
var rootURL = site_url;

var pageTitle = 'LiamR ';
	

$(document).ready(function() {

	/* Tabs Activiation
	================================================== */
	var tabs = $('ul.tabs'),
	    tabsContent = $('ul.tabs-content');
	
	tabs.each(function(i) {
		//Get all tabs
		var tab = $(this).find('> li > a');
		tab.click(function(e) {
			
			//Get Location of tab's content
			var contentLocation = $(this).attr('href') + "Tab";
			
			//Let go if not a hashed one
			if(contentLocation.charAt(0)=="#") {
			
				e.preventDefault();
			
				//Make Tab Active
				tab.removeClass('active');
				$(this).addClass('active');
				
				//Show Tab Content
				$(contentLocation).show().siblings().hide();
				
			} 
		});
	}); 
	
	
	  
	$.supersized({
					//Background image
					slides	:  [ { image : site_url + "/blog/wp-content/themes/liamr/images/bgs/phone0.jpg" } ]					
				});
	
	//$.backstretch(site_url + "/blog/wp-content/themes/portfolium/images/bgs/later.jpg", {speed: 150});
	
	$('.post-home').each(function(){
		var parent_height = $(this).find('img').height();  
		var image_height = $(this).find('h2').height(); 
		var top_margin = (parent_height - image_height)/2; 
		$(this).find('h2').css( 'top' , top_margin); 
	});
	
	 
	     
	
	var $container = $('#front-portfolio');
	$container.imagesLoaded(function(){
	  $container.masonry({
	    itemSelector : '.post_home'
	
	  });
	});
	
	//$.backstretch("images/574921242076171.jpg", {speed: 150});
	
	/*$('.clict').click(function(){
		//$.backstretch("images/cat.jpg", {speed: 150});
		$('#container').css('min-height', '10px');
		$(this).animate({
		    opacity: 0.0,
		  }, 1500, function() {
		    // Animation complete.
		  });
		$('.content').animate({
		    opacity: 0.0,
		    height: 'toggle'
		  }, 2000, function() {
		    // Animation complete.
		  });
		$('.nav').animate({
		    opacity: 0.0,
		    height: 'toggle'
		  }, 2000, function() {
		    // Animation complete.
		  });
		return false;
	});
	*/
	$('.post_share').hover(function(){
        $(this).find('.sharelist').slideToggle('fast');
		
		return false;
    });

	
	$(".tooltip_top").tipTip({maxWidth: "auto", edgeOffset: 10, defaultPosition: 'top'});
	$(".tooltip_bottom").tipTip({maxWidth: "auto", edgeOffset: 10, defaultPosition: 'bottom'});
	$(".tooltip_right").tipTip({maxWidth: "auto", edgeOffset: 0, defaultPosition: 'right'});
	$(".tooltip_left").tipTip({maxWidth: "auto", edgeOffset: 10, defaultPosition: 'left'});
	

setupMenu();
	
	//pageSetUp();
	
	//makeAjax();
	
});

function setupMenu(){
	$(".dd li ul").hide();
			$(".dd li a.current").parent().find("ul").toggle();

			$(".dd li a").mouseover(function () {

				$(this).parent().siblings().find("ul").slideUp("normal");
				$(this).next().slideToggle("normal");
				return false;
			});

			$("#nav li a.no-submenu").click(function () {
				window.location.href = $(this).attr("href");
				return false;
			});

    $('.sharethis').click(function(){
        $(this).next('.sharelist').slideToggle('fast');
    });

	//Cat dropd
	$('.tags').mouseover(function(){
		console.log('cat o');
		$(this).find('ul.taglist').show();
	});
	
	$('.tags').mouseout(function(){
		$(this).find('ul.taglist').hide();
	});
}

function checkEmail() {
    var email = document.getElementById('email');
    var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
    if (!filter.test(email.value)) {
        alert('Error: please enter a valid email address.');
        email.focus
        return false;
    }
}

