$.fn.exists = function(){return $(this).length>0;} 

$(document).ready(function(){

	Cufon.replace('h1, .home_icons h2, .latest_news .col_4 h2, .page .heading h2, .contact_form ul li.heading h2', {fontFamily: 'Apex New Book'});
	Cufon.replace('a.button', {fontFamily: 'Apex New Medium'});
	
	//Search box clear (news)
	$('.heading #keywords').blur(function(){
		if (this.value == '') {this.value = 'Search news articles';}
	})
	$('.heading #keywords').focus(function(){
		if (this.value == 'Search news articles') {this.value = '';}
	})
	
	//Header
	$('.header #keywords').blur(function(){
		if (this.value == '') {this.value = 'Search';}
	})
	$('.header #keywords').focus(function(){
		if (this.value == 'Search') {this.value = '';}
	})
	
	
	//add a class to an open sub nav if it has children
	$(".active.sub-level-0").each(function(){
		if($("ul", this).length){
			$("a", this).css({
				borderBottom: "none"
			})
			$("ul", this).css({
				borderBottom: "1px dotted #D6D6D6"
			})
		}
	});
	
	if ( $.browser.msie ) {
		$(".page").before("<div id='page_top'>&nbsp;</div>");
	}
	
});
