var ie6 = ($.browser.msie && $.browser.version == 6.0) ? true : false;
var ie7 = ($.browser.msie && parseInt($.browser.version) == 7) ? true : false;

$(document).ready(
	function() {
		var selector = (ie6 || ie7) ? '.destacados:first > LI > DIV' : '.destacados:first > LI';
		$(selector).each(function(){
			$(this).bind("mouseenter", function() {
				var selector = (ie6 || ie7) ? '.destacados:first > LI > DIV > A > IMG' : '.destacados:first > LI';
				$(selector).stop().css({ opacity: 1 });
				$(this).fadeTo(300,0.6);
			}).bind("mouseleave", function() {
				$(this).fadeTo(300,1);
			});
		});
		
		$("a[href='#']").click(function() {
			return false;
		});
		/*
		//cambiar boton de menu seleccionado
		$('#tab > ul > li > a').each(function() {
			var at = $(this).attr('onMouseover');
			if (at != 'undefined') {
				var subMenuID = /'([^']*)'\)$/i.match(at)[1];
				console.log(subMenuID);
			}
		});
		*/
		inicia();
	}
);

function inicia() {
	var re = /:\/\/([^\/]*)\/([^?]*)/i;
	var res = re.exec(window.location.href);
	
	if (res[2] != "")
		var actual = res[2];
	else
		return;
		
	$('.dropmenudiv').each(
		function() {
			var regexp;
			var sentencia = "regexp = /"+ actual.replace(/\./i, '\\.') +"/i";
			eval(sentencia);
			if (regexp.test(this.innerHTML)) {
				var id = this.id;
				$('#tab ul li').each(
					function() {
						$(this).removeClass("item_active");
						var regexp;
						var sentencia = "regexp = /"+ id +"/i";
						eval(sentencia);
						if (regexp.test(this.innerHTML)) {
							this.className = "item_active";
						}
					}
				);
			}
		}
	);
}

function out(msg) {
	if ($.browser.mozilla)
		console.log(msg);
	else
		alert(msg);
}






