var isEmail_re       = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/; 
function isEmail (s) { 
   return String(s).search (isEmail_re) != -1; 
}


function check_email(e) {
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	
	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0){ 
			return (false);
		}	
	} 
	
	if (document.images) {
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) {
			return (-1);		
		} 
	
	}

}

<!--

function check_form(f) { // f is the form (passed using the this keyword)
	var bool=1;
	if(f.nombreTxt.value == ""){
		f.nombreTxt.style.borderColor = "red";
		f.nombreTxt.style.borderStyle = "solid";
		bool=0;
	}
	if(f.correoTxt.value == ""){
		f.correoTxt.style.borderColor = "red";
		f.correoTxt.style.borderStyle = "solid";
		bool=0;
	}else{
		if(!isEmail(f.correoTxt.value))
		{
			f.correoTxt.style.borderColor = "red";
			f.correoTxt.style.borderStyle = "solid";
			bool=0;
		}
	}
	if(f.telefonoTxt.value == ""){
		f.telefonoTxt.style.borderColor = "red";
		f.telefonoTxt.style.borderStyle = "solid";
		bool=0;
	}
	if(f.fromdate.value == "Desde" || f.fromdate.value == "From" || f.fromdate.value == "du" ){
		f.fromdate.style.borderColor = "red";
		f.fromdate.style.borderStyle = "solid";
		bool=0;
	}
	if(f.todate.value == "Hasta" || f.todate.value == "To" || f.todate.value == "au"){
		f.todate.style.borderColor = "red";
		f.todate.style.borderStyle = "solid";
		bool=0;
	}
	if(f.adultosCbx.value < 1){
		f.adultosCbx.style.backgroundColor = "#FF6666";
		bool=0;
	}
	
	

	if(bool==0)
	{
		return false;
	}else{
		return true;
	}
}
function check_form2(f) { // f is the form (passed using the this keyword)
	var bool=1;
	if(f.nombreTxt.value == ""){
		f.nombreTxt.style.borderColor = "red";
		f.nombreTxt.style.borderStyle = "solid";
		bool=0;
	}
	if(f.correoTxt.value == ""){
		f.correoTxt.style.borderColor = "red";
		f.correoTxt.style.borderStyle = "solid";
		bool=0;
	}else{
		if(!isEmail(f.correoTxt.value))
		{
		f.correoTxt.style.borderColor = "red";
		f.correoTxt.style.borderStyle = "solid";
			bool=0;
		}
	}
	if(f.telefonoTxt.value == ""){
		f.telefonoTxt.style.borderColor = "red";
		f.telefonoTxt.style.borderStyle = "solid";
		bool=0;
	}
	if(f.comentarioTxt.value < 1){
		f.comentarioTxt.style.borderColor = "red";
		f.comentarioTxt.style.borderStyle = "solid";
		bool=0;
	}
	
	

	if(bool==0)
	{
		return false;
	}else{
		return true;
	}
}
function check_form3(f) { // f is the form (passed using the this keyword)
	var bool=1;
	var mensaje2 = "";
	var mensajeDiv = document.getElementById('mensaje');
	var html_content = editor.getContent();
	if(f.tituloTxt.value == ""){
		f.tituloTxt.style.borderColor = "red";
		f.tituloTxt.style.borderStyle = "solid";
		mensaje2+="<li>El campo Título no puede ser vacío</li>";
		bool=0;
	}
	if(html_content == "")
	{
		var myText = document.getElementById('editorObj');
		myText.style.borderColor = "red";
		myText.style.borderStyle = "solid";
		mensaje2+="<li>El campo Noticia no puede ser vacío</li>";
		bool=0;
	}else{
	
		f.hiddenTxt.value = html_content;
	}
	if(bool==0)
	{
		var mensaje="Los siguientes campos contienen errores:<ul style='margin-top:0px;'>";
		mensaje += mensaje2;
		mensaje+="</ul>";
		mensajeDiv.innerHTML = mensaje;
		return false;
	}else{
		return true;
	}
}
function cambiarOnFocus(c){
	var str = c.style.borderColor;
	str = str.substring(0,3);
	if(str=="red")
	{
		c.style.borderColor = "";
		c.style.borderStyle = "";
		c.style.borderWidth = "";
	}
	c.style.backgroundColor="";
	

}
function cambiarOnFocusDoble(c1,c2){
	var str1 = c1.style.borderColor;
	var str2 = c2.style.borderColor;
	str1 = str1.substring(0,3);
	str2 = str2.substring(0,3);
	if(str1=="red" || str2=="red")
	{
		c1.style.borderColor = "";
		c1.style.borderStyle = "";
		c1.style.borderWidth = "";
		c2.style.borderColor = "";
		c2.style.borderStyle = "";
		c2.style.borderWidth = "";
	}
}
function cambiarOnFocusDiv(c){
	var str = c.style.borderColor;
	str = str.substring(0,3);
	if(str=="red")
	{
		c.style.borderColor = "#909090";
		c.style.borderStyle = "solid";
		c.style.borderWidth = "1px";
	}

}
function printpage() {
	window.print();
}

function printpage() {
	window.print();
}

function mailpage(txt1,txt2,txt3)
{
	mail_str = "mailto:?subject=" + txt1 + document.title;
	mail_str += "&body=" + txt2 + document.title;
	mail_str += txt3 + location.href; 
	location.href = mail_str;
}

function gotoURL(url){
	document.location.href = url;
}

function getMes(m)
{
	switch(m)
	{
	case 0:
	  mesTxt="enero";
	  break;
	case 1:
	  mesTxt="febrero";
	  break;
	case 2:
	  mesTxt="marzo";
	  break;
	case 3:
	  mesTxt="abril";
	  break;
	case 4:
	  mesTxt="mayo";
	  break;
	case 5:
	  mesTxt="junio";
	  break;
	case 6:
	  mesTxt="julio";
	  break;
	case 7:
	  mesTxt="agosto";
	  break;
	case 8:
	  mesTxt="septiembre";
	  break;
	case 9:
	  mesTxt="octubre";
	  break;
	case 10:
	  mesTxt="noviembre";
	  break;
	case 11:
	  mesTxt="diciembre";
	  break;
	}
	return mesTxt;
}

function anadirFecha(d,h)
{
	var bool=1;
	if(d.value == "Desde" || h.value == "Hasta" ){
		d.style.borderColor = "red";
		d.style.borderStyle = "solid";
		h.style.borderColor = "red";
		h.style.borderStyle = "solid";
		bool=0;
	}else{
		var fechasDiv = document.getElementById('fechas');
		//alert(document.formulario.hiddenFechas.value);
		var fechad = d.value;
		diad = fechad.substr(0,2);
		mesd2 = fechad.substr(3,2);
		var mesd = new Number(fechad.substr(3,2));
		anod = fechad.substr(6,4);
		var myDateD=new Date(anod,mesd-1,diad);
		
		var fechah = h.value;
		diah = fechah.substr(0,2);
		mesh2 = fechah.substr(3,2)
		var mesh = new Number(fechah.substr(3,2));
		anoh = fechah.substr(6,4);
		var myDateH=new Date(anoh,mesh-1,diah);
		
		document.formulario.hiddenFechas.value = document.formulario.hiddenFechas.value+anod+""+mesd2+""+diad+"-"+anoh+""+mesh2+""+diah+";"
		
		if(Date.parse(myDateD) == Date.parse(myDateH))
		{
				fechasDiv.innerHTML = fechasDiv.innerHTML+"el "+myDateD.getDate()+" de "+getMes(myDateD.getMonth())+" de "+myDateD.getYear()+"<br>";
		}else{
			if(myDateD.getMonth()==myDateH.getMonth())
			{
				fechasDiv.innerHTML = fechasDiv.innerHTML+"desde el "+myDateD.getDate()+" al "+myDateH.getDate()+" de "+getMes(myDateD.getMonth())+" de "+myDateD.getYear()+"<br>";
			}else{
				fechasDiv.innerHTML = fechasDiv.innerHTML+"desde el "+myDateD.getDate()+" de "+getMes(myDateD.getMonth())+" al "+myDateH.getDate()+" de "+getMes(myDateH.getMonth())+" de "+myDateD.getYear()+"<br>";
			}
		}
		//alert(document.formulario.hiddenFechas.value);
		d.value = "Desde";
		h.value = "Hasta";
		
		//mDCal.setDate("","")
	}
	
	if(bool==0)
	{
		return false;
	}else{
		return true;
	}
}
