/* --
	General Javascript
	Last Edited: August 5, 2010
-- */

//Text Replacements
Cufon.replace('#nav',{hover: true});
Cufon.replace('h2',{hover: true})('h3',{hover: true})('h4',{hover: true});
Cufon.replace('.read_more',{hover: true});
Cufon.now();

/* -- jQuery Action -- */

$(document).ready(function(){

	//Featured Posts
	$("#featured_container").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, false);  

	/*
		Rounded corners don't seem to work in internet explorer 6
		without throwing 1000 errors so we are going to check
		the browser version before we execute the roundies
	*/
	if ( (!$.browser.msie) && ($.browser.version != '6.0') ) {
		
		//Let's round some boxes
		$('#top_ad_container').corner("top 5px");
		$('#nav li a').corner("top 5px");
		$('.front_post_content').corner("top 5px");
		$('.front_post_nav').corner("bottom 5px");
		$('#countries_container').corner("5px");
		$('#email_sub_submit').corner("5px");
		$('#feed_counters').corner("5px");
		$('.postmetadata').corner("5px");
		$('#find_us').corner("5px");
		$('.read_more a').corner("5px");
		$('input[type=submit]').corner("5px");
		$('.grey_box').corner("5px");
		$('ul#top_nav').corner("bl 5px");
		$('.comment_text').corner("5px");
		$('ul#social_icons').corner("left 5px");
		$('ul#translate').corner("bottom 5px");
		$('div.blog_divider').corner("5px");
		$('blockquote').corner("5px");
	
	}

	//Input Overtext
	$('input[type="text"]').addClass("off");
		$('input[type="text"]').focus(function() {
			$(this).removeClass("off").addClass("on");
	    if (this.value == this.defaultValue){ 
	    	this.value = '';
		}
		if(this.value != this.defaultValue){
			//this.select();
		}
	});
	$('input[type="text"]').blur(function() {
	
		if(this.value == this.defaultValue){
			$(this).removeClass("on").addClass("off");
		}
	    if ($.trim(this.value) == ''){
	    	$(this).removeClass("on").addClass("off");
	    	this.value = (this.defaultValue ? this.defaultValue : '');
	    	
		}
	});
	
	$('#cat').change(function(){ window.location.replace('/?cat=' + this.value); });
	$('#archives').change(function(){ window.location.replace(this.value); });
	
	//Nav Hover Effects
	$('ul#nav li:not(.active) a').hover(
		function(){
				$(this).animate({backgroundColor: "#3c697e"});
		},
		function(){
			$(this).animate({backgroundColor: "#4b7b91"});
		}
	);

});


