/**
 * This document should only contain scripts that are general and could/should be applied to any site
 */

var $j = jQuery.noConflict();

$j(document).ready(function() {
	
	/**
	 * Puts the #text-search label as value for input box. (for cleaner mark up)
	 * Use like this.. setInputFieldValueFromLabel($j('label[@for="text-search"]').html(), '#text-search');
	 *
	 * @param 	{object}		labelContent 	The label content
	 * @param 	{object}		inputFieldId 	The id of the target input field
	 * @return 	{void}
	 */
	$j.fn.setInputFieldValueFromLabel = function(labelContent, inputFieldId){
		$j(inputFieldId).val(labelContent).css('color', '#000');
		
		$j(inputFieldId).blur(function(){
			if($j(inputFieldId).val() == ''){
				$j(inputFieldId).val(labelContent).css('color', '#000');
			}
		});
		
		$j(inputFieldId).focus(function(){
			if($j(inputFieldId).val() == labelContent){
				$j(inputFieldId).val('');
			}
		});
	}

	
	
	/**
	* Function to get rid of target="_blank"
	* Write like this instead.. <a href="somewhere.asp" rel="external">Somewhere</a>
	*/
	$j('a[@rel="external"]').click(function() {
		return !window.open($j(this).attr('href'));
	});
	
});