| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/laragon/www/assets/js/ |
Upload File : |
var $j = jQuery.noConflict();
var http = createRequestObject();
var areal = Math.random() + "";
var real = areal.substring(2,6);
var contactEndpoint = getContactEndpoint();
var contactLoansEndpoint = getProjectEndpoint('endpoints/contactform_loans.php');
function createRequestObject() {
var xmlhttp;
try {
var xmlhttp = null;if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest();}else{ if (window.ActiveXObject) { xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); } }
// xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e) {
try {
var xmlhttp = null;if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest();}else{ if (window.ActiveXObject) { xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } }
//xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(f) { xmlhttp=null; }
}
if(!xmlhttp&&typeof XMLHttpRequest!="undefined") {
xmlhttp=new XMLHttpRequest();
}
return xmlhttp;
}
function sendRequest() {
var name = document.getElementById("name").value;
var email = document.getElementById("email").value;
var subject = document.getElementById("subject").value;
var body = document.getElementById("body").value;
postContactForm(
{ action: 'contact', name: name, email: email, subject: subject, body: body },
function () {
jQuery('#contactform').slideUp("slow").hide();
jQuery('#contactWrapper').append('<div class="success"><h4>Mensaje enviado correctamente.</h4><br><p>Gracias <strong>'+escapeHtml(name)+'</strong>. Recibimos tu mensaje.</p></div>');
},
function (message) {
showFormError('#contactWrapper', message);
resetSubmitButton('submit', 'Enviar Mensaje');
}
);
}
function sendRequest_booking() {
var name = document.getElementById("name").value;
var email = document.getElementById("email").value;
var surname = document.getElementById("surname").value;
var arrival = document.getElementById("arrival").value;
var room = document.getElementById("room").value;
var departure = document.getElementById("departure").value;
var children = document.getElementById("children").value;
var adults = document.getElementById("adults").value;
var rooms = document.getElementById("rooms").value;
var body = document.getElementById("body").value;
postContactForm(
{
action: 'booking',
name: name,
surname: surname,
email: email,
arrival: arrival,
room: room,
departure: departure,
children: children,
adults: adults,
rooms: rooms,
body: body
},
function () {
jQuery('#contactform_booking').slideUp("slow").hide();
jQuery('#contactWrapper').append('<div class="success"><h4>Mensaje enviado correctamente.</h4><br><p>Gracias <strong>'+escapeHtml(name)+'</strong>. Recibimos tu solicitud.</p></div>');
},
function (message) {
showFormError('#contactWrapper', message);
resetSubmitButton('submit', 'Enviar Mensaje');
}
);
}
function sendRequest_loans() {
var rnd = Math.random();
var name = escape(document.getElementById("name").value);
var name_s = escape(document.getElementById("name_s").value);
var subject = escape(document.getElementById("subject").value);
try{
http.open('POST', contactLoansEndpoint);
http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
http.onreadystatechange = handleResponse_popup;
http.send('name='+name+'&name_s='+name_s+'&subject='+subject+'&rnd='+rnd);
}
catch(e){}
finally{
jQuery('#contactform_popup').slideUp("slow").hide();
jQuery('#contactWrapper_popup').append('<div class="success"><h4>Email Successfully Sent!</h4><br><p>Thank you for using our contact form <strong>'+name+'</strong>! Your email was successfully sent and we'll be in touch with you soon.</p></div>');
}
}
function sendRequest_popup() {
var name = document.getElementById("name_popup").value;
var email = document.getElementById("email_popup").value;
var subject = document.getElementById("subject_popup").value;
var body = document.getElementById("body_popup").value;
postContactForm(
{ action: 'contact', name: name, email: email, subject: subject, body: body },
function () {
jQuery('#contactform_popup').slideUp("slow").hide();
jQuery('#contactWrapper_popup').append('<div class="success"><h4>Mensaje enviado correctamente.</h4><br><p>Gracias <strong>'+escapeHtml(name)+'</strong>. Recibimos tu mensaje.</p></div>');
},
function (message) {
showFormError('#contactWrapper_popup', message);
resetSubmitButton('submit_popup', 'Enviar Mensaje');
}
);
}
function sendRequest_news() {
if(document.getElementById("name_news") instanceof Object){
var name = document.getElementById("name_news").value;}
else{
var name ='noname';
}
var email = document.getElementById("email_news").value;
postContactForm(
{ action: 'newsletter', name_news: name, email_news: email },
function () {
jQuery('#newsletterform').slideUp("slow").hide();
jQuery('#newsletterform').parent().append('<div class="success"><h4>Suscripcion enviada correctamente.</h4><br><p>Registramos tu email: '+escapeHtml(email)+'.</p></div>');
},
function (message) {
showFormError('#newsletterform', message);
resetSubmitButton('submit', 'SUBSCRIBE');
}
);
}
function sendRequest_news_simple() {
var email = document.getElementById("email_news").value;
postContactForm(
{ action: 'newsletter', email_news: email },
function () {
jQuery('#newsletterform').slideUp("slow").hide();
jQuery('#newsletterform').parent().append('<div class="success"><h4>Suscripcion enviada correctamente.</h4><br><p>Registramos tu email: '+escapeHtml(email)+'.</p></div>');
},
function (message) {
showFormError('#newsletterform', message);
resetSubmitButton('submit', 'Enviar mensaje');
}
);
}
function getContactEndpoint() {
return getProjectEndpoint('endpoints/contact.php');
}
function getProjectEndpoint(path) {
var scripts = document.getElementsByTagName('script');
for (var i = scripts.length - 1; i >= 0; i--) {
var src = scripts[i].getAttribute('src') || '';
var match = src.match(/^(.*\/)?js\/email\.js(?:\?.*)?$/);
if (match) {
return (match[1] || '') + path;
}
}
return path;
}
function postContactForm(data, onSuccess, onError) {
var request = createRequestObject();
var payload = [];
for (var key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
payload.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key]));
}
}
try {
request.open('POST', contactEndpoint);
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
request.onreadystatechange = function () {
if (request.readyState !== 4) {
return;
}
var response = {};
try {
response = JSON.parse(request.responseText || '{}');
} catch (e) {}
if (request.status >= 200 && request.status < 300 && response.success) {
onSuccess(response.message || 'Mensaje enviado correctamente.');
return;
}
onError(response.message || 'No se pudo enviar el mensaje. Intente nuevamente.');
};
request.send(payload.join('&'));
} catch (e) {
onError('No se pudo enviar el mensaje. Intente nuevamente.');
}
}
function showFormError(containerSelector, message) {
var $container = jQuery(containerSelector);
$container.find('.form-error').remove();
$container.append('<div class="error form-error">'+escapeHtml(message)+'</div>');
}
function resetSubmitButton(id, value) {
var button = document.getElementById(id);
if (button) {
button.disabled = false;
button.value = value;
}
}
function escapeHtml(value) {
return String(value).replace(/[&<>"']/g, function (character) {
return {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
}[character];
});
}
function validate_email(address) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(reg.test(address) == false) {
return false;
}
else
return true;
}
function validate_phone(phone){
var reg = /^[\:\-\.\_\(\) 0-9]+$/
if(reg.test(phone) == false) {
return false;
}
else
return true;
}
function check_values() {
//Form
var valid = '';
var $j = jQuery.noConflict();
var name = '';
var email = '';
var subject = '';
var body = '';
if(typeof $j('#contactform #name').val() != "undefined" )
{
name = document.getElementById("name").value;
}
if(typeof $j('#contactform #email').val() != "undefined" )
{
email = document.getElementById("email").value;
}
if(typeof $j('#contactform #subject').val() != "undefined" )
{
subject = document.getElementById("subject").value;
}
if(typeof $j('#contactform #body').val() != "undefined" )
{
body = document.getElementById("body").value;
}
var errors=0;
if($j('#contactform #name').val()!=undefined)
if($j('#contactform #name').val()=='') {
var hasClass=$j('#contactform #name').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform #name').parent().append('<label for="contactname" generated="true" class="error">Please enter your name</label>');
$j('#contactform #name').focus();
//return false;
errors++;
}
else
$j('#contactform #name').parent().find(".error").remove();
if($j('#contactform #email').val()!=undefined)
if(validate_email($j('#contactform #email').val())==false ) {
var hasClass=$j('#contactform #email').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform #email').parent().append('<label for="contactname" generated="true" class="error">Please enter a valid email address</label>');
$j('#contactform #email').focus();
//return false;
errors++;
}
else
$j('#contactform #email').parent().find(".error").remove();
if($j('#contactform #subject').val()!=undefined)
if($j('#contactform #subject').val()==''){
var hasClass=$j('#contactform #subject').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform #subject').parent().append('<label for="contactname" generated="true" class="error">You need to enter a subject!</label>');
$j('#contactform #subject').focus();
//return false;
errors++;
}
else
$j('#contactform #subject').parent().find(".error").remove();
if($j('#contactform #body').val()!=undefined)
if($j('#contactform #body').val()==''){
var hasClass=$j('#contactform #body').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform #body').parent().append('<label for="contactname" generated="true" class="error">You need to enter a message!</label>');
$j('#contactform #body').focus();
//return false;
errors++;
}
else
$j('#contactform #body').parent().find(".error").remove();
if(errors==0) {
document.getElementById("submit").disabled=true;
document.getElementById("submit").value='Please Wait..';
sendRequest();
}
}
function check_values_loans() {
//Form
var valid = '';
var $j = jQuery.noConflict();
var name = '';
var subject = '';
var name_s = '';
if(typeof $j('#contactform #name').val() != "undefined" )
{
name = document.getElementById("name").value;
}
if(typeof $j('#contactform #subject').val() != "undefined" )
{
subject = document.getElementById("subject").value;
}
if(typeof $j('#contactform #name_s').val() != "undefined" )
{
name_s = document.getElementById("name_s").value;
}
var errors=0;
if($j('#contactform #name').val()!=undefined)
if($j('#contactform #name').val()=='') {
var hasClass=$j('#contactform #name').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform #name').parent().append('<label for="contactname" generated="true" class="error">Please enter your first name</label>');
$j('#contactform #name').focus();
//return false;
errors++;
}
else
$j('#contactform #name').parent().find(".error").remove();
if($j('#contactform #subject').val()!=undefined)
if($j('#contactform #subject').val()==''){
var hasClass=$j('#contactform #subject').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform #subject').parent().append('<label for="contactname" generated="true" class="error">You need to enter a subject!</label>');
$j('#contactform #subject').focus();
//return false;
errors++;
}
else
$j('#contactform #subject').parent().find(".error").remove();
if($j('#contactform #name_s').val()!=undefined)
if($j('#contactform #name_s').val()==''){
var hasClass=$j('#contactform #name_s').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform #name_s').parent().append('<label for="contactname" generated="true" class="error">You need to enter your last name!</label>');
$j('#contactform #name_s').focus();
//return false;
errors++;
}
else
$j('#contactform #name_s').parent().find(".error").remove();
if(errors==0) {
document.getElementById("submit").disabled=true;
document.getElementById("submit").value='Please Wait..';
sendRequest_loans();
}
}
function check_values_booking() {
//Form
var valid = '';
var $j = jQuery.noConflict();
var name = '';
var email = '';
var body = '';
var surname = '';
var arrival = '';
var departure = '';
var room = '';
var adults = '';
var children = '';
var rooms = '';
if(typeof $j('#contactform_booking #name').val() != "undefined" )
{
name = document.getElementById("name").value;
}
if(typeof $j('#contactform_booking #email').val() != "undefined" )
{
email = document.getElementById("email").value;
}
if(typeof $j('#contactform_booking #body').val() != "undefined" )
{
body = document.getElementById("body").value;
}
if(typeof $j('#contactform_booking #surname').val() != "undefined" )
{
surname = document.getElementById("surname").value;
}
if(typeof $j('#contactform_booking #arrival').val() != "undefined" )
{
arrival = document.getElementById("arrival").value;
}
if(typeof $j('#contactform_booking #departure').val() != "undefined" )
{
departure = document.getElementById("departure").value;
}
if(typeof $j('#contactform_booking #room').val() != "undefined" )
{
room = document.getElementById("room").value;
}
if(typeof $j('#contactform_booking #adults').val() != "undefined" )
{
adults = document.getElementById("adults").value;
}
if(typeof $j('#contactform_booking #children').val() != "undefined" )
{
children = document.getElementById("children").value;
}
if(typeof $j('#contactform_booking #rooms').val() != "undefined" )
{
rooms = document.getElementById("rooms").value;
}
var errors=0;
if($j('#contactform_booking #name').val()!=undefined)
if($j('#contactform_booking #name').val()=='') {
var hasClass=$j('#contactform_booking #name').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #name').parent().append('<label for="contactname" generated="true" class="error">Please enter your name</label>');
$j('#contactform_booking #name').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #name').parent().find(".error").remove();
if($j('#contactform_booking #email').val()!=undefined)
if(validate_email($j('#contactform_booking #email').val())==false ) {
var hasClass=$j('#contactform_booking #email').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #email').parent().append('<label for="contactname" generated="true" class="error">Please enter a valid email address</label>');
$j('#contactform_booking #email').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #email').parent().find(".error").remove();
if($j('#contactform_booking #surname').val()=='') {
var hasClass=$j('#contactform_booking #surname').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #surname').parent().append('<label for="contactname" generated="true" class="error">Please enter your surname</label>');
$j('#contactform_booking #surname').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #surname').parent().find(".error").remove();
if($j('#contactform_booking #arrival').val()=='') {
var hasClass=$j('#contactform_booking #arrival').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #arrival').parent().append('<label for="contactname" generated="true" class="error">Please enter arrival date</label>');
$j('#contactform_booking #arrival').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #arrival').parent().find(".error").remove();
if($j('#contactform_booking #departure').val()=='') {
var hasClass=$j('#contactform_booking #departure').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #departure').parent().append('<label for="contactname" generated="true" class="error">Please enter departure date</label>');
$j('#contactform_booking #departure').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #departure').parent().find(".error").remove();
if($j('#contactform_booking #room').val()=='') {
var hasClass=$j('#contactform_booking #room').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #room').parent().append('<label for="contactname" generated="true" class="error">Please enter your room nr</label>');
$j('#contactform_booking #room').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #room').parent().find(".error").remove();
if($j('#contactform_booking #adults').val()=='') {
var hasClass=$j('#contactform_booking #adults').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #adults').parent().append('<label for="contactname" generated="true" class="error">Please enter adults nr</label>');
$j('#contactform_booking #adults').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #adults').parent().find(".error").remove();
if($j('#contactform_booking #children').val()=='') {
var hasClass=$j('#contactform_booking #children').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #children').parent().append('<label for="contactname" generated="true" class="error">Please enter children nr</label>');
$j('#contactform_booking #children').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #children').parent().find(".error").remove();
if($j('#contactform_booking #rooms').val()=='') {
var hasClass=$j('#contactform_booking #rooms').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #rooms').parent().append('<label for="contactname" generated="true" class="error">Please enter rooms nr</label>');
$j('#contactform_booking #rooms').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #rooms').parent().find(".error").remove();
if($j('#contactform_booking #body').val()!=undefined)
if($j('#contactform_booking #body').val()==''){
var hasClass=$j('#contactform_booking #body').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_booking #body').parent().append('<label for="contactname" generated="true" class="error">You need to enter a message!</label>');
$j('#contactform_booking #body').focus();
//return false;
errors++;
}
else
$j('#contactform_booking #body').parent().find(".error").remove();
if(errors==0) {
document.getElementById("submit").disabled=true;
document.getElementById("submit").value='Please Wait..';
sendRequest_booking();
}
}
function check_values_popup() {
//Form
var valid = '';
var $j = jQuery.noConflict();
var name = document.getElementById("name_popup").value;
var email = document.getElementById("email_popup").value;
var subject = document.getElementById("subject_popup").value;
var body = document.getElementById("body_popup").value;
var errors=0;
if($j('#contactform_popup #name_popup').val()!=undefined)
if($j('#contactform_popup #name_popup').val()=='') {
var hasClass=$j('#contactform_popup #name_popup').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_popup #name_popup').parent().append('<label for="contactname" generated="true" class="error">Please enter your name</label>');
$j('#contactform_popup #name_popup').focus();
//return false;
errors++;
}
else
$j('#contactform_popup #name_popup').parent().find(".error").remove();
if($j('#contactform_popup #email_popup').val()!=undefined)
if(validate_email($j('#contactform_popup #email_popup').val())==false ) {
var hasClass=$j('#contactform_popup #email_popup').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_popup #email_popup').parent().append('<label for="contactname" generated="true" class="error">Please enter a valid email address</label>');
$j('#contactform_popup #email_popup').focus();
//return false;
errors++;
}
else
$j('#contactform_popup #email_popup').parent().find(".error").remove();
if($j('#contactform_popup #subject').val()!=undefined)
if($j('#contactform_popup #subject_popup').val()==''){
var hasClass=$j('#contactform_popup #subject_popup').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_popup #subject_popup').parent().append('<label for="contactname" generated="true" class="error">You need to enter a subject!</label>');
$j('#contactform_popup #subject_popup').focus();
//return false;
errors++;
}
else
$j('#contactform_popup #subject_popup').parent().find(".error").remove();
if($j('#contactform_popup #body_popup').val()!=undefined)
if($j('#contactform_popup #body_popup').val()==''){
var hasClass=$j('#contactform_popup #body_popup').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#contactform_popup #body_popup').parent().append('<label for="contactname" generated="true" class="error">You need to enter a message!</label>');
$j('#contactform_popup #body_popup').focus();
//return false;
errors++;
}
else
$j('#contactform_popup #body_popup').parent().find(".error").remove();
if(errors==0) {
document.getElementById("submit_popup").disabled=true;
document.getElementById("submit_popup").value='Please Wait..';
sendRequest_popup();
}
}
function check_values_news() {
//Form
var valid = '';
var $j = jQuery.noConflict();
var name = '';
var email = '';
if(typeof $j('#newsletterform #name_news').val() != "undefined" )
{
name = document.getElementById("name_news").value;
}
if(typeof $j('#newsletterform #email_news').val() != "undefined" )
{
email = document.getElementById("email_news").value;
}
var errors=0;
if($j('#newsletterform #name_news').val()!=undefined)
if($j('#newsletterform #name_news').val()=='') {
var hasClass=$j('#newsletterform #name_news').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#newsletterform #name_news').parent().append('<label for="contactname" generated="true" class="error">Please enter your name</label>');
$j('#newsletterform #name_news').focus();
//return false;
errors++;
}
else
$j('#newsletterform #name_news').parent().find(".error").remove();
if($j('#newsletterform #email_news').val()!=undefined)
if(validate_email($j('#newsletterform #email_news').val())==false ) {
var hasClass=$j('#newsletterform #email_news').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#newsletterform #email_news').parent().append('<label for="contactname" generated="true" class="error">Please enter a valid email address</label>');
$j('#newsletterform #email_news').focus();
//return false;
errors++;
}
else
$j('#newsletterform #email_news').parent().find(".error").remove();
if(errors==0) {
document.getElementById("submit").disabled=true;
document.getElementById("submit").value='Please Wait..';
sendRequest_news();
}
}
function check_values_news_simple() {
console.log("dsa");
//Form
var valid = '';
var $j = jQuery.noConflict();
var email = '';
if(typeof $j('#newsletterform #email_news').val() != "undefined" )
{
email = document.getElementById("email_news").value;
}
var errors=0;
if($j('#newsletterform #email_news').val()!=undefined)
if(validate_email($j('#newsletterform #email_news').val())==false ) {
var hasClass=$j('#newsletterform #email_news').parent().find(".error").hasClass("error");
if(!hasClass)
$j('#newsletterform #email_news').parent().append('<label for="contactname" generated="true" class="error">Please enter a valid email address</label>');
$j('#newsletterform #email_news').focus();
return false;
errors++;
}
else
$j('#newsletterform #email_news').parent().find(".error").remove();
if(errors==0) {
document.getElementById("submit").disabled=true;
document.getElementById("submit").value='Please Wait..';
sendRequest_news_simple();
}
}
function handleResponse() {
try{
if((http.readyState == 4)&&(http.status == 200)){
var response = http.responseText;
document.getElementById("confirmation").innerHTML = response;
document.getElementById("confirmation").style.display ="";
}
}
catch(e){}
finally{}
}
function handleResponse_popup() {
try{
if((http.readyState == 4)&&(http.status == 200)){
var response = http.responseText;
document.getElementById("confirmation_popup").innerHTML = response;
document.getElementById("confirmation_popup").style.display ="";
}
}
catch(e){}
finally{}
}
function handleResponse_news() {
try{
if((http.readyState == 4)&&(http.status == 200)){
var response = http.responseText;
document.getElementById("confirmation").innerHTML = response;
document.getElementById("confirmation").style.display ="";
}
}
catch(e){}
finally{}
}
function isUndefined(a) {
return typeof a == 'undefined';
}
function trim(a) {
return a.replace(/^s*(S*(s+S+)*)s*$/, "$1");
}
function isEmail(a) {
return (a.indexOf(".") > 0) && (a.indexOf("@") > 0);
}