
/*****************************
Detecção do browser
******************************/
function Browser( )
{
	var agent = navigator.userAgent.toLowerCase();

	this.isPocket = ( navigator.appVersion.indexOf( "MSIE" ) > 0 ) && ( navigator.appVersion.indexOf( "Windows CE" ) > 0 );
	this.isPPC = agent.indexOf( "240x320" ) > 0;
	this.isWin = agent.indexOf( "win" ) > 0;
	this.isUNIX = agent.indexOf( "x11" ) > 0;
	this.isMac = agent.indexOf( "mac" ) > 0;

	this.isAOL = agent.indexOf( "aol" ) > 0;
	this.isIE = agent.indexOf( "msie" ) > 0;
	this.isNS6 = agent.indexOf( "netscape6" ) > 0;
	this.isGecko = agent.indexOf( "gecko" ) > 0;
	this.isNS4 = ( document.layers ) ? true : false;

	this.iWidth = window.screen.width;
	this.iHeight = window.screen.height;
}

/*****************************
Seta estilo de acordo com o browser
******************************/
function SelStyle()
{
	var sRota = "//Server01/usuarios/web/itau fundos/css/";
	if ( browser.isIE )
		document.write ( "<link rel=\"stylesheet\" href=\"" + sRota + "generic.css\">" );
	else if ( browser.isUNIX ) 
		document.write ( "<link rel=\"stylesheet\" href=\"" + sRota + "generic2.css\">" );
	else if ( browser.isNS4 ) 
		document.write ( "<link rel=\"stylesheet\" href=\"" + sRota + "generic1.css\">" );
	else if ( browser.isGecko ) 
		document.write ( "<link rel=\"stylesheet\" href=\"" + sRota + "generic.css\">" );
}

/*****************************
Função centralizadora do redirecionador
******************************/
function Redirect( sURL )
{
	window.top.location.replace( sURL );
}

/*****************************
Redireciona de acordo com o browser
******************************/
function Redireciona()
{
	if ( browser.isPocket || browser.isPPC )
		window.top.location = "http://www.itau.com.br/pda/index.html";

	if ( browser.iWidth <= 640 )
		Redirect( "index640.htm" );

	else if ( browser.isMac ) // Mac
		Redirect( "indexMac.htm" );

	else if ( browser.isUNIX) // AIX / LINUX
		Redirect( "indexLinux.htm" );

	else if ( browser.isAOL )  // AOL
		Redirect( "indexAOL.htm" );
		
	else if ( browser.isIE ) // Internet Explorer
		Redirect( "indexIE.htm" );
		
	else if ( browser.isNS4 ) // netscape
		Redirect( "indexNE4.htm" );

	else if ( browser.isGecko ) // Netscape 6/7 Gecko
		Redirect( "indexNE6.htm" );
		
	else
		Redirect( "indexIE.htm" );
}

//Inicializa tipo do browser
var browser = new Browser( );

//Seta o estilo do documento
SelStyle();
