
// --------------------------------------------------------------------
// Ie6 bg flicker fix
// --------------------------------------------------------------------

try { document.execCommand("BackgroundImageCache", false, true); }
catch(err) {}


$(function(){

	/* -------------------------------------------------
	Utility to attach default classes for buttons and textboxes
	------------------------------------------------- */
	$("input").each(function(){	
		var $this = $(this);
		
		if ( ($this.attr("type") == "text") || ($this.attr("type") == "password") ) { 
			$this.addClass('text'); 
		}
		else if ( ($this.attr("type") == "checkbox") ) {
			$this.addClass('checkbox'); 
		}
		else if ( ($this.attr("type") == "submit") || ($this.attr("type") == "button") ) { 
			$this.addClass('button');
		}
	});
	

	/* -------------------------------------------------
	External Links handlers. Used via rel="external"
	------------------------------------------------- */
	$("a[rel='external']").click( function() {
		window.open( $(this).attr('href') );
		return false;
	});
	
	
	/* -------------------------------------------------
	Swap default values for textboxes on focus/blur
	------------------------------------------------- */
	var swapValues = [];
	
	$(".swap_value").each(function(i){
	  swapValues[i] = $(this).val();
	  $(this).focus(function(){
			if ($(this).val() == swapValues[i]) {
				 $(this).val("");
			}
	  }).blur(function(){
			if ($.trim($(this).val()) == "") {
				 $(this).val(swapValues[i]);
			}
	  });
	})

}); //ready
