
// Indentifica o User Agent do navegador cliente
// AAA - Out 09
var ua = navigator.userAgent.toLowerCase();
var uMobile = '';

// === REDIRECIONAMENTO PARA iPhone, Windows Phone, Android, NokiaE71, Pocket etc. ===

// Lista de substrings a procurar para ser identificado como mobile WAP
uMobile ='iphone;ipod;windows ce;wince;ipaq;windows phone;android;iemobile 8;nokiae71';

// Sapara os itens individualmente em um array
v_uMobile = uMobile.split(';');
//alert(window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'));


//alert (ua.substr(91));
//alert(window.location.href.slice(window.location.href.indexOf('?',0)+1));
// percorre todos os itens verificando se eh mobile

var boolMovel = false;
var bollValid = false;

	if (ua.indexOf('gt-p1000l') != -1) 
	{
		boolMovel = false;
		bollValid = true;
	}
	
		
	//Redirecionamento para aparelhos blackberry
	 if (ua.indexOf('blackberry') != -1){
		var posicao =  ua.indexOf('version/');
		var versao =  ua.indexOf('/');
		if (ua.substr(posicao+8,1) >= 6)
		{
			boolMovel = true;
			bollValid = true;
			
		}
		
		if (ua.substr(versao+1,1) == 5)
		{	
			boolMovel = true;
			bollValid = true;
		}
		
		if (parseFloat(ua.substr(versao+1,3)) >= 4.6)
		{	
			boolMovel = true;
			bollValid = true;
		}
		if (ua.indexOf('blackberry') != -1 && boolMovel==false){
		{
		    bollValid = true;
			top.location.href='http://wap.bradesco.com.br/pj';
			
		}
	//Fim redirecionamento Blackberry
	}
	if(ua.indexOf('android 3.0') != -1)
	{
		boolMovel = false;
		bollValid = true;
	}
	
}
	
	if(bollValid==false){
		for (i=0;i<=v_uMobile.length;i++)
		{
				if (ua.indexOf(v_uMobile[i]) != -1)
				{
					boolMovel = true;
					bollValid = true;
				}
		}
	}
	
if (boolMovel == true)
	{
		top.location.href='http://www.bradescocelular.com.br/smartphone/pj/default.aspx';
		
	}

// ===================================================================





// === REDIRECIONAMENTO PARA O WAP ===================================

// Lista de substrings a procurar para ser identificado como mobile WAP
if (bollValid == false){
        uMobile = '';
        uMobile += 'playstation;wap;iemobile;symbian;midp;';
        uMobile += 'series60;symbian;series60;series70;series80;series90;';
        uMobile += 'blackberry;midp;wml;brew;palm;xiino;blazer;pda;nitro;netfront;';
        uMobile += 'SonyEricsson;sonyericsson;ericsson;sec-sgh;docomo;kddi;vodafone;mot;sony';

        // Sapara os itens individualmente em um array
        v_uMobile = uMobile.split(';');

        // percorre todos os itens verificando se eh mobile
        var boolMovel = false;
        for (i=0;i<=v_uMobile.length;i++)
        {
	        if (ua.indexOf(v_uMobile[i]) != -1)
	        {
		        boolMovel = true;
	        }
        }

        if (boolMovel == true)
	        {
		        top.location.href='http://wap.bradesco.com.br/pj';
	        }
}

// ===================================================================
