$('document').ready(function(){
		
		$('.curve').cornerz();				/* curves */
		
		$('#newsLetterHeader').cornerz({
			corners: "tl tr"
		});
		
		$('#newsLetterForm').cornerz({
			corners: "bl br"
		});
		
		$('#header_menu div').cornerz({
			corners: "tr"
		});
		
	 	/* Basic Form Interaction */
		$('.newsLetterForm input[type=text]').focus(function(){
			formValue = this.value;
			this.value = "";
		}).blur(function(){
			this.value = trim(this.value,' ');
			
			if(this.value.length == 0){
				this.value = formValue;
				formValue = "";
			}
		});
	
	/**
	*  		Javascript trim, ltrim, rtrim
	*  		http://www.webtoolkit.info/
	**/
	function trim(str, chars) {
		return ltrim(rtrim(str, chars), chars);
	}
	 
	function ltrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
	}
	 
	function rtrim(str, chars) {
		chars = chars || "\\s";
		return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
	}
	
	/**
	 * 
	 * 	Page menu child link fix ( sorts out the positions of the arrow and colouring of the parent link )
	 * 
	 **/
	$('#pageMenu').ready(function(){
		var subMenu = $('#pageMenu ul#nav-secondary li.active');
		
		// Check to see if the currently active menu node has any children (length is greater than two)
		if(subMenu.children().length > 1){
			subMenu.children('a').attr('style','color:red');
			subMenu.attr('style','background-position: 100% 16%');
		}	
	});
});
