// JavaScript Document
$(document).ready(function(){
	$('a[rel=blank]').attr("target","_blank");
	
	var navOpenDuration = 500;
	var navCloseDuration = 250;
	var navOpenEasing = "easeInOutExpo";
	var navCloseEasing = "easeInOutExpo";
	var original_height = $("#header").height();
	
	$("#topNav>li").hover(function(){
		$(this).addClass("hover");
		if($(this).find("ul:first").length > 0){
			var new_height = $(this).find("ul:first").hide().css('height','').height() + original_height;
			$(this).find("ul:first").stop().slideToggle(navOpenDuration, navOpenEasing);
			$("#header").stop().animate({height:new_height}, navOpenDuration, navOpenEasing);
		}
	}, function(){
		$(this).removeClass("hover");
		if($(this).find("ul:first").length > 0){
			$(this).find("ul:first").stop().slideToggle(navCloseDuration, navCloseEasing);			
			$("#header").stop().animate({height:original_height}, navCloseDuration, navCloseEasing);
		}
	});
	
	$("#topNav>li>ul>li>a").hover(function(){
		if($(this).attr("rel")){
			$("#navOver").html($(this).attr("rel")).show();
		}
	}, function(){
		$("#navOver").hide();
	});
});
if(typeof Cufon=="function"){
	Cufon.replace('h1').replace('h2').replace('h4');
}
String.prototype.trim=function(){
	a = this.replace(/^\s+/, '');
	return a.replace(/\s+$/, '');
};
String.prototype.toProperCase=function(){
	return this.toLowerCase().replace(/^(.)|\s(.)/g,function($1){return $1.toUpperCase();});
};

