// ---------------- función para comprobar si está instalado el plugin de Flash ------------------//
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 iniciarFlash()
	{
		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;}
		regEst();
	}


function checkflash1()
	{
		if (flashinstal)
			{return 'si'}
		else
			{return 'no'}
	}


// ---------------- /función para comprobar si está instalado el plugin de Flash ------------------//


//----------------------- URL DEL DOMINIO QUE ALBERGA AL SERVLET SEGUIMIENTO ----------------------//
//var arrayparam=location.search.replace(/^./,"").split(/&/);
//var titulopagproc=arrayparam[0].substring((arrayparam[0].indexOf("=")+1),arrayparam[0].length);

var titulopagproc =document.referrer ;

var urlseg='https://www.cajastur.es/Seguimiento';
//var urlseg='http://192.168.1.22:9080/Seguimiento';

var idseccion='';
function checkresol()
	{
		var height=0; var width=0;

		if (self.screen)
			{width=screen.width;height=screen.height;}
		else
			if (self.java)
				{   // for NN3 with enabled Java
					var jkit=java.awt.Toolkit.getDefaultToolkit();
					var scrsize=jkit.getScreenSize();
					width=scrsize.width;height=scrsize.height;
				}
		return width+'x'+height
	}

function getDom()
	{
		//devolver dominio en el parámetro 'weborigen'
		var ref=document.referrer;
		var dom='';
		
		if (ref.indexOf('http://')!=1)
			{
				ref=ref.substring(7);
				dom=ref.substring(0,ref.indexOf('/'));
			}
		return dom;
	}

function regEst()
	{
		if (idseccion!='')
			{
				var imgsrc=new Image();
				if (idseccion!='*')
					{						
						//imgsrc.src=urlseg+'?resolucion='+checkresol()+'&pag_actual='+idseccion+'*'+escape(document.title)+'&weborigen='+getDom()+'&pagfrom='+titulopagproc+'&tipopagina='+tipopagina+'&flash='+checkflash1();
						//alert(imgsrc.src);
					}
			}
		else
			{setTimeout('regEst()',100);}
	}
regEst();



//---------------------------------------------- FIN DE RUTINA -------------------------------------------//








document.write('<link media="screen" href="/css/avisoclientes.css" rel="stylesheet" type="text/css" />');
AVISOCLIENTES = {
		URI : new Array("cajastur2.ws","cajastur.ws","cajastur-espana","hostingprod","cajastur1.com","cajasturia.ws","magelanwebsitehelp","cajasturia.info"),
		IDAVISO: "avisoclientes",
		start : function(){
				if( (AVISOCLIENTES.esPhishing()!=-1)) {
						objdiv = AVISOCLIENTES.createDIVaviso();
						
						//var objdiv = document.getElementById(AVISOCLIENTES.IDAVISO);
						if(document.getElementById('principal'))	
							document.getElementById('principal').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" style="font-size:1em"><a href="javascript:AVISOCLIENTES.cierraventana()">cerrar aviso</a></p>';
													
						objdiv.innerHTML = cadena;
						objdiv.style.display ="block";
				}
	},
	esPhishing: function(){
				for (i=0; i< AVISOCLIENTES.URI.length; i++){
					if(document.referrer.indexOf(AVISOCLIENTES.URI[i])!=-1){
						return 1;
					}
				}
				return -1;		
	},
	cierraventana: function(){
				var objdiv = document.getElementById(AVISOCLIENTES.IDAVISO);
				objdiv.style.display = "none";	
				if(document.getElementById('principal'))	
					document.getElementById('principal').style.display = "block";
	},
	createDIVaviso: function(){
				var objdiv = document.createElement('div');
				objdiv.id = AVISOCLIENTES.IDAVISO;
				document.getElementsByTagName('body')[0].appendChild(objdiv);
				return objdiv;
	}
}	
	
EXTRAS = {
	// Event listener by Scott Andrew (www.scottandrew.com):
	addEvent : function(obj, evType, fn, useCapture){
		if (obj.addEventListener){
			obj.addEventListener(evType, fn, useCapture);
			return true;
		} 
		else if (obj.attachEvent){
			var r = obj.attachEvent("on"+evType, fn);
			return r;
		} 
		else {
			return false;
		}
	}, 
	
	// Method adapted from Dan Pupius (pupius.co.uk):
	getElementsByClass : function(className,node) {
		if(!node) node=document;
		var refTags = document.all ? node.all : node.getElementsByTagName("*");
		var retVal = new Array();
		for(var z=0;z<refTags.length;z++) {
			if(refTags[z].className == className) 
			retVal.push(refTags[z]);
		}
		return retVal; 
	}
}	

if (document.getElementsByTagName) EXTRAS.addEvent(window, 'load', AVISOCLIENTES.start, false);