// JavaScript Document
var ancho = 0;

function iniciarFlotar()
	{
		document.getElementById('menuFlotante').style.top = 0+"px";
	}

function Flotar() 
	{		
	windowSize();
	scrollY = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ;

// IE 7, mozilla, safari, opera 9	
	if (window.XMLHttpRequest) 
	{						
		document.getElementById('menuFlotante').style.position = "absolute";
			
			//Si se desplazo el scroll lo suficiente como para alinear el menu al principio
			if(scrollY >= 135)
			{	
				//Si tiene resolución menor a 1024 x 768
				if(ancho < 900)
				{	
					document.getElementById('menuFlotante').style.top = scrollY +"px";
				} 
				else 
				{
					document.getElementById('menuFlotante').style.position = "fixed";
					document.getElementById('menuFlotante').style.top = 0 +"px";
				}
			}
			else
			{							
				document.getElementById('menuFlotante').style.top = 135 +"px";
			}	
	}
	// IE6, older browsers
	else
	{					
			//Si se desplazo el scroll lo suficiente como para alinear el menu al principio
			if(scrollY >= 135)
			{					
				document.getElementById('menuFlotante').style.top = scrollY  +"px";		
			}
			else
			{							
				document.getElementById('menuFlotante').style.top = 135 +"px";
			}	
	}
}
	
function windowSize(){	
		if (navigator.appName=="Netscape") {
			ancho = window.innerWidth-100;
			alto = window.innerHeight-155;
 		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {			
			ancho = document.documentElement.clientWidth - 100;
			alto = document.documentElement.clientHeight - 135;	
		}
}

function closeChat(url){
	//document.getElementById('menuFlotante').style.display = "none";
	setTimeout("location.href='"+location.href+"?chat=false'", 0000);
}

function openChat()
{
	window.open("includes/templates/evertek/templates/soporte/livehelp.php","mywindow","menubar=1,resizable=1,width=376,height=450");
}

//window.onload = iniciarFlotar;
window.onscroll = Flotar;

