/* `Validar IE 6
----------------------------------------------------------------------------------------------------*/
var IE6 = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
if(IE6){

	$(function(){
		
		$("<div>")
			.css({
				'position': 'absolute',
				'top': '0px',
				'left': '0px',
				backgroundColor: 'black',
				'opacity': '1',
				'width': '100%',
				'height': $(window).height(),
				zIndex: 5000
			})
			.appendTo("body");
			
		$("<div><img src='http://www.3zona.com/upgrade/img/no-ie6.png' alt='' style='float: left;'/><p><br /><strong>Lo Sentimos! Este sitio no soporta versiones anteriores a internet explorer 6</strong><br /><br />Por favor actualice su navegador a alguna de estas  <a href='http://www.3zona.com/upgrade/index.html'>versiones</a>.</p>")
			.css({
				backgroundColor: 'white',
				'top': '50%',
				'left': '50%',
				marginLeft: -0,
				marginTop: -100,
				width: 410,
				paddingRight: 10,
				height: 200,
				'position': 'absolute',
				zIndex: 6000
			})
			.appendTo("body");
	});		
}



/* `Menu Desplegable
----------------------------------------------------------------------------------------------------*/

var menuh={

fadesettings: {overduration: 350, outduration: 100}, //duration of fade in/ out animation, in milliseconds

buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					var menuleft=this.istopheader? 0 : this._dimensions.w
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					$targetul.css({left:menuleft+"px"}).fadeIn(menuh.fadesettings.overduration)
				},
				function(e){
					$(this).children("ul:eq(0)").fadeOut(menuh.fadesettings.outduration)
				}
			) //fin hover
		}) //fin principal()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //fin carga de menu
}
}


menuh.buildmenu("menup")

/* `Modales
----------------------------------------------------------------------------------------------------*/
$(document).ready(function(){
	$(".youtube").colorbox({iframe:true, width:650, height:550});
	$(".colorbox").colorbox({iframe:true, width:750, height:550});
	$(".iframe").colorbox({width:"80%", height:"80%", iframe:true});
	$(".inline").colorbox({width:"50%", inline:true, href:"#inline_example1"});
		//Example of preserving a JavaScript event for inline calls.
		$("#click").click(function(){ 
			$('#click').css({"background-color":"#A2B522", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
			return false;
		});
});


/* `Slideshow
----------------------------------------------------------------------------------------------------*/

<!--
$(document).ready(function() {
	var loaded = 0;
	var timerId = 0;
	var current = null;

	var stop = function() {
		clearTimeout(timerId);
		timerId = 0;
	};

	var resume = function(e) {
		timerId = window.setTimeout(e, 4000);
	};

	var original = $("#home_photo");

	original.fadeIn(1000,function() { loaded = 1; });

	$(".banner_image").each(function(i) {
		if($(this).attr('id') != 'banner_image') {
			var banner = $(this);

			var e = function() {
				banner.hide();
				original.fadeIn(1000);
			};

			$(this).mouseover(function() { stop(); });
			$(this).mouseout(function() { resume(e); });
		}
	});

	$("#banner_sub > a").each(function(i) {
		i++;
		var banner = $('#banner_image'+i);
		var current = $('#current_image');

		$(this).mouseover(function() {
			if(!loaded)
				return;

			original.hide();

			if(current.val() != '')
				$('#banner_image'+current.val()).hide();

			current.val(i);
			banner.show();

			stop();
		});

		$(this).mouseout(function() {
			if(!loaded)
				return;

			var e = function() {
				banner.hide();
				original.fadeIn(1000);
			};

			resume(e);
		});
	});
});
//-->

function OpenChat() 
{
	var popup = window.open('http://www.usalemons.com/Chat/default.asp','windowName','width=800,height=600');
	if (!popup.opener) popup.opener = self;
}


