// lodjixmedia.net feature box and work content control
//** Author lodjixmedia Interactive Agency - Nicholas Williams
//** Created May 5th, 10'
//** Updated May 10th, 10'

function cufonMe() {
Cufon.set('fontFamily', 'Century Gothic').replace('h2', { hover: true });
Cufon.set('fontFamily', 'Century Gothic').replace('h4', { hover: true });
Cufon.set('fontFamily', 'Am Sans light').replace('h3', { hover: true });
Cufon.set('fontFamily', 'Am Sans light').replace('#port li a', { hover: true }); 
}

// Feature block control and effects

fade_slide_caption = function(next, previous)
	{
		caption_container = $('.title-text')
		caption_container.fadeOut('fast')
	}
		
update_slide_caption = function(next, previous)
	{
		caption_container = $('.title-text')
		caption = $('.f-title', previous)
		caption_container.fadeIn('fast')
		caption_container.html(caption.html())
	}


function portFX() {
$(".homebox").hover(function() {
	 $(this).stop();						 
    $(".homebox-label", this).animate({ opacity: 1 }, 300);
    }, function() {
	 $(this).stop();
    $(".homebox-label", this).animate({ opacity: 0 }, 500);
});
}

function blogFX() {
$(".blogIMG, #imgbox").hover(function() {
	 $(this).stop();						 
    $(".homebox-label", this).animate({ opacity: 1 }, 300);
    }, function() {
	 $(this).stop();
    $(".homebox-label", this).animate({ opacity: 0 }, 500);
});
}
	
function imgEffects() {
    $(".hover").hover(function() {
    $(this).stop();
    $(this).animate({ opacity: 1 }, 300);   
    }, function() {
    $(this).stop();
    $(this).animate({ opacity: 0 }, 500);
});
}

function linkEffects() {
$(".more a, #archives a").hover(function() {
    $(this).stop();
    $(this).animate({ color: "#0038EF" }, 400);
    }, function() {
    $(this).stop();
    $(this).animate({ color: "#ADADAD" }, 500);
});
}

function formFX() {
$("#submit").hover(function() {
    $(this).stop();
    $(this).animate({ color: "#FFFFFF", backgroundColor: "#E355A5" }, 400);
    }, function() {
    $(this).stop();
    $(this).animate({ color: "#626262", backgroundColor: "#DADADA" }, 500);
});
}

function lmFX() {
$("#lm a").hover(function() {
    $(this).stop();
    $(this).animate({ color: "#47C6E0" }, 400);
    }, function() {
    $(this).stop();
    $(this).animate({ color: "#FFFFFF" }, 500);
});
}

function linkFx() {
$("#content a, a.sign, p.more a").hover(function() {
    $(this).stop();
    $(this).animate({ color: "#000000" }, 400);
    }, function() {
    $(this).stop();
    $(this).animate({ color: "#00AEEF" }, 500);
});
}

// Define the ajax pagination  

function paginateMe() {
	
	// Check for hash value in URL
	var hash = window.location.hash.substr(1);
	var href = $("#wp_page_numbers a, #port li a").each(function(){
	var href = $(this).attr('href');
	if(hash==href.substr(0,href.length-5)){
		var toLoad = hash+'.html #stage';
		$('#stage').load(toLoad)
	}
	});

    
    $("#wp_page_numbers a, #port li a").click(function() {
	// adjust loader for FF offset 
	//if ($.browser.mozilla) {
	//$('#load').css("top", "722px");	
	//}						

    var toLoad = $(this).attr("href")+" #stage";
     $("#stage").fadeOut('fast',loadContent);
	 // $('#load').remove();  
	 // $('#fixedRow').append('<div id="load">&nbsp;</div>');  
	 $('#load').fadeIn('fast'); 
     // window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
	
    function loadContent() {  
     $(this).load(toLoad,showNewContent);
    }
     
    function showNewContent() {  
     $(this).fadeIn('slow',hideLoader);  
      paginateMe();
      portFX();
	  blogFX();
	  cufonMe();
    }

    function hideLoader() {
    	$('#load').fadeOut('fast');
    }
     
    return false;

});
	
}

function selectME() {

$("#port li a").click(function() {
	$("#port li a").removeClass("selected");				   
	$("#port li a").css("background-color", "");
	$(this).css("background-color", "#EDEDED");
});
}

