// JavaScript Document

var fc_g=0;
var fc_w=0;

function check_g() {
	fc = document.form_login;
	if (!fc_g) {
		fc.login.value = "";
		fc.login.style.color = "#fff";
		fc_g++;
	}
}

function out_g() {
	fc = document.form_login;
	if (fc.login.value == "") {
		fc.login.value = "Correo electrónico";
		fc.login.style.color = "#ccc";
		fc_g = 0;
	}
}

function check_w() {
	fc = document.form_login;
	if (!fc_w) {
		var newO=document.createElement('input');
		newO.setAttribute('type','password');
		newO.setAttribute('name','password');
		newO.setAttribute('id','w');
		newO.setAttribute('class','it');
		newO.setAttribute('className','it');
		fc.password.parentNode.replaceChild(newO,fc.password);
		pw = document.getElementById('w');
		pw.style.color = "#fff";
		setTimeout("pw.focus();", 10);
		fc_w++;
	}
}

function check_b() {
	fb = document.form_newsletter.newsl;
	fb.value = "";
}

function out_b() {
	fb = document.form_newsletter.newsl;
	if (fb.value=="") fb.value = "Escribe tu email";
}

function suscribe() {
	fh = document.form_newsletter;
	re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/; 
	if (!re.test(fh.newsl.value)) { 
		txt = "Debes introducir un correo electrónico válido para suscribirte.";
		alert (txt);
		fh.newsl.focus();
	} else fh.submit();
}

function unsuscribe() {
	fh = document.form_newsletter;
	re  = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/; 
	if (!re.test(fh.newsl.value)) { 
		txt = "Debes introducir un correo electrónico válido para cancelar la suscripción.";
		alert (txt);
		fh.newsl.focus();
	} else {
		fh.accion.value = "";
		fh.submit();
	}
}

function go_fb() {
	window.open('http://www.facebook.com/pages/A-Coruna-Spain/Royal-Store/48556125687', 'royal_fb','');
}
