$(document).ready(function(){
_chosed = 0;
_date_select = '';
_date_action = '';
_error = '';
_errorTaken = '';
_client = _client_base = {imie: '',nazwisko:'', 'email':'', 'telefon':'', 'ulica':'', 'kod':'', 'miejscowosc':'', 'fvat':'',
'firma_nazwa':'', 'firma_nip':'', 'firma_ulica':'', 'firma_kod':'', 'firma_miejscowosc':'', 'payment_type':'', 'uwagi':''};
_offer_height = parseInt($('div#menu_left').css('height').replace(/[^-\d\.]/g, '')) - parseInt($('#dotpay_banner').css('height').replace(/[^-\d\.]/g, '')) + 20;
$('div#offer').css('height', _offer_height);
loadCalendar(_currYear, _currMonth);
function loadCalendar(_thisY, _thisM)
{
if (_date_action != 'add' && _date_action != 'remove')
{
$('div#offer table#kalendarz').hide();
$('div#offer').addClass('loading');
}
_dat = '
';
$('div#date_box').html(_dat);
$('div#date_take ul li[rel], div#date_take span[rel]').unbind('click');
_cal = ''; _thisM = parseInt(_thisM); _thisY = parseInt(_thisY);
_day = new Date().getDate();
_prevM = _thisM - 1; _prevY = _thisY;
if (_prevM < 1) { _prevM = _prevM + 12; _prevY = _prevY - 1; }
_nextM = _thisM + 1; _nextY = _thisY;
if (_nextM > 12) { _nextM = _nextM - 12; _nextY = _nextY + 1; }
for (_i = 2; _i >= 1; _i--)
{
_carM = _thisM - _i; _carY = _thisY;
if (_carM < 1) { _carM = _carM + 12; _carY = _carY - 1; }
_cal += ''+ nameOfMonth(_carM) +'
'+ _carY +'
';
}
_cal += ''+ nameOfMonth(_thisM) +'
'+ _thisY +'
';
for (_i = 1; _i <= 6; _i++)
{
_carM = _thisM + _i; _carY = _thisY;
if (_carM > 12) { _carM = _carM - 12; _carY = _carY + 1; }
_cal += ''+ nameOfMonth(_carM) +'
'+ _carY +'
';
}
$('div#date_take ul').html(_cal);
$('div#date_take span#left_date').attr('rel', _prevY + '|' + _prevM);
$('div#date_take span#right_date').attr('rel', _nextY + '|' + _nextM);
$('div#date_take ul li[rel], div#date_take span[rel]').one('click', function() {
_rel = $(this).attr('rel').split('|');
_currY = _rel[0]; _currM = _rel[1];
loadCalendar(_currY, _currM);
});
$.ajax({
async: false,
cache: false,
url: 'ajax/calendar.php',
data: {
date_select: _date_select,
date_action: _date_action,
lang: _lang,
thisY: _thisY,
thisM: _thisM
},
success: processCalendarXml
});
return false;
}
function processCalendarXml(responseXML)
{
_output = $("tresc", responseXML).text();
_chosed = parseInt($("chosed", responseXML).text());
_suma = $("suma", responseXML).text();
_zaliczka = $("zaliczka", responseXML).text();
_error = $("error", responseXML).text();
_errorTaken = $("errorTaken", responseXML).text();
showSuma();
$('#offer').removeClass('loading');
$('#offer table#kalendarz').html(_output).fadeIn();
$('#offer table#kalendarz tr td').not(".disabled").hover(function()
{
_cellIndex = $(this).index();
$.each($('#offer table#kalendarz tr'), function() {
$(this).children().eq(_cellIndex).toggleClass('hovered');
});
$('div#menu_left li[rel='+$(this).parent().attr('rel')+']').toggleClass('hovered');
$(this).parent().toggleClass('hovered');
});
$('#offer table#kalendarz tr td span').not(".disabled").hover(function()
{
$.each($('#offer table#kalendarz tr td span[rez='+$(this).attr('rez')+']'), function() {
$(this).toggleClass('fullHovered');
});
});
$('#offer table#kalendarz tr td span.lf').not('.overbooked').bind('click', function() {
$(this).next('span.rt').click();
});
$('#offer table#kalendarz tr td span.lf.overbooked').bind('click', function() {
$(this).parent().prev('td').find('span.rt').click();
});
$('#offer table#kalendarz tr td span.rt').bind('click', function() {
if($(this).hasClass('overbooked'))
{
if($(this).hasClass('payed'))
{
if (_lang == 'pl') { showInformer('Ten termin jest już zarezerwowany'); }
if (_lang == 'de') { showInformer('Dieser Termin ist bereits reserviert'); }
if (_lang == 'en') { showInformer('Ten termin jest już zarezerwowany [en]'); }
}
else
{
if (_lang == 'pl') { showInformer('Ten termin jest wstępnie zarezerwowany'); }
if (_lang == 'de') { showInformer('Dieser Termin ist vorläufig reserviert'); }
if (_lang == 'en') { showInformer('Ten termin jest wstępnie zarezerwowany [en]'); }
}
}
else if ($(this).hasClass('disabled') || $(this).hasClass('ADdisabled'))
{
if($(this).hasClass('ADdisabled'))
{
if (_lang == 'pl') { showInformer('W tym terminie stanowisko jest niedostępne'); }
if (_lang == 'de') { showInformer('An diesem Termin ist der Angelplatz nicht verfügbar'); }
if (_lang == 'en') { showInformer('W tym terminie stanowisko jest niedostępne [en]'); }
}
else
{
if (_lang == 'pl') { showInformer('Nie można wybrać terminu z wsteczną lub dzisiejszą datą '); }
if (_lang == 'de') { showInformer('Sie können keinen vergangenen oder heutigen Termin wählen'); }
if (_lang == 'en') { showInformer('Nie można wybrać terminu z wsteczną lub dzisiejszą datą [en]'); }
}
}
else
{
_date_select = $(this).attr('rel');
if ($(this).hasClass('checked'))
{
_date_action = 'remove';
}
else
{
_date_action = 'add';
}
loadCalendar(_currY, _currM);
}
});
_date_select = '';
_date_action = '';
$('div#menu_left li').removeClass('hovered');
if (_errorTaken != '')
{
errorTaken();
}
stages();
return false;
}
function stages()
{
if (_stage == 1)
{
if( $('div#date_take #date_box').is(':hidden') ) { $('div#date_take #date_box').show();}
if( $('div#offer table').is(':hidden') ) { $('div#offer table').show();}
if( $('div#date_take #podsumowanie_top').is(':visible') ) { $('div#date_take #podsumowanie_top').hide();}
if( $('div#offer #podsumowanie_content').is(':visible') ) { $('div#offer #podsumowanie_content').hide();}
$('div#offer table').show();
$('#stages li').eq(0).addClass('current');
$('#stages li').eq(1).removeClass('current');
if (_chosed == 1)
{
$('#stages li').eq(1).addClass('clickable');
wstecz_disable();
rezerwuj_disable();
dalej_enable();
}
else
{
$('#stages li').eq(1).removeClass('clickable');
wstecz_disable();
rezerwuj_disable();
dalej_disable();
}
}
if (_stage == 2)
{
if( $('div#date_take #date_box').is(':visible') ) { $('div#date_take #date_box').hide();}
if( $('div#offer table').is(':visible') ) { $('div#offer table').hide();}
$('#stages li').eq(0).removeClass('current');
$('#stages li').eq(1).addClass('current');
if (_chosed == 1)
{
$('#stages li').eq(0).addClass('clickable');
dalej_disable();
rezerwuj_enable();
wstecz_enable();
}
if( $('div#date_take #podsumowanie_top').is(':hidden') )
{
_output = '';
_output += '';
if( _lang=='pl' ) { _output += 'Stanowisko i termin'; }
if( _lang=='de' ) { _output += 'Fischerei und termin'; }
if( _lang=='en' ) { _output += 'Fischery and date'; }
_output += '
';
_output += '';
if( _lang=='pl' ) { _output += 'Liczba osób łowiących'; }
if( _lang=='de' ) { _output += 'Anzahl der Angler'; }
if( _lang=='en' ) { _output += 'Number of people'; }
_output += '
';
_output += '';
if( _lang=='pl' ) { _output += 'Dane zamawiającego'; }
if( _lang=='de' ) { _output += 'Kundenangaben'; }
if( _lang=='en' ) { _output += 'Customer Information'; }
_output += '
';
$('div#date_take #podsumowanie_top').show().html(_output);
}
if( $('div#offer #podsumowanie_content').is(':hidden') )
{
podsumowanie();
}
showSuma();
}
$('#stages li').unbind('click');
$('#stages li.clickable').bind('click', function(){
_stage = parseInt($(this).attr('rel'));
stages();
});
}
function podsumowanie()
{
$.ajax({
async: false,
cache: false,
url: 'ajax/podsumowanie.php',
data: {
lang: _lang
},
success: processPodsumowanieXml
});
}
function processPodsumowanieXml(responseXML)
{
_output = $("tresc", responseXML).text();
_suma = $("suma", responseXML).text();
_zaliczka = $("zaliczka", responseXML).text();
_error = $("error", responseXML).text();
_errorTaken = $("errorTaken", responseXML).text();
showSuma();
$('div#offer #podsumowanie_content').html(_output).show();
$('div#offer #podsumowanie_content').css('height', _offer_height);
$('div#offer #podsumowanie_content .podsumowanie_box').css('width', '260px');
if (_client['imie'] != '') { $("input[name='imie']").val(_client['imie']); }
if (_client['nazwisko'] != '') { $("input[name='nazwisko']").val(_client['nazwisko']); }
if (_client['email'] != '') { $("input[name='email']").val(_client['email']); }
if (_client['telefon'] != '') { $("input[name='telefon']").val(_client['telefon']); }
if (_client['ulica'] != '') { $("input[name='ulica']").val(_client['ulica']); }
if (_client['kod'] != '') { $("input[name='kod']").val(_client['kod']); }
if (_client['miejscowosc'] != '') { $("input[name='miejscowosc']").val(_client['miejscowosc']); }
if (_client['fvat'] != '')
{
$("input[name='fvat']").attr('checked', true);
$("div.fvat").show();
}
if (_client['firma_nazwa'] != '') { $("input[name='firma_nazwa']").val(_client['firma_nazwa']); }
if (_client['firma_nip'] != '') { $("input[name='firma_nip']").val(_client['firma_nip']); }
if (_client['firma_ulica'] != '') { $("input[name='firma_ulica']").val(_client['firma_ulica']); }
if (_client['firma_kod'] != '') { $("input[name='firma_kod']").val(_client['firma_kod']); }
if (_client['firma_miejscowosc'] != '') { $("input[name='firma_miejscowosc']").val(_client['firma_miejscowosc']); }
if (_client['uwagi'] != '') { $("textarea[name='uwagi']").val(_client['uwagi']); }
$('div.personal_data input, div.personal_data textarea').keyup(function() {
_client[$(this).attr('name')] = $(this).val();
});
$('div.personal_data input, div.personal_data textarea').change(function() {
_client[$(this).attr('name')] = $(this).val();
});
if (_client['payment_type'] != '')
{
$('.payment_type li[id="'+_client['payment_type']+'"]').addClass('checked');
$('input[name="payment_type"]').val(_client['payment_type']);
}
$('.payment_type li').click(function () {
$('.payment_type li').removeClass('checked');
$(this).addClass('checked');
$('input[name="payment_type"]').val($(this).attr('id'));
_client['payment_type'] = $(this).attr('id');
});
$('.termin_right select').change(function () {
$.ajax({
type: "POST",
async: false,
cache: false,
url: 'ajax/podsumowanie.php',
data: $('#payment_data').serialize(),
success: processPodsumowanieXml
});
});
$("input[name='fvat']").change(function() {
if ($("input[name='fvat']:checked").val() == 'tak')
{
$("div.fvat").show('fast');
}
else
{
$("div.fvat").hide('fast');
}
});
if (_errorTaken != '')
{
errorTaken();
}
regulamin_bind();
stages();
}
function rezerwuj()
{
_alert_list = new Array();
if (_lang == 'pl')
{
$.each($('.termin_right .select_adults'), function () {
if ($(this).val() == 0) { _alert_list.push('proszę podać liczbę osób łowiących'); return false;}
});
if ($("input[name='payment_type']").val().length == 0) { _alert_list.push('proszę wybrać sposób płatności'); }
if ($("input[name='imie']").val().length < 2) { _alert_list.push('proszę podać imię'); }
if ($("input[name='nazwisko']").val().length < 2) { _alert_list.push('proszę podać nazwisko'); }
if (!isValidEmailAddress($("input[name='email']").val())) { _alert_list.push('proszę podać prawidłowy adres email'); }
if ($("input[name='telefon']").val().length < 2) { _alert_list.push('proszę podać telefon'); }
if ($("input[name='ulica']").val().length < 2) { _alert_list.push('proszę podać nazwę ulicy'); }
if ($("input[name='kod']").val().length < 2) { _alert_list.push('proszę podać kod pocztowy'); }
if ($("input[name='miejscowosc']").val().length < 2) { _alert_list.push('proszę podać nazwę miejscowości'); }
if ($("input[name='regulamin']:checked").length == 0) { _alert_list.push('proszę zaakceptować regulamin'); }
}
if (_lang == 'de')
{
$.each($('.termin_right .select_adults'), function () {
if ($(this).val() == 0) { _alert_list.push('geben Sie Personenanzahl'); return false;}
});
if ($("input[name='payment_type']").val().length == 0) { _alert_list.push('wählen Sie eine Zahlungsart'); }
if ($("input[name='imie']").val().length < 2) { _alert_list.push('geben Sie Ihren Vornamen ein'); }
if ($("input[name='nazwisko']").val().length < 2) { _alert_list.push('geben Sie Ihren Nachnamen ein'); }
if (!isValidEmailAddress($("input[name='email']").val())) { _alert_list.push('geben Sie Ihre E-Mail-Adresse ein'); }
if ($("input[name='telefon']").val().length < 2) { _alert_list.push('geben Sie Ihre Telefonnummer ein'); }
if ($("input[name='ulica']").val().length < 2) { _alert_list.push('geben Sie die Straße ein'); }
if ($("input[name='kod']").val().length < 2) { _alert_list.push('geben Sie die Postleitzahl ein'); }
if ($("input[name='miejscowosc']").val().length < 2) { _alert_list.push('geben Sie den Ort ein'); }
if ($("input[name='regulamin']:checked").length == 0) { _alert_list.push('bitte akzeptieren Sie die Bedingungen'); }
}
if (_lang == 'en')
{
$.each($('.termin_right .select_adults'), function () {
if ($(this).val() == 0) { _alert_list.push('proszę podać liczbę osób łowiących [en]'); return false;}
});
if ($("input[name='payment_type']").val().length == 0) { _alert_list.push('proszę wybrać sposób płatności [en]'); }
if ($("input[name='imie']").val().length < 2) { _alert_list.push('proszę podać imię [en]'); }
if ($("input[name='nazwisko']").val().length < 2) { _alert_list.push('proszę podać nazwisko [en]'); }
if (!isValidEmailAddress($("input[name='email']").val())) { _alert_list.push('proszę podać prawidłowy adres email [en]'); }
if ($("input[name='telefon']").val().length < 2) { _alert_list.push('proszę podać telefon [en]'); }
if ($("input[name='ulica']").val().length < 2) { _alert_list.push('proszę podać nazwę ulicy [en]'); }
if ($("input[name='kod']").val().length < 2) { _alert_list.push('proszę podać kod pocztowy [en]'); }
if ($("input[name='miejscowosc']").val().length < 2) { _alert_list.push('proszę podać nazwę miejscowości [en]'); }
//if ($("input[name='regulamin']:checked").length == 0) { _alert_list.push('please accept terms'); }
}
if (_alert_list.length != 0)
{
showFormAlert();
}
else
{
rezerwuj_send();
}
return false;
}
function rezerwuj_send()
{
rezerwuj_disable();
showProcesAlert();
$.ajax( {
type: "POST",
url: 'ajax/realizuj.php',
data: $('#payment_data').serialize(),
success: rezerwuj_success
} );
return false;
}
function rezerwuj_success(responseXML)
{
_error = $("error", responseXML).text();
_errorTaken = $("errorTaken", responseXML).text();
if (_error == '' && _errorTaken == '')
{
$('.popbox').hide();
_output = $("tresc", responseXML).text();
_tresc_dotpay = $("tresc_dotpay", responseXML).text();
wstecz_disable();
$('#stages li').removeClass('clickable');
$('#stages li').removeClass('current');
$('#stages li').unbind('click');
$('#suma').hide();
if (_lang == 'pl') { $('#podsumowanie_top').html('Potwierdzenie rezerwacji
'); }
if (_lang == 'de') { $('#podsumowanie_top').html('Bestätigung der Reservierung
'); }
if (_lang == 'en') { $('#podsumowanie_top').html('Potwierdzenie rezerwacji [en]
'); }
$('#podsumowanie_content').html(_output);
$("#dotpay_box").html(_tresc_dotpay);
_client = _client_base;
}
else if (_error == 'WRONG_DATA_1')
{
$('.popbox').hide();
if (_lang == 'pl') { showInformer('Podczas przetwarzania Twojej rezerwacji wystąpił błąd. Prosimy o kontakt telefoniczny.'); }
if (_lang == 'de') { showInformer('Bei der Bearbeitung Ihrer Reservierung ist ein Fehler aufgetreten. Bitte setzen Sie sich telefonisch mit uns in Verbindung.'); }
if (_lang == 'en') { showInformer('Podczas przetwarzania Twojej rezerwacji wystąpił błąd. Prosimy o kontakt telefoniczny. [en]'); }
}
else if (_error == 'WRONG_DATA_2')
{
$('.popbox').hide();
if (_lang == 'pl') { showInformer('Podczas przetwarzania Twojej rezerwacji wystąpił błąd. Prosimy o kontakt telefoniczny.'); }
if (_lang == 'de') { showInformer('Bei der Bearbeitung Ihrer Reservierung ist ein Fehler aufgetreten. Bitte setzen Sie sich telefonisch mit uns in Verbindung.'); }
if (_lang == 'en') { showInformer('Podczas przetwarzania Twojej rezerwacji wystąpił błąd. Prosimy o kontakt telefoniczny. [en]'); }
}
else if (_errorTaken != '')
{
errorTaken();
}
return false;
}
function showSuma() {
if (_suma > 0)
{
$('#suma #kwota').text(_suma); $('#suma').show();
$('#suma #zaliczka').text(_zaliczka);
}
else
{
$('#suma #kwota').text(''); $('#suma').hide();
$('#suma #zaliczka').text('');
}
};
function hideSuma() {
$('#suma #kwota').text(''); $('#suma').hide();
$('#suma #zaliczka').text('');
};
function showFormAlert()
{
$('.popbox').css('left', ((($(window).width()-400)/2)+100)+'px');
rezerwuj_disable();
$.each( _alert_list, function( key, _alert ) {
$('#alert_list ul').append(''+ _alert +'');
});
$('#alert_list').show();
$('#alert_confirm').one('click', function(){
$('#alert_list').hide();
$('#alert_list ul').html('');
if(_stage==2) { rezerwuj_enable(); }
});
_alert_list = null;
return false;
}
function showProcesAlert()
{
$('.popbox').css('left', ((($(window).width()-400)/2)+100)+'px');
$('#proces').show();
wstecz_disable();
rezerwuj_disable();
return false;
}
function hideProcesAlert()
{
$('#proces').hide();
return false;
}
function dalej_enable()
{
if( $('#dalej').is(':hidden') ) { $('#dalej').show(); }
$('#dalej').unbind('click');
$('#dalej').bind('click', function(){
_stage = _stage + 1;
stages();
});
}
function dalej_disable()
{
if( $('#dalej').is(':visible') ) { $('#dalej').hide(); }
$('#dalej').unbind('click');
}
function wstecz_enable()
{
if( $('#wstecz').is(':hidden') ) { $('#wstecz').show(); }
$('#wstecz').unbind('click');
$('#wstecz').bind('click', function(){
loadCalendar(_currY, _currM);
_stage = _stage - 1;
stages();
});
}
function wstecz_disable()
{
if( $('#wstecz').is(':visible') ) { $('#wstecz').hide(); }
$('#wstecz').unbind('click');
}
function rezerwuj_enable()
{
if( $('#rezerwuj').is(':hidden') ) { $('#rezerwuj').show(); }
$('#rezerwuj').unbind('click');
$('#rezerwuj').bind('click', function(){
rezerwuj();
});
}
function rezerwuj_disable()
{
if( $('#rezerwuj').is(':visible') ) { $('#rezerwuj').hide(); }
$('#rezerwuj').unbind('click');
}
function showInformer(_text)
{
$('.popbox').css('left', ((($(window).width()-400)/2)+100)+'px');
$('#informer div').html(''+_text+'
');
$('#informer_confirm').one('click', function(){
hideInformer();
});
$('#informer').show();
return false;
}
function hideInformer()
{
$('#informer div').html('');
$('#informer').hide();
return false;
}
$('#menu_left .st_opis').bind('click', function(){
_place = $(this).parent().attr('rel');
$.ajax({
async: false,
cache: false,
url: 'ajax/placeshow.php',
data: {
place: _place,
lang: _lang
},
success: processshowPlaceDescXml
});
});
function processshowPlaceDescXml(responseXML)
{
$('.popbox').css('left', ((($(window).width()-800)/2)+200)+'px');
_tytul = $("tytul", responseXML).text();
_cennik = $("cennik", responseXML).text();
_tresc = $("tresc", responseXML).text();
_output = ''+_tytul+'
';
_output += ''+_cennik+'
';
_output += ''+_tresc+'
';
_zdjec = $("photo", responseXML).length;
if (_zdjec > 0)
{
_output += '';
$("photo", responseXML).each(function(){
_output += ' ';
});
_output += '
';
}
$('#placeDesc div').html(_output);
$('#placeDesc_confirm').one('click', function(){
hidePlaceDesc();
});
$('#placeDesc').show();
$('.ad-gallery').adGallery();
return false;
}
function hidePlaceDesc()
{
$('#placeDesc').hide();
return false;
}
function regulamin_bind()
{
$('.regulamin').bind('click', function(){
_page = 'regulamin_carp';
$.ajax({
async: false,
cache: false,
url: 'ajax/pageshow.php',
data: {
page: _page,
lang: _lang
},
success: processshowRegulaminXml
});
});
function processshowRegulaminXml(responseXML)
{
$('.popbox').css('left', ((($(window).width()-800)/2)+200)+'px');
_tytul = $("tytul", responseXML).text();
_tresc = $("tresc", responseXML).text();
_output = ''+_tytul+'
';
_output += ''+_tresc+'
';
$('#placeDesc div').html(_output);
$('#placeDesc_confirm').one('click', function(){
hidePlaceDesc();
});
$('#placeDesc').show();
return false;
}
function hidePlaceDesc()
{
$('#placeDesc').hide();
return false;
}
}
function errorTaken()
{
$('.popbox').hide();
showInformer(_errorTaken);
_stage = 1;
_errorTaken = '';
loadCalendar(_currY, _currM);
if (_chosed == 0)
{
_suma = _zaliczka = 0;
wstecz_disable();
dalej_disable();
rezerwuj_disable();
showSuma();
}
return false;
}
function nameOfMonth(_dow)
{
if (_lang == 'pl') { var _months=["0","Styczeń","Luty","Marzec","Kwiecień","Maj","Czerwiec","Lipiec","Sierpień","Wrzesień","Październik","Listopad","Grudzień"]; }
if (_lang == 'de') { var _months=["0","Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]; }
if (_lang == 'en') { var _months=["0","January","February","March","April","May","June","July","August","September","October","November","December"]; }
return _months[_dow];
}
function dayAfterDate(dateString)
{
var actualDate = new Date(dateString); // convert to actual date
var newDate = new Date(actualDate.getFullYear(), actualDate.getMonth(), actualDate.getDate()+1); // create new increased date
return (newDate);
}
function dayBeforeDate(dateString)
{
var actualDate = new Date(dateString); // convert to actual date
var newDate = new Date(actualDate.getFullYear(), actualDate.getMonth(), actualDate.getDate()-1); // create new increased date
return (newDate);
}
function tooltips ()
{
$(".tip_trigger").hover(function(){
tip = $(this).find('.tip');
tip.show(); //Show tooltip
}, function() {
tip.hide(); //Hide tooltip
}).mousemove(function(e) {
var mousex = e.pageX + 20; //Get X coodrinates
var mousey = e.pageY + 20; //Get Y coordinates
var tipWidth = tip.width(); //Find width of tooltip
var tipHeight = tip.height(); //Find height of tooltip
//Distance of element from the right edge of viewport
var tipVisX = $(window).width() - (mousex + tipWidth);
//Distance of element from the bottom of viewport
var tipVisY = $(window).height() - (mousey + tipHeight);
if ( tipVisX < 20 ) { //If tooltip exceeds the X coordinate of viewport
mousex = e.pageX - tipWidth - 20;
} if ( tipVisY < 20 ) { //If tooltip exceeds the Y coordinate of viewport
mousey = e.pageY - tipHeight - 20;
}
//Absolute position the tooltip according to mouse position
tip.css({ top: mousey, left: mousex });
});
}
function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
}
});