/* trim --------------------------------------- */
function trim(str)
{
	while (str.substring(0, 1) == " "
			|| str.substring(0, 1) == "\n"
			|| str.substring(0, 1) == "\r")
	{
		str = str.substring(1, str.length);
	}

	while (str.substring(str.length - 1, str.length) == " "
			|| str.substring(str.length - 1, str.length) == "\n"
			|| str.substring(str.length - 1, str.length) == "\r")
	{
		str = str.substring(0, str.length - 1);
	}

	return str;
}



/* ##### Funcion generica de Rollovers ############*/
function rollOver(cual,porcual)
{
	document.images[cual].src = porcual   ;

}


/*Funciones Menu Navegacion Horizontal --------------- */
horizontalNavigationLayers = new Array();

function showHideLayers(layerId,foo,stat)
{
	for (i=0;i<horizontalNavigationLayers.length;i++)
	{
		document.getElementById(horizontalNavigationLayers[i]).style.visibility='hidden';
	}
	if ('show' == stat.toLowerCase() )
	{
		document.getElementById(layerId).style.visibility='visible';
	}
}


/*  Funcion gen?rica que reemplaza el 
caracter especificado dentro de un String  */
function replaceChar(input,cual,porcual)
{
    if (input.indexOf(cual)==-1)
    {
    	// si no existe el caracter especificado dentro                                                                                                                                                        
    	// del string, devuelve el string original
     	return input ; 
    }            
    else 
    {
      	output = input.replace(cual,porcual);
       	while (output.indexOf(cual)!= -1)
       	{
             output = output.replace(cual,porcual);
        }
   		return output ;
   	}
}

/* ---------------------------------------------------------*/
// -------------------------------------------------------------------------------------
// funcion: renderFlashBanner
// descripcion: corre una pelicula flash. Al ser referenciado de forma externa,
// evita la activacion del iExplorer.
function renderFlashBanner(archivoSWF, anchoSWF, altoSWF) {
	document.write('<EMBED TYPE="application/x-shockwave-flash"\n')
	document.write('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"\n')
	document.write('wmode="transparent"  quality="high" bgcolor="#FFFFFF"\n');
	document.write('src='+archivoSWF +' width='+anchoSWF+' height='+altoSWF+'>\n</EMBED>');
}

// funcion: renderFlashBanner
// descripcion: corre una pelicula flash. Al ser referenciado de forma externa,
// flashVarsValue: Es un string con los valores de los par?metros que se le pasan al flash
//idSWF: id para el objeto por si hay varios en la misma pantalla
// evita la activacion del iExplorer.
function renderFlashWithParameters(archivoSWF, anchoSWF, altoSWF, flashVarsValue, idSWF, scaleAllowed ) {
	
	var scale = "noScale";
	
	if(scaleAllowed){
		scale = "exactfit";
	}
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
	document.write('width=' +anchoSWF+' height='+altoSWF+' id='+idSWF+' scale="'+ scale +'" align="middle" salign="TL" >');
	document.write('<param name=FlashVars value='+flashVarsValue+' />'); 
	document.write('<param name=salign value=TL>');
	document.write('<param name=scale value='+ scale +'>');
	document.write('<param name="allowScriptAccess" value="sameDomain"/> ');
	document.write('<param name="movie" value='+archivoSWF +' /><param name="quality"  value="high" /> ');
	document.write('<EMBED TYPE="application/x-shockwave-flash" ')
	document.write('PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" ')
	document.write(' scale="'+scale+'"  quality="high"  salign="TL"');
	document.write('src='+archivoSWF +' width='+anchoSWF+' height='+altoSWF+' FlashVars='+flashVarsValue+' ></EMBED>');
	document.write('</object>');

	}



// funcion: changeBannerSize
// descripcion: cambia el alto del Banner
function changeBannerSize(banner, tamano) {
	banner.style.height = tamano + 'px';
}

// funcion: changeClipView
// descripcion: cambia el tamanhio del div donde se ubica el Banner
function changeClipView(banner, paramTop, paramRight, paramBottom, paramLeft) {
	banner.style.clip='rect('+ paramTop +' '+ paramRight +' '+ paramBottom +' '+ paramLeft +')';
}
/*--------------------------------------------------------------------------*/
