	function open_customerservice() {
		window.open('customerservice/contactpop1.php',
						'Customerservice',
						'toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,width=510,height=520,top=100,left=200'); 
		return false;
	}

	function open_tariffnotice() {
		window.open('pop_tariffnotice.php',
						'Tariffnotice',
						'toolbar=no,directories=no,status=no,scrollbars=no,resize=no,menubar=no,width=490,height=520,top=100,left=200'); 
		return false;
	}
	
	function ignoreSpaces(string) {
		var temp = "";
		string = '' + string;
		splitstring = string.split(" ");
		for(i = 0; i < splitstring.length; i++) {
			temp += splitstring[i];
		}
		return temp;
	}

	function isEmail(address) {
		var isValid = false;
		// basic checks (relying on lazy evaluation for correct behaviour!)
		// not empty
		// at least 7 characters (x@yy.zz)
		// has @
		// has only 1 @
		// has at least one . (domain.ext)
		isValid = (address!=null) 
		       && (address.length >= 7) 
		       && (address.indexOf('@')!=-1) 
		       && (address.indexOf('@') == address.lastIndexOf('@'))
		       && (address.indexOf('.')!=-1)
		;
		
		if (isValid) {
			var parts = address.split('@');
			var name  = parts[0].split('.');
			var host  = parts[1].split('.');
			var regName  = new RegExp("^([!#$%&'*+-/0-9=?A-Z^_a-z{}~]+)$"); // at least length 1
			var regLabel = new RegExp("^(^[-0-9A-Za-z][-0-9A-Za-z]+)$"); // at least length 2
			var regExt   = new RegExp("^([A-Za-z]{2,63})$"); // at least length 2
			var i;
			for (i=0; i < name.length; i++) {
				isValid = isValid && (name[i].search(regName) != -1);
			}
			for (i=0; i < host.length-1; i++) {
				isValid = isValid && (host[i].search(regLabel) != -1) && (host[i].length <= 63);
			}
			isValid = isValid && (host[host.length-1].search(regExt) != -1);
		}
		return isValid;
	}
	
	function checkForm(form)
	{
		var InputEmail = form.email.value;
		
		if (InputEmail=='')
		{
			alert ("La dirección de correo electrónico introducida es incorrecta.");
			return false;
		}
		else if (!isEmail(InputEmail))
		{
			alert ("La dirección de correo electrónico introducida es incorrecta.");
			return false;
		}
		else return true;
	}

	function noenterSpecial(form) {
		
		if (window.event && window.event.keyCode == 13)
		{
			if (checkForm(form))
			{
				form.submit();
			}
			else return false;
		}
		
		return true;
	}



	function noenter() {
		return !(window.event && window.event.keyCode == 13); 
	}
	function openPopUp(address, width, height, title) 
	{
		// 420,360 should be dueable
		if ((width<10) || (height<10)) alert('window size to small');
		else
		{		
			var extra = 'status=no,scrollbars=yes,'.concat('width=', width, ',height=', height);	
			var t = escape(title);
			var add = address.concat('?poptitle=', t);		
			window.open(add,'',extra);
		}
	}

	function open_popUpContact()
	{
		openPopUp('http://www.Descontel.com/customerservice/contactpop1.php', 485, 500, 'Contacte-nos');
	}
	function openPopUpTellAFriend(form)
	{
		var i;
		var sel;
		for (i=0;i<form.tellfriend.length;i++)
		{
			sel = form.tellfriend[i];
			if (sel.checked)break;
		}
		if (sel.value=='email')
		{
			openPopUp('http://www.descontel.com/tellafriend_email.php', 485, 500, 'Informe os seus amigos!');
		}
		else if (sel.value=='fax')
		{
			openPopUp('http://www.descontel.com/tellafriend_fax.php', 485, 500, 'Informe os seus amigos!');
		}
		else if (sel.value=='sms')
		{
			openPopUp('http://www.descontel.com/tellafriend_sms.php', 485, 500, 'Informe os seus amigos!');
		}
		else if (sel.value=='phone')
		{
			openPopUp('http://www.descontel.com/tellafriend_tel.php', 485, 500, 'Informe os seus amigos!');
		}
		else
		{
			alert('Radio not selected:'+sel.value);
		}
	}