/*****************************************/
/*  Elements de Flash                    */
/*****************************************/

function flash_element(titol,arxiu,x,y)
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + x + '" height="' + y +  '" title="' + titol + '"><param name="movie" value="' + arxiu + '"><param name="quality" value="high"><param name="scale" value="noscale"><param name="resize" value="false"><embed src="' + arxiu + '" quality="high" resize="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + x + '" height="' + y + '"></embed></object>');
}

function flash_element_trans(titol,arxiu,x,y)
{
document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + x + "' height='" + y +  "' title='" + titol + "'><param name='movie' value='" + arxiu + "'><param name='quality' value='high'><param name='scale' value='noscale'><param name='wmode' value='transparent'><param name='resize' value='false'><embed src='" + arxiu + "' quality='high' resize='false' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + x + "' height='" + y + "' wmode='transparent'></embed></object>");
}


/*****************************************/
/*  Canvia les propietats                */
/*****************************************/

function canvia(id,src)
{
    try{
        document.getElementById(id).src = src;    
        }finally{ 
        return false;        
    }
}

function text_color(id,color)
{
    try{
    document.getElementById(id).style.color = color;
    }finally{ 
        return false;        
    }
}


/********************************************************************/
/*      FADEIN                                                      */   
/********************************************************************/


var l_inf = 65;

var delay;
delay = 5;

var stepup = 20;

var index = -1;

var do_fadein = 0;
var do_fadeout = 0;

/*****************************************************************/
/*    FADE INS Especifics                                        */
/*****************************************************************/   

function fadein_ff(id)
{
    
    if ( index == -1 )
    {
        index = l_inf;
    }else{
        index += stepup;  
    }
    
    document.getElementById(id).style.MozOpacity = index/101;       
    
    if ( index >= 99 )
    {
        index = -1;
        do_fadein = 0;
        fade = '';
    }else{
        setTimeout("fadein('" + id + "')",delay);
    }
}

function fadein_ie(id)
{
        document.getElementById(id).filters.alpha.opacity = document.getElementById(id).filters.alpha.opacity + stepup;
        if ( document.getElementById(id).filters.alpha.opacity >= 99 )
        {
            document.getElementById(id).filters.alpha.opacity = 99;
            do_fadein = 0;
            fade = '';
        }else{
             setTimeout("fadein('" + id + "')",delay);
        }
}


/*****************************************************************/
/*    FADE OUTS Especifics                                        */
/*****************************************************************/


function fadeout_ff(id)
{
    
        if ( index == -1 )
        {
            index = 99;
        }else{
            index -= stepup;  
        }
        
        document.getElementById(id).style.MozOpacity = index/101;       
        
        if ( index <= l_inf )
        {
            index = -1;
            do_fadeout = 0;
            fade = '';
        }else{
            setTimeout("fadeout('" + id + "')",delay);
        }

}

function fadeout_ie(id)
{
 
 
            document.getElementById(id).filters.alpha.opacity = document.getElementById(id).filters.alpha.opacity - stepup;
            if ( document.getElementById(id).filters.alpha.opacity <= l_inf )
            {
                document.getElementById(id).filters.alpha.opacity = l_inf;
                do_fadeout = 0;
                fade = '';
            }else{
                 setTimeout("fadeout('" + id + "')",delay);
            }    
 
}


/*****************************************************************/
/*    FADES Generals                                             */
/*****************************************************************/



function fadeout2(id)
{
    if ( do_fadein != 1 )
    {
        do_fadeout = 1;
        do_fadein = 0;
        if (document.all)
        {
            fadeout_ie(id);
        }else{
            fadeout_ff(id);
        }
    }else{
        do_fadeout = 0;
        do_fadein = 1;
        fadein(id);        
    }
}

function fadein2(id)
{
    if ( do_fadeout != 1 )
    {
        do_fadein = 1;
        do_fadeout = 0;
        if (document.all)
        {
            fadein_ie(id);
        }else{
            fadein_ff(id);
        }
     }else{
         do_fadein = 0;
         do_fadeout = 1;
         fadeout(id);         
     }
}


var fade = '';

function fadeout3(id)
{
    if ( fade != 'in' )
    {
        fade = 'out';
        if (document.all)
        {
            fadeout_ie(id);
        }else{
            fadeout_ff(id);
        }
    }else{
        do_fadeout = 0;
        do_fadein = 1;
        fadein(id);        
    }
}

function fadein3(id)
{
    if ( fade != 'out' )
    {
        fade = 'in';
        if (document.all)
        {
            fadein_ie(id);
        }else{
            fadein_ff(id);
        }
     }else{         
         fadeout(id);         
     }
}



function fadein(id)
{
    if (document.all)
    {
        document.getElementById(id).filters.alpha.opacity = 100;
    }else{
        document.getElementById(id).style.MozOpacity = 1;  
    }
}

function fadeout(id)
{
    if (document.all)
    {
        document.getElementById(id).filters.alpha.opacity = l_inf;
    }else{
        document.getElementById(id).style.MozOpacity = l_inf/101;   
    }
}