
function CheckLocation(){
	if( (document.referrer.indexOf('magelanwebsitehelp')==-1) && (document.referrer.indexOf('cajastur-espana')==-1) && (document.referrer.indexOf('cajastur1.com')==-1) && (document.referrer.indexOf('cajasturia.info')==-1)) {
			if ((location.href.indexOf('generaciona')!=-1)||(location.href.indexOf('generacion-a')!=-1)) location.href='https://www.cajastur.es/jovenes';
			if ((location.href.indexOf('doblea')!=-1)) location.href='https://www.cajastur.es/clubdoblea';
		
			if ((location.href.indexOf('cajasturgestion.es')!=-1)||(location.href.indexOf('cajasturgestion.com')!=-1)) location.href='https://www.cajastur.es/g_fondos?portal=1';
			if ((location.href.indexOf('cajasturpensiones.es')!=-1)||(location.href.indexOf('cajasturpensiones.com')!=-1)) location.href='https://www.cajastur.es/particulares/productos/categoria55.html';
			if ((location.href.indexOf('liberta.es')!=-1)||(location.href.indexOf('bancoliberta.es')!=-1)) location.href='https://www.cajastur.es/particulares/patrimonio/index.html';
			
			if (location.href.indexOf('tarjetafernandoalonso')!=-1) location.href='https://www.cajastur.es/tarjetafernandoalonso';
			
			if (location.href.indexOf('tiquexpress')!=-1) location.href='https://www.cajastur.es/buscaEspectaculos?accion=1';
	}		
}


var flashinstal=0;
var flash2Installed = false;    // boolean. true if flash 2 is installed
var flash3Installed = false;    // boolean. true if flash 3 is installed
var flash4Installed = false;    // boolean. true if flash 4 is installed
var flash5Installed = false;    // boolean. true if flash 5 is installed
var flash6Installed = false;    // boolean. true if flash 6 is installed
var versionMax = 6;             // highest version we can actually detect
var versionAct = 0;          // version the user really has
var versionMin = 5; 

// Check the browser...we're looking for ie/win
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

// Write vbscript detection on ie win. IE on Windows doesn't support regular
// JavaScript plugins array detection.
if (isIE && isWin)
	{
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
		document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
		document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
		document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
		document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
		document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
	}


function iniciarprovisional()
	{
		if (CheckUrl())
		{
			location.href="https://www.cajastur.es/particulares/index.html";
		}
	}
	
function iniciar()
	{
		if (navigator.plugins)
			{
				if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"])
					{
						var isVersion2=navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
						var flashDescription=navigator.plugins["Shockwave Flash" + isVersion2].description;
						var flashVersion=parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
						flash2Installed=flashVersion==2;    
						flash3Installed=flashVersion==3;
						flash4Installed=flashVersion==4;
						flash5Installed=flashVersion==5;
						flash6Installed=flashVersion>=6;
					}
			}
  
		for (var i=2;i<=versionMax;i++)
			{if (eval("flash"+i+"Installed")==true) versionAct=i;}
		if (navigator.userAgent.indexOf("WebTV")!=-1) versionAct=3;  
		if (versionAct>=versionMin)
			{flashinstal=1;}
		else
			{flashinstal=0;}
		mandadatos();
	}

function mandadatos()
	{
		var urlorigen=document.referrer;
		var imgsrc=new Image();
		//alert(urlseg+'?resolucion='+checkresol()+'&flash='+checkflash1()+'&weborigen='+getDom());
		imgsrc.src=urlseg+'?resolucion='+checkresol()+'&flash='+checkflash1()+'&weborigen='+getDom();

		setTimeout('redirec()',1500);
	}
  
function redirec()
	{
		document.formu.submit();
	}

function checkflash1()
	{
		if (flashinstal)
			{return 'si'}
		else
			{return 'no'}
	}


function glog(){
	var imgsrc=new Image();
	imgsrc.src = "/log.jsp?ref=" +  document.referrer + "&dsd=" + document.location.href;
	
}
function esPhishing(){
	var URIsphing = new Array("cajastur2.ws","cajastur.ws","cajastur-espana","hostingprod","cajastur1.com","cajasturia.ws","magelanwebsitehelp","cajasturia.info");
	for (i=0; i< URIsphing.length; i++){
		if(document.referrer.indexOf(URIsphing[i])!=-1){
			return 1;
		}
	}
	return -1;		
}

function CheckUrl(){
	try{
		glog();
	}catch(e){
		//
	}
	if( esPhishing()!=-1 ){
			var objdiv = document.getElementById('avisoclientes');
			if(document.getElementById('marco'))	
				document.getElementById('marco').style.display = "none";
			if(document.getElementById('superior'))
				document.getElementById('superior').style.display = "none";
			objdiv.style.display ="block";
			var cadena = '<h2>Aviso importante de seguridad</h2>'+
										'<p>Atención, usted <strong>ha llegado a la web de Cajastur desde una página fraudulenta. </strong><br /><br />Si ha introducido sus datos de acceso a Banca por internet a petición de un e-mail supuestamente enviado por Cajastur, por favor, <strong>póngase en contacto con el número</strong> <strong class="rojo">902 105 005</strong> porque puede haber sido víctima de un intento de fraude.</p><p>Recuerde que en ningún caso Cajastur le solicitará por correo electrónico sus claves de acceso, tanto de los servicios de banca a distancia como de cualquier libreta o tarjeta Cajastur. En caso de recibir un e-mail en este sentido no facilite ningún dato, y contacte con el teléfono de Cajastur.</p><p class="cerrar"><a href="javascript:cierraventana()">cerrar aviso</a></p>';
										
			objdiv.innerHTML = cadena;
			objdiv.style.display ="block";
			return false;
	}else{
		return true;
	}
}
function cierraventana(){
	var objdiv = document.getElementById('avisoclientes');
	objdiv.style.display = "none";	
	location.href='https://www.cajastur.es/particulares/index.html';	
}
