/*
// --- Detector navegadores ------------
var isNew=0;
var isNS4=0;
var isIE4=0;
var brow= ((navigator.appName)+(parseInt(navigator.appVersion)));
if (parseInt(navigator.appVersion >=5)) {
isNew=1}
else if (brow=="Netscape4"){isNS4 = 1;}
else if(brow=="Microsoft Internet Explorer4"){isIE4=1;}

docObj=(isNS4)?'document' :'document.all';
styleObj= (isNS4)?'':'.style';
*/

/*
function ve (){

currElem = "floatdiv";
dom=eval(docObj+'.'+currElem+styleObj);
dim=eval(docObj+'.'+currElem);
*/

//document.floatdiv.innerHTML  = "HOLA";
//document.floatdiv.innerHTML="+azz+";
//document.all.floatdiv.innerHTML="+azz+";

//var container = document.getElementById("floatdiv");
//container.innerHTML = "HOLA";

/*
var newdiv = document.createElement("div");
newdiv.innerHTML = "HHAHAHHA";
var container = document.getElementById("floatdiv");
container.appendChild(newdiv);

*/
/*
var div1=document.createElement('floatdiv');
div1.style.width="300px";
div1.style.height="100px";
div1.style.fontSize="11px";
div1.style.backgroundColor="rgb(204, 204, 204)";
var img1=document.createElement('img');
img1.style.cssFloat="left";
img1.style.marginRight="15px";
img1.setAttribute('src','franjas1.jpg');
div1.appendChild(img1);
var txt2=document.createTextNode('Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\n');
div1.appendChild(txt2);

*/
/*
var obj = document.getElementById("floatdiv");
obj.firstChild?obj.firstChild.data="HHHHH":obj.appendChild(document.createTextNode("HHHHHH"))

*/

var container = document.getElementById("floatdiv")

// ---------------------------------------

function veure(tx1,wtx2,xpos,ww,wh) {    
container.style.visibility = "visible";
container.style.height=wh+"px";
container.style.width=ww+"px";

floatingMenu.targetX = xpos;

wtbl = ww;
cont4 = "";

cont1 = '<table border=0 cellpadding=2 cellspacing=0 align=center bgcolor=#eeeeee><tr><td width='+wtbl+' class=mg align=center class=gris1 id=s14>&nbsp; '+tx1+'</td></tr></table>';

cont2 = '<table border=0 cellpadding=6 cellspacing=0 align=center bgcolor=#ffffff >';
cont3 = '<tr><td width='+wtbl+' align=center valign=top><br>';
cont5 = '<div align=justify class=gris1>'+wtx2+'</div><br></td></tr></table>';  

container.innerHTML = cont1.concat(cont2,cont3,cont4,cont5); 
}


function amagar() {
container.style.visibility = "hidden";    
}

// ======================================

/* Script by: www.jtricks.com  
 * Version: 20071017  
 * Latest version:  
 * www.jtricks.com/javascript/navigation/floating.html  
 */  
var floatingMenuId = 'floatdiv';   
var floatingMenu =   
{   
    targetX: -250,   
    targetY: 10,   
  
    hasInner: typeof(window.innerWidth) == 'number',   
    hasElement: typeof(document.documentElement) == 'object'  
        && typeof(document.documentElement.clientWidth) == 'number',   
  
    menu:   
        document.getElementById   
        ? document.getElementById(floatingMenuId)   
        : document.all   
          ? document.all[floatingMenuId]   
          : document.layers[floatingMenuId]   
};   
  
floatingMenu.move = function ()   
{   
    floatingMenu.menu.style.left = floatingMenu.nextX + 'px';   
    floatingMenu.menu.style.top = floatingMenu.nextY + 'px';   
}   
  
floatingMenu.computeShifts = function ()   
{   
    var de = document.documentElement;   
  
    floatingMenu.shiftX =     
        floatingMenu.hasInner     
        ? pageXOffset     
        : floatingMenu.hasElement     
          ? de.scrollLeft     
          : document.body.scrollLeft;     
    if (floatingMenu.targetX < 0)   
    {   
        floatingMenu.shiftX +=   
            floatingMenu.hasElement   
            ? de.clientWidth   
            : document.body.clientWidth;   
    }   
  
    floatingMenu.shiftY =    
        floatingMenu.hasInner   
        ? pageYOffset   
        : floatingMenu.hasElement   
          ? de.scrollTop   
          : document.body.scrollTop;   
    if (floatingMenu.targetY < 0)   
    {   
        if (floatingMenu.hasElement && floatingMenu.hasInner)   
        {   
            // Handle Opera 8 problems   
            floatingMenu.shiftY +=   
                de.clientHeight > window.innerHeight   
                ? window.innerHeight   
                : de.clientHeight   
        }   
        else  
        {   
            floatingMenu.shiftY +=   
                floatingMenu.hasElement   
                ? de.clientHeight   
                : document.body.clientHeight;   
        }   
    }   
}   
  
floatingMenu.calculateCornerX = function()   
{   
    if (floatingMenu.targetX != 'center')   
        return floatingMenu.shiftX + floatingMenu.targetX;   
  
    var width = parseInt(floatingMenu.menu.offsetWidth);   
  
    var cornerX =   
        floatingMenu.hasElement   
        ? (floatingMenu.hasInner   
           ? pageXOffset   
           : document.documentElement.scrollLeft) +    
          (document.documentElement.clientWidth - width)/2   
        : document.body.scrollLeft +    
          (document.body.clientWidth - width)/2;   
    return cornerX;   
};   
  
floatingMenu.calculateCornerY = function()   
{   
    if (floatingMenu.targetY != 'center')   
        return floatingMenu.shiftY + floatingMenu.targetY;   
  
    var height = parseInt(floatingMenu.menu.offsetHeight);   
  
    // Handle Opera 8 problems   
    var clientHeight =    
        floatingMenu.hasElement && floatingMenu.hasInner   
        && document.documentElement.clientHeight    
            > window.innerHeight   
        ? window.innerHeight   
        : document.documentElement.clientHeight   
  
    var cornerY =   
        floatingMenu.hasElement   
        ? (floatingMenu.hasInner     
           ? pageYOffset   
           : document.documentElement.scrollTop) +    
          (clientHeight - height)/2   
        : document.body.scrollTop +    
          (document.body.clientHeight - height)/2;   
    return cornerY;   
};   
  
floatingMenu.doFloat = function()   
{   
    var stepX, stepY;   
  
    floatingMenu.computeShifts();   
  
    var cornerX = floatingMenu.calculateCornerX();   
  
    var stepX = (cornerX - floatingMenu.nextX) * .07;   
    if (Math.abs(stepX) < .5)   
    {   
        stepX = cornerX - floatingMenu.nextX;   
    }   
  
    var cornerY = floatingMenu.calculateCornerY();   
  
    var stepY = (cornerY - floatingMenu.nextY) * .07;   
    if (Math.abs(stepY) < .5)   
    {   
        stepY = cornerY - floatingMenu.nextY;   
    }   
  
    if (Math.abs(stepX) > 0 ||   
        Math.abs(stepY) > 0)   
    {   
        floatingMenu.nextX += stepX;   
        floatingMenu.nextY += stepY;   
        floatingMenu.move();   
    }   
  
    setTimeout('floatingMenu.doFloat()', 20);   
};   
  
// addEvent designed by Aaron Moore   
floatingMenu.addEvent = function(element, listener, handler)   
{   
    if(typeof element[listener] != 'function' ||    
       typeof element[listener + '_num'] == 'undefined')   
    {   
        element[listener + '_num'] = 0;   
        if (typeof element[listener] == 'function')   
        {   
            element[listener + 0] = element[listener];   
            element[listener + '_num']++;   
        }   
        element[listener] = function(e)   
        {   
            var r = true;   
            e = (e) ? e : window.event;   
            for(var i = element[listener + '_num'] -1; i >= 0; i--)   
            {   
                if(element[listener + i](e) == false)   
                    r = false;   
            }   
            return r;   
        }   
    }   
  
    //if handler is not already stored, assign it   
    for(var i = 0; i < element[listener + '_num']; i++)   
        if(element[listener + i] == handler)   
            return;   
    element[listener + element[listener + '_num']] = handler;   
    element[listener + '_num']++;   
};   
  
floatingMenu.init = function()   
{   
    floatingMenu.initSecondary();   
    floatingMenu.doFloat();   
};   
  
// Some browsers init scrollbars only after   
// full document load.   
floatingMenu.initSecondary = function()   
{   
    floatingMenu.computeShifts();   
    floatingMenu.nextX = floatingMenu.calculateCornerX();   
    floatingMenu.nextY = floatingMenu.calculateCornerY();   
    floatingMenu.move();   
}   
  
if (document.layers)   
    floatingMenu.addEvent(window, 'onload', floatingMenu.init);   
else  
{   
    floatingMenu.init();   
    floatingMenu.addEvent(window, 'onload',   
        floatingMenu.initSecondary);   
}   
