$(document).ready(function() {	
						   
	//iehover + cargar ie6.css solo para IE6
	if (jQuery.browser.msie && parseInt(jQuery.browser.version)<7) {
		ie6=true;

		jQuery("head").append("<link>");
		css = jQuery("head").children(":last");
		css.attr({ rel: "stylesheet", type: "text/css", href: "css/ie6.css" });
	}
	
	//Load Fancybox (if needed only)
	if(jQuery("a.hazClick").length != 0 || jQuery("a.recuperarClave").length != 0) {

		jQuery("head").append("<link>");
		css = jQuery("head").children(":last");
		css.attr({ rel:  "stylesheet", type: "text/css", href: "js/fancybox/jquery.fancybox-1.3.1.css" });

		jQuery.getScript('js/fancybox/jquery.fancybox-1.3.1.pack.js', function() {attach_fancybox(0)});
	}
	
	//(if needed only)
	if(jQuery("table").length != 0) {
		jQuery("tr:odd").addClass("zebra");
	}
	
	//Autoselect text fields
	jQuery('input.autoselect').focus(function() {
		if (this.value==this.defaultValue) this.value="";
		//if (this].value==jQuery(this)[0].defaultValue) jQuery(this)[0].value==;
	}); 
	
});	

function attach_fancybox(n) {
	if (typeof(jQuery.fn.fancybox) == "undefined") {
		n=parseInt(n)+1;
		if (n<10) setTimeout("attach_fancybox("+n+")",500);
	} else {
		jQuery("a.hazClick").fancybox({
			'width'				: 505,
			'height'			: '75%',
			'autoScale'     	: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe'
		});

		jQuery("a.recuperarClave").fancybox({
			'width'				: 488,
			'height'			: 154,
			'autoScale'     	: false,
			'scrolling' 		: 'no',
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'titleShow'    		: false,
			'type'				: 'iframe'
		});

	}
}
