// Evitar que la página sea cargada dentro de iframes
if (location!= top.location)
    top.location = 'http://www.xenonfactory.es';

jQuery(document).ready(
	function(){
		jQuery('ul#rotator').innerfade({
		speed: 700,
		timeout: 7000,
		type: 'sequence',
		containerheight: '264px'
		});
	});
	
function elementos_menu(){
	document.writeln('<div id="id30432" class="elementos-menu"><\/div>');
	var so30432 = new SWFObject("images/about.swf", "movie30432", "164", "115", "6");
	so30432.addParam("wmode", "transparent");
	so30432.addParam("loop", "true");
	so30432.write("id30432");

	document.writeln('<div id="id30433" class="elementos-menu"><\/div>');
	var so30433 = new SWFObject("images/web.swf", "movie30433", "180", "115", "6");
	so30433.addParam("wmode", "transparent");
	so30433.addParam("loop", "true");
	so30433.write("id30433");

	document.writeln('<div id="id30434" class="elementos-menu"><\/div>');
	var so30434 = new SWFObject("images/graphic.swf", "movie30434", "180", "115", "6");
	so30434.addParam("wmode", "transparent");
	so30434.addParam("loop", "true");
	so30434.write("id30434");

	document.writeln('<div id="id30435" class="elementos-menu"><\/div>');
	var so30435 = new SWFObject("images/portfolio.swf", "movie30435", "180", "115", "6");
	so30435.addParam("wmode", "transparent");
	so30435.addParam("loop", "true");
	so30435.write("id30435");
	
	document.writeln('<div id="id30436" class="elementos-menu"><\/div>');	
	var so30436 = new SWFObject("images/contact.swf", "movie30436", "180", "115", "6");
	so30436.addParam("wmode", "transparent");
	so30436.addParam("loop", "true");
	so30436.write("id30436");
}

function slide_show(){
	document.writeln('        <ul id="rotator">\r\n          <li><img src="images\/fondo1.jpg" alt="img"\/><\/li>\r\n          <li><img src="images\/fondo2.jpg" alt="img"\/><\/li>\r\n          <li><img src="images\/fondo3.jpg" alt="img"\/><\/li>		  \r\n          <li><img src="images\/fondo4.jpg" alt="img"\/><\/li>\r\n          <li><img src="images\/fondo5.jpg" alt="img"\/><\/li>      \r\n        <\/ul>');
}

function ie6(){
	document.writeln('<!--[if lt IE 7]>\n  <div style=\'border: 1px solid #F7941D; background: #FEEFDA; text-align: center; clear: both; height: 75px; position: relative;\'>\n    <div style=\'position: absolute; right: 3px; top: 3px; font-family: courier new; font-weight: bold;\'><a href=\'#\' onclick=\'javascript:this.parentNode.parentNode.style.display="none"; return false;\'><img src=\'http:\/\/www.ie6nomore.com\/files\/theme\/ie6nomore-cornerx.jpg\' style=\'border: none;\' alt=\'Cierra este aviso\'\/><\/a><\/div>\n    <div style=\'width: 640px; margin: 0 auto; text-align: left; padding: 0; overflow: hidden; color: black;\'>\n      <div style=\'width: 75px; float: left;\'><img src=\'http:\/\/www.ie6nomore.com\/files\/theme\/ie6nomore-warning.jpg\' alt=\'¡Aviso!\'\/><\/div>\n      <div style=\'width: 275px; float: left; font-family: Arial, sans-serif;\'>\n        <div style=\'font-size: 14px; font-weight: bold; margin-top: 12px;\'>Usted está usando un navegador obsoleto.<\/div>\n        <div style=\'font-size: 12px; margin-top: 6px; line-height: 12px;\'>Para navegar mejor por este sitio, por favor, actualice su navegador.<\/div>\n      <\/div>\n      <div style=\'width: 75px; float: left;\'><a href=\'http:\/\/www.mozilla-europe.org\/es\/firefox\/\' target=\'_blank\'><img src=\'http:\/\/www.ie6nomore.com\/files\/theme\/ie6nomore-firefox.jpg\' style=\'border: none;\' alt=\'Get Firefox 3.5\'\/><\/a><\/div>\n      <div style=\'width: 75px; float: left;\'><a href=\'http:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyID=341c2ad5-8c3d-4347-8c03-08cdecd8852b&DisplayLang=es\' target=\'_blank\'><img src=\'http:\/\/www.ie6nomore.com\/files\/theme\/ie6nomore-ie8.jpg\' style=\'border: none;\' alt=\'Get Internet Explorer 8\'\/><\/a><\/div>\n      <div style=\'width: 73px; float: left;\'><a href=\'http:\/\/www.apple.com\/es\/safari\/download\/\' target=\'_blank\'><img src=\'http:\/\/www.ie6nomore.com\/files\/theme\/ie6nomore-safari.jpg\' style=\'border: none;\' alt=\'Get Safari 4\'\/><\/a><\/div>\n      <div style=\'float: left;\'><a href=\'http:\/\/www.google.com\/chrome?hl=es\' target=\'_blank\'><img src=\'http:\/\/www.ie6nomore.com\/files\/theme\/ie6nomore-chrome.jpg\' style=\'border: none;\' alt=\'Get Google Chrome\'\/><\/a><\/div>\n    <\/div>\n  <\/div>\n  <![endif]-->');
}

function lopd(){
	document.getElementById("fndblk").style.height = document.documentElement.scrollHeight+'px';	
	document.getElementById("fndblk").style.display = "block";
	document.getElementById("lopd").style.display = "block";
	document.getElementById("lopd").innerHTML = '<div style="text-align:right"><a href="#" onclick="close_lopd()">cerrar [x]</a></div><strong>:: Cláusula de Privacidad</strong><br/><br/>XENONFACTORY.ES, garantiza mediante este aviso la privacidad de la informaci&oacute;n de car&aacute;cter personal que los interesados proporcionan al cumplimentar el formulario de contacto existente en esta web y en la navegación entre sus páginas, de acuerdo con las exigencias legales recogidas en la Ley Org&aacute;nica 15/1999, del 13 de diciembre, sobre la Protecci&oacute;n de Datos de Car&aacute;cter Personal. De igual modo, informa acerca de su pol&iacute;tica de protecci&oacute;n de datos de car&aacute;cter personal con el objetivo de que los interesados determinen libre y voluntariamente si desean facilitar a XENONFACTORY.ES, sus datos personales a trav&eacute;s cualquier tipo de contacto.<br/><br/>La finalidad de la recogida y tratamiento de los datos aportados por los interesados, no es otro que el de ser usados para el contacto con los clientes.<br/><br/>Los Usuarios consienten el tratamiento de dichos datos personales por parte de XENONFACTORY.ES, que ser&aacute;n incorporados a un fichero titularidad, garantiz&aacute;ndose en todo momento, la confidencialidad m&aacute;s absoluta en el tratamiento de los datos recabados de los interesados.<br/><br/>XENONFACTORY.ES, ha adoptado los niveles de seguridad de protecci&oacute;n de los datos personales legalmente requeridos y ha instalado todos los medios y medidas t&eacute;cnicas a su alcance para evitar la p&eacute;rdida, mal uso, alteraci&oacute;n, acceso no autorizado o robo de los datos personales facilitados.<br/><br/>Asimismo, el interesado podr&aacute; en todo momento ejercitar los derechos de acceso, rectificaci&oacute;n, cancelaci&oacute;n y oposici&oacute;n, comunic&aacute;ndolo por escrito a nuestra direcci&oacute;n de correo electr&oacute;nico bajas@xenonfactory.es.<br/><br/>En ning&uacute;n caso, XENONFACTORY.ES, utilizar&aacute; los datos personales de los interesados para fines distintos de los anteriores, salvo autorizaci&oacute;n previa del mismo.';
}
function close_lopd(){
	document.getElementById("fndblk").style.display = "none";
	document.getElementById("lopd").style.display = "none";
}

// Complementos de formulario
function nuevoAjax(){
var xmlhttp=false;
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }

if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
  xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
	
function AntiSpam(){
	var a = Math.ceil(Math.random() * 10);
	var b = Math.ceil(Math.random() * 10);       
	var c = a + b;
	document.write("<span class='lopd'>\u00bf Cuanto es <strong>"+ a + "</strong> + <strong>" + b +"</strong> ?</span> ");
	document.write("<input id='antispam' type='text' maxlength='2' style='text-align:center; width:45px' size='2' class='cuad-form' tabindex='4' />");
	document.formulario.result.value = c;	
}
// Fin Complementos de formulario

// Formulario de contacto
function enviarMail(){
	var f = document.formulario;

	if(f.nombre.value == "" || f.email.value == "" || f.consulta.value == "" || f.antispam.value == "" || f.chklopd.checked == false)
		alert("Por favor complete todos los campos");
	else if(f.antispam.value != f.result.value)
		alert("El resultado del control AntiSpam no es correcto");
	else if(f.email.value.lastIndexOf("@") == -1 || f.email.value.lastIndexOf(".") == -1)
		alert("La cuenta de email indicada no es correcta");
	else{
		c = document.getElementById('status');
		
		//variable=documenet.nombre_del_form.nombre_del_control.value
		nombre=f.nombre.value;
		email=f.email.value;
		telefono=f.telefono.value;
		consulta=f.consulta.value;
		
		ajax=nuevoAjax();
		c.innerHTML = '<br /><span class=\"lopd\">&nbsp;&nbsp;<strong>Estado:</strong> <img src="images/esperando.gif"/></span>'; 
		ajax.open("POST", "email.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
				c.innerHTML = ajax.responseText;
				if (ajax.responseText == "Estado: Se ha realizado el envío correctamente.")
					borrarCampos();
			}
		}
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		ajax.send("nombre="+nombre+"&email="+email+"&telefono="+telefono+"&consulta="+consulta);
	}
}

function borrarCampos(){
	var f = document.formulario;
	f.nombre.value="";
	f.email.value="";
	f.telefono.value="";
	f.consulta.value="";
	f.antispam.value="";
	f.chklopd.checked=false;
	f.nombre.focus();
}

var nav4 = window.Event ? true : false;
function acceptNum(evt){
	var key = nav4 ? evt.which : evt.keyCode;
	return (key <= 13 || (key >= 48 && key <= 57));
}

// Fin Formulario de contacto


// Formulario de boletin
function eboletin(){
	var f = document.form_eboletin;

	if(f.email.value == "" || f.nombre.value == "" || f.chklopd.checked == false)
		alert("Por favor completa los campos");  
	else if(f.email.value.lastIndexOf("@") == -1 || f.email.value.lastIndexOf(".") == -1)
		alert("La dirección de email indicada no es correcta");
	else{
		c = document.getElementById('status2');
		
		//variable=documenet.nombre_del_form.nombre_del_control.value
		email=f.email.value;
		nombre=f.nombre.value;
		
		ajax=nuevoAjax();
		c.innerHTML = 'Estado: <img src="images/esperando.gif"/>'; 
		ajax.open("POST", "eboletin.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
				c.innerHTML = ajax.responseText;
			}
			borrareboletin()
		}
		ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		ajax.send("email="+email+"&nombre="+nombre);
	}
}

function borrareboletin(){
	var f = document.form_eboletin;
	f.email.value="";
	f.nombre.value="";
	f.chklopd.checked=false;

}
// Fin formulario de boletin

function view_news(){
	var newsfeed=new gfeedpausescroller("news3", "news3class", 4000, "_blank")
	newsfeed.addFeed("XenonFactory", "http://www.xenonfactory.es/blog/?feed=rss2") //Specify "label" plus URL to RSS feed
	newsfeed.displayoptions("datetime snippet") //show the specified additional fields
	newsfeed.setentrycontainer("p") //Display each entry as a paragraph
	newsfeed.filterfeed(8, "date") //Show 8 entries, sort by date
	newsfeed.entries_per_page(2)
	newsfeed.init() //Always call this last
}

/* PORTAFOLIOS */
function loadfichWeb(img,tit,desc,url){
    document.getElementById('fto-web').innerHTML = '<img src="images/'+img+'" alt="'+tit+'" />';
    document.getElementById('tit-web').innerHTML = '<b>'+tit+'</b>';
    document.getElementById('desc-web').innerHTML = desc;
	if (url.substring(0,1)!='/') // Test para determinar si la URL no es de una subcarpeta
		document.getElementById('url-web').innerHTML = '<a href="http://'+url+'" target="_blank" />'+url+'</a>';
	else
		document.getElementById('url-web').innerHTML = '<a href="'+url+'" target="_blank" />'+url+'</a>';
}
function loadfichGra(img,tit,desc){
    document.getElementById('fto-gra').innerHTML = '<img src="images/'+img+'" alt="'+tit+'" />';
    document.getElementById('tit-gra').innerHTML = '<b>'+tit+'</b>';
    document.getElementById('desc-gra').innerHTML = desc;
}
/* FIN PORTAFOLIOS */
