// scroll back to top
var $ = jQuery.noConflict(); 

//cufon
Cufon.replace('h1, h2, h3, h4, h5, h6, label, .nombre_logo');
Cufon.replace('.mainMenu> li > a',{
						  hover: true						             
			});
Cufon.replace('.postNextPrev > a',{
						  hover: true						             
			});
		
$(document).ready(function() {
			//bg switch
$('.bgSwitcher').click(function(e){
            e.preventDefault();
		   $("body").css("background", "#000 url('" + $(this).attr("href") + "') fixed");
    });

   $(".mainMenu li:last-child").addClass("lastMenuChild");	
   $(".subMenu li:last-child").addClass("lastSubMenuChild");

/* top menu */
$(".mainMenu > li").hover(function() {   
    $(this).stop().find(".subMenu").animate({ 
                                 height: "show"
                                 },150);

},function(){
    $(this).stop().find(".subMenu").delay(300).animate({
                                 height: "hide"
                                 },150);
    });

//back to top	
   $('.backToTop').click(function(e) {
      e.preventDefault(); $('html, body').animate( {
         scrollTop : 0}
      , 800, 'easeOutCubic'); return false; }
   ); 
   
   
//animate portfolio items and posts on load   
var delayAni = 150;
$(".portfolioItem1").css({opacity:0});
$(".portfolioItem2").css({opacity:0});
$(".portfolioItem3").css({opacity:0});
$(".smallPost").css({opacity:0});

$(".portfolioItem1").each(function() {
														 
      $(this).delay(delayAni).animate({opacity:1}, 300); delayAni += 150; }
   ); 
$(".portfolioItem2").each(function() {
														 
      $(this).delay(delayAni).animate({opacity:1}, 300); delayAni += 150; }
   ); 

$(".portfolioItem3").each(function() {
														 
     $(this).delay(delayAni).animate({opacity:1}, 300); delayAni += 150; }
   );

$(".smallPost").each(function() {
														 
     $(this).delay(delayAni).animate({opacity:1}, 300); delayAni += 150; }
   );
   
//animate portfolio items and post image on hover
 $(".oneColumnImage").hover(function() {
    $(this).animate({ 
                                 opacity: 0.8
                                 },200, "easeOutCubic");

},function(){
    $(this).animate({
                                 opacity: 1
                                 },200, "easeOutCubic");
    });
 
 $(".slideThumb").hover(function() {
    $(this).animate({ 
                                 opacity: 0.8
                                 },200, "easeOutCubic");

},function(){
    $(this).animate({
                                 opacity: 1
                                 },200, "easeOutCubic");
    });
   

 $(".twoColumnsImage").hover(function() {
    $(this).animate({ 
                                 opacity: 0.8
                                 },200, "easeOutCubic");

},function(){
    $(this).animate({
                                 opacity: 1
                                 },200, "easeOutCubic");
    });


   
$(".threeColumnsImage").hover(function() {
    $(this).animate({ 
                                 opacity: 0.8
                                 },200, "easeOutCubic");

},function(){
    $(this).animate({
                                 opacity: 1
                                 },200, "easeOutCubic");
    });

$(".frontItemImage").hover(function() {
    $(this).animate({ 
                                 opacity: 0.8
                                 },200, "easeOutCubic");

},function(){
    $(this).animate({
                                 opacity: 1
                                 },200, "easeOutCubic");
    });

$(".smallPostImage").hover(function() {
    $(this).animate({ 
                                 opacity: 0.8
                                 },200, "easeOutCubic");

},function(){
    $(this).animate({
                                 opacity: 1
                                 },200, "easeOutCubic");
    });


$(".postLargeImage").hover(function() {
    $(this).animate({ 
                                 opacity: 0.8
                                 },200, "easeOutCubic");

},function(){
    $(this).animate({
                                 opacity: 1
                                 },200, "easeOutCubic");
    });


$(".widgetTabsThumb").hover(function() {
    $(this).animate({ 
                                 opacity: 0.8
                                 },200, "easeOutCubic");

},function(){
    $(this).animate({
                                 opacity: 1
                                 },200, "easeOutCubic");
    });

// animate social links
$('.postSocialIcon').hover(
							  function(){
			
		$(this).stop().animate({opacity:0.7}, 200);
		
	},
	function(){
		
		$(this).stop().animate({opacity:1}, 200);
	
});

$('.footerIcon').hover(
							  function(){
			
		$(this).stop().animate({opacity: 0.7}, 200);
		
	},
	function(){
		
		$(this).stop().animate({opacity: 1}, 200);
	
});
// cycle plugin
$('#sliderOne').cycle({

	        fx:     'fade',  // effect
			sync:          1,     // true if in/out transitions should occur simultaneously 
            easing: 'linear', // set the easing you want , easeInElastic, easeOutBack  ...
	        speed:  700,    // speed of transition
	        timeout: 3200,    // timeout of the slide
            pause:       false,     // true to enable "pause on hover"
            pauseOnPagerHover: false, // true to pause when hovering over pager link
	        pager:  '#sliderNavList',
	        pagerAnchorBuilder: function(idx, slideModule) {
	            // return sel string for existing anchor
	            return '#sliderNavList li:eq(' + (idx) + ') a';
	        },
			next:   '#nextSlideOne',
            prev:   '#prevSlideOne',
            cleartypeNoBg: true,  // fix cleartype inside slides
            cleartype: true  // fix cleartype inside slides
	    });
       
		
$('#itemsSlider').cycle({

	        fx:     'scrollLeft',  // effect
			sync:          1,     // true if in/out transitions should occur simultaneously 
            easing: 'easeOutQuad', // set the easing you want , easeInElastic, easeOutBack  ...
	        speed:  1200,    // speed of transition
	        timeout: null,    // timeout of the slide
            pause:       false,     // true to enable "pause on hover"
            pauseOnPagerHover: false, // true to pause when hovering over pager link
            next:   '#nextSlide',
            prev:   '#prevSlide',
            cleartypeNoBg: true,  // fix cleartype inside slides
            cleartype: true  // fix cleartype inside slides
	    });

$('.featuredPostsSlider').cycle({

	        fx:     'fade',  // effect
			sync:          1,     // true if in/out transitions should occur simultaneously 
            easing: 'linear', // set the easing you want , easeInElastic, easeOutBack  ...
	        speed:  600,    // speed of transition
	        timeout: 3000,    // timeout of the slide
            pause:       false,     // true to enable "pause on hover"
            pauseOnPagerHover: false, // true to pause when hovering over pager link
            next:   '#nextBSlide',
            prev:   '#prevBSlide',
            cleartypeNoBg: true,  // fix cleartype inside slides
            cleartype: true  // fix cleartype inside slides
	    });

//tips
$("a.footerIcon").tipTip({maxWidth: "auto", edgeOffset: 5});
		
//jquery tabs	
$(".pageNumbers > ul").tabs("div.portfolioWrap > ul li",{
			effect: 'fade',
			fadeSpeed: 300
							});
$("ul.widgetTabs").tabs(".widgetTabsLists > li",{
		    effect: 'fade',
		    fadeSpeed: 300,
			history: false
							});



  }); //ducument ready ends
