// JavaScript Document
     function getMouseXY(e) // works on IE6,FF,Moz,Opera7
        { 
          var mousex;
          var mousey;
          var MouseXY = {x:0,y:0};
          if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)

          if (e)
          { 
            if (e.pageX || e.pageY)
            { // this doesn't work on IE6!! (works on FF,Moz,Opera7)
              mousex = e.pageX;
              mousey = e.pageY;
              //algor = '[e.pageX]';
              //if (e.clientX || e.clientY) algor += ' [e.clientX] '
            }
            else if (e.clientX || e.clientY)
            { // works on IE6,FF,Moz,Opera7
              mousex = e.clientX + document.body.scrollLeft;
              mousey = e.clientY + document.body.scrollTop;
              //algor = '[e.clientX]';
              //if (e.pageX || e.pageY) algor += ' [e.pageX] '
            }  
          }
          MouseXY.x = mousex;
          MouseXY.y = mousey;
          return MouseXY;
        }

        function hideAjaxBox()
        {
            var AjaxBox = document.getElementById('AjaxModalBox');
            AjaxBox.style.visibility = "hidden";
        }
        function showAjaxBox()
        {
            var AjaxBox = document.getElementById('AjaxModalBox');
            AjaxBox.style.visibility = "hidden";
        }
		function showModal(obj,position,category,e,classStyle)
        {
	        var AjaxBox = document.getElementById('AjaxModalBox');
	        var Cursor = getMouseXY(e);
	        
	        if (position.indexOf('Right')  > 0)
	        {
    	        AjaxBox.style.left = Cursor.x + "px";    
	        }
	        if (position.indexOf('Left') > 0)
	        {
	            var x = Cursor.x - 234 ;
    	        AjaxBox.style.left = x + "px";
	        }	        
	        AjaxBox.style.top = Cursor.y + "px";
	        AjaxBox.style.visibility = "visible";
	        AjaxBox.style.zIndex = "1";
	        
	        //alert(category + " " + classStyle);
	        
	        getAjaxSubCategories(category,classStyle);
        }
        function getAjaxSubCategories(categoria, classStyle)
        {
            $.post("lib/ajax_data.php",  {action: "searchCategoryListFloat", categoria: ""+categoria+"", classStyle: ""+classStyle+""}, function(data){      
                //setAjaxSubCategories(data);   
				if (data == '')
				{
					var html = "";
					  	html += "<table style=\"width:97%\" cellpadding=\"0\" cellspacing=\"0\">";
						html += "<tr style=\"width:100%;\">";
						  html += "<td align=\"right\">";
							html += "<a href=\"javascript:void(0);\" style=\"color:#CCCCCC;  font-size:13px; font-weight:bold;\" onclick=\"hideAjaxBox()\">cerrar</a>";
						  html += "</td>";
						html += "</tr>";
					  html += "</table>";
					  html += "<table id=\"AjaxBoxLoader\" style=\"height:160px; width:234px;\">";
					    html += "<tr>";
					      html += "<td align=\"center\">";
					        	html += "<span style=\"color:#66666; font-size:12px; font-weight:bold;\">La Informaci&oacute;n no ha sido encontrada</span>";
					      html += "</td>";
					    html += "</tr>";
					  html += "</table>";
					$("#AjaxModalBox").html(html);
				}
				else
	                $("#AjaxModalBox").html(data);
            });  //fin de post
            
        }
        function setAjaxSubCategories(html)
        {
            var AjaxBox = document.getElementById("AjaxModalBox");
            AjaxBox.innerHtml += html;
        }