| Current File : /home/mak/public_htmls/themes/mak/script/site.js |
$(document).ready(function() {
/*
Carousel initialization
$('.jcarousel').carousel( { dispItems: 1, animSpeed: 900, loop: true, paginagion: false, autoSlide: true, showNextPrevButtons: false });
*/
/*
var fly_in;
var fly_out;
function onBefore() {
$(".slideshow-item").each(function() {
$(this).removeClass('active');
$(this).find(".text-fly1").hide();
$(this).find(".text-fly2").hide();
});
$(this).addClass('active');
clearTimeout(fly_in);
clearTimeout(fly_out);
fly_in = setTimeout(function(){
$("#banner-slider .active").find(".text-fly1").show('slide', 500);
$("#banner-slider .active").find(".text-fly2").show('slide', {direction: 'right'}, 1000);
}, 1000);
fly_out = setTimeout(function(){
$("#banner-slider .active").find(".text-fly1").hide('slide', {direction: 'right'}, 500);
$("#banner-slider .active").find(".text-fly2").hide('slide', 1000);
}, 6000);
}
function onAfter() {
}
$("#banner-slider")
.before('<div id="banner-wrapper"><div id="nav"></div><div id="nav-prev"></div><div id="nav-next"></div></div>')
.cycle({
fx: "fade",
timeout: 7000,
speed: 2000,
next: '#nav-next',
prev: '#nav-prev',
pager: '#nav',
before: onBefore,
after: onAfter
});
$('#captcha').click(function() {
$(this).attr('src', $(this).attr('src')+'&'+Math.random());
});
// offset
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
$("#submit_form").click(function() {
var error = 0;
// Form field names
var fields = new Array("contact_name", "contact_email", "contact_message");
// Lang field names
var fields_name = new Array(contact_name, contact_email, contact_comment);
var html = '';
for (var aux=0; aux < fields.length; aux++)
{
var field = fields[aux];
var field_name = fields_name[aux];
var oField = document.getElementById(field);
if (!oField.value || oField.value == 0)
{
html += '· ' + form_obligatory_field1 + ' \'' + field_name + '\' ' + form_obligatory_field2 + '<br />';
error = 1;
}
}
if (!error && !ValidateEmail($("#contact_email").val())) {
html += '· ' + form_email_invalid + '<br />';
error = 1;
}
if (!error) {
$("#modal")
.html(form_contact_question + '?')
.dialog({
resizable: false,
modal: true,
title: form_validation,
buttons: {
OK: function() {
DisableButtons();
document.contact.submit();
},
Cancel: function() {
$(this).dialog("close");
}
}
});
}
else {
$("#modal")
.html(html)
.dialog({
modal: true,
title: form_validation,
resizable: false,
buttons: { }
});
}
});
*/
$("#social-info").click(function() {
$("#panel-contact").css('width', '750px');
$("#panel-contact").css('height', '395px');
$("#panel-contact p").css('font-size', '10px');
$("#panel-contact p").html("1 - A empresa Helena Mak – Marketing e Turismo Lda promove e divulga as “Selected Experiences” e outros produtos do segmento 55+, dos seus parceiros para, desta forma ajudar a potenciar e a alargar os seus negócios.<br />Para informação mais detalhada de alguma “Experiência” ou compra de qualquer “selected experiences” o cliente será canalizado para um dos seus parceiros;<br />2 - A empresa Helena Mak – Marketing e Turismo Lda é uma empresa que realiza acções de promoção e divulgação sendo a venda e a organização das “experiências” realizadas pelos seus parceiros, online ou directamente ao cliente;<br />3 – A empresa Helena Mak – Marketing e Turismo Lda não terá qualquer responsabilidade sobre a organização das “experiências” ou quaisquer outros produtos incluídos no pacote. Serão da inteira responsabilidade do parceiro que efectuar a venda;<br />4 - A empresa Helena Mak – Marketing e Turismo Lda promove e divulga os catálogos das empresas suas parceiras onde constam os seus produtos e preços;<br />5 - A empresa Helena Mak – Marketing e Turismo Lda não se responsabiliza pelas informações e preços constantes dos catálogos que não sejam da sua propriedade;<br />6 - A empresa Helena Mak – Marketing e Turismo Lda, pelo seu “know how” é especializada no segmento golfe, tendo a parceria neste segmento com a Algarve Golfe, Associação Regional de Golfe do Sul, para a realização de acções de promoção no exterior;<br />7 - A empresa Helena Mak – Marketing e Turismo Lda promove e divulga a realização dos torneios de golfe específicos da Algarve Golfe, no exterior;<br />8 - A empresa Helena Mak – Marketing e Turismo Lda promove e divulga os eventos golfe da Algarve Golfe no exterior;");
});
$("#nav-contact").click(function() {
$("#panel-contact").css('width', '290px');
$("#panel-contact").css('height', '290px');
$("#panel-contact p").css('font-size', '13px');
$("#panel-contact p").html("T. +351 289 147 147<br />info@mak.pt<br />Algarve. Portugal");
});
});
/* FORM VALIDATION */
function ValidateEmail(email) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
if(reg.test(email) == false) {
return false;
}
return true;
}
function ValidateNIF(nif) {
var c;
var checkDigit = 0;
//Verifica se é nulo, se é numérico e se tem 9 dígitos
if(nif != null && IsNumeric(nif) && nif.length == 9) {
//Obtem o primeiro número do NIF
c = nif.charAt(0);
//Verifica se o primeiro número é (1, 2, 5, 6, 8 ou 9)
if(c == '1' || c == '2' || c == '5' || c == '6' || c == '8' || c == '9') {
//Calculo do Digito de Controle
checkDigit = c * 9;
var i = 0;
for(i = 2; i <= 8; i++) {
checkDigit += nif.charAt(i-1) * (10-i);
}
checkDigit = 11 - (checkDigit % 11);
//Se o digito de controle é maior que dez, coloca-o a zero
if(checkDigit >= 10)
checkDigit = 0;
//Compara o digito de controle com o último numero do NIF
//Se igual, o NIF é válido.
if(checkDigit == nif.charAt(8))
return true;
}
}
return false;
}
function IsNumeric(sText) {
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++) {
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1) {
IsNumber = false;
}
}
return IsNumber;
}
function DisableButtons()
{
$(".ui-dialog-buttonset").hide();
$(".ui-dialog-titlebar-close").hide();
$(".ui-dialog-content").html('Please wait...');
}