		var id_hotel = getQueryString('idhotel');
		var html_language = "es";

		function getQueryString(variable) {
		var query = window.location.search.substring(1);
		var vars = query.split("&");
		for (var i=0;i<vars.length;i++) {
			var pair = vars[i].split("=");
			if (pair[0].toString().toLowerCase() == variable.toString().toLowerCase()) {
			return pair[1];
			}
		} 
			return 0; 
		}			

		
	function echeck2(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}
	
	
		function validate(){
			var txt1 = document.getElementById("txtName_recommend")//Nombre
			var txt2 = document.getElementById("txtEmail_recommend")//email
			var txt3 = document.getElementById("txtNameFriend_recommend")//Nombre contacto
			var txt4 = document.getElementById("txtEmailFriend_recommend")//email contacto
			var txtArea1 = document.getElementById("txtComments_recommend")//Comentarios
			
			var msgs = "";
			if ((txt1.value ==null)||(txt1.value==""))
				msgs = msgs + msgRecomendUs_MissingName + "\n";

			if ((txt2.value==null)||(txt2.value==""))
				msgs = msgs + msgRecomendUs_MissingEmail + "\n";
			else
				if (echeck2(txt2.value) == false)					
					msgs = msgs + msgRecomendUs_InvalidEmail + "\n";


			if ((txt3.value == null)||(txt3.value==""))
				msgs = msgs + msgRecomendUs_MissingNameContact + "\n";

			if ((txt4.value==null)||(txt4.value==""))
				msgs = msgs + msgRecomendUs_MissingEmailContact + "\n";
			else
				if (echeck2(txt4.value) == false)					
					msgs = msgs + msgRecomendUs_InvalidEmailContact + "\n";
					
			if ((txtArea1.value == null)||(txtArea1.value==""))
				msgs = msgs + msgRecomendUs_MissingComment + "\n";

			if(msgs==""){
				//call function to server
				sbHttp = new HTTPXml();
				if (!sbHttp.inprogress) 
				{
						window.status = msgRecomendUs_SendingProcess;
						
						showDiv();
						
						var sbHttp = new HTTPXml();						
						sbHttp.init("ContentHandler.aspx?ajax=mailRecommend&language=" + html_language + "&data=" + txt1.value + "$" + txt2.value + "$" + txt3.value + "$" + txt4.value + "$" + txtArea1.value);
						try {
								sbHttp.setTimeout(20000);
								sbHttp.asyncGET(new sendMail_CallBack);
						} catch (e) {
								alert(e); 
						}
				}
				else {alert("busy");}
			}else
				alert(msgs);	
		}

function clearTexts()
{
			var txt1 = document.getElementById("txtName_recommend")//Nombre
			var txt2 = document.getElementById("txtEmail_recommend")//email
			var txt3 = document.getElementById("txtNameFriend_recommend")//Nombre contacto
			var txt4 = document.getElementById("txtEmailFriend_recommend")//email contacto
			var txtArea1 = document.getElementById("txtComments_recommend")//Comentarios

			txt1.value = "";
			txt2.value = "";
			txt3.value = "";
			txt4.value = "";
			txtArea1.value = "";
}

function sendMail_CallBack() {
		this.onProgress=function wait(t,l){
			window.status = msgRecomendUs_Processing;
		}
		
		this.onLoad=function done(client) {										
			if(client.getTags("status").item(0).firstChild.nodeValue == 0){				
				clearTexts();
				alert(msgSuccessFullSendMail);
			}else
				{					
					alert(msgRecomendUs_CantSend);
				}
			hideDiv();
	}
}

function showDiv(){
			var eP = document.getElementById("divWait");
			eP.style.display="block";	
			
			var txt1 = document.getElementById("txtName_recommend")//Nombre
			var txt2 = document.getElementById("txtEmail_recommend")//email
			var txt3 = document.getElementById("txtNameFriend_recommend")//Nombre contacto
			var txt4 = document.getElementById("txtEmailFriend_recommend")//email contacto
			var txtArea1 = document.getElementById("txtComments_recommend")//Comentarios
			var bt = document.getElementById("BtnSend_RecommendUs");
			
			txt1.disabled = true
			txt2.disabled = true
			txt3.disabled = true
			txt4.disabled = true
			txtArea1 .disabled = true
			bt.disabled = true				
}

function hideDiv(){
			var eP = document.getElementById("divWait");
			eP.style.display="none";

			var txt1 = document.getElementById("txtName_recommend")//Nombre
			var txt2 = document.getElementById("txtEmail_recommend")//email
			var txt3 = document.getElementById("txtNameFriend_recommend")//Nombre contacto
			var txt4 = document.getElementById("txtEmailFriend_recommend")//email contacto
			var txtArea1 = document.getElementById("txtComments_recommend")//Comentarios
			var bt = document.getElementById("BtnSend_RecommendUs");
			
			txt1.disabled = false
			txt2.disabled = false
			txt3.disabled = false
			txt4.disabled = false
			txtArea1 .disabled = false
			bt.disabled = false			
}