/*
 * Be careful, this lib use JQuery from the 1.3.1
 * 
 */

$(document).ready(function(){
/*-------------------------------------------------------------------------
 * Clear form. Something like reset() for jQuery
 */
	$.fn.clearForm = function() {
	  return this.each(function() {
	 var type = this.type, tag = this.tagName.toLowerCase();
	 if (tag == 'form')
	   return $(':input',this).clearForm();
	 if (type == 'text' || type == 'password' || tag == 'textarea')
	   this.value = '';
	 else if (type == 'checkbox' || type == 'radio')
	   this.checked = false;
	 else if (tag == 'select')
	   this.selectedIndex = -1;
	  });
	};
/*-------------------------------------------------------------------------
 * Remove the blur on each <a /> and <input type="submit" />
 */
	$('a').livequery('click', function(event) {
		$(this).blur();
	});
	$("input[type='submit']").click(function () {
		$(this).blur();
	});
/*-------------------------------------------------------------------------
 * Change the target of each link with the .blank class
 */
	$('.blank').livequery('click', function(event) {
		$(this).blur();
		$(this).attr("target","blank");
		window.open($(this).attr("href"));
		return false;
	});

});

/* CLASS > Here, I don't need to use $(document).ready() from JQuery
 * -------------------------------------------------------------------------
 * CLASS : Regex
 */
	function Regex()
	{
		this.email = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;
		
		this.check = function($regex, $value)
		{
			var $conditionIf = eval("this."+$regex+".test('"+$value+"')");
			if(!$conditionIf){return false;}
			else{return true;}
		}
	}
/*-------------------------------------------------------------------------
 * Load images as if it was an ajax call
 */

$.fn.loadImg = function(container, src){
	var img = new Image();
	$(img).load(function(){
		$(this).hide();
		$(container).removeClass('loading').append(this);
		$(this).fadeIn();
	}).error(function(){
	
	}).attr('src', src);
}




	