﻿﻿$(document).ready(function(){$('.date-pick').datePicker();$('.date-pick').bind("focus",function(e){$(this).dpDisplay();});$(".slideshow").jSimpleGallery({btnNext:".handler_next",btnPrev:".handler_prev",auto:5000});});function shownextbanner(){$("#slideshow ");}
function addCompateTour(id){$("#selectedtours").show();$.get("ws_comparetours.aspx?cmd=add&id="+id,showCompareTour);}
function removeCompateTour(id){$.get("ws_comparetours.aspx?cmd=del&id="+id,showCompareTour);}
function showCompareTour(data){var html="";var items=$("comparetous SelectedTours item",data);var cnt=items.length;if(cnt==0)$("#selectedtours").hide();$("#selectedtourcount").html(cnt);items.each(function(){var it=$(this);html+='<li class="triplist">'+'<span class="del_list">'+'<a href="javascript: removeCompateTour('+it.attr("Period_ID")+')">[x] Remove</a>'+'</span>'+'<a href="duration.aspx?did='+it.attr("Duration_ID")+'">'+''+it.attr("Title")+'&#xA0;'+it.attr("Duration")+' days</a>'+'</li>';});$("#triplistcontainer").html(html);var ifAdded=$("comparetous TripExists",data);if(ifAdded.length>0){alert("Trip is already in basket!");}}
function validateSubscriptionForm(){var msg=""
var res=true;if($("#sb_name").val()==''){msg+="User name can not be empty\n";res=false;}
if($("#sb_email").val()==''){msg+="E-mail can not be empty\n";res=false;}else{if(!isEmailValid_BH($("#sb_email").val())){msg+="E-mail format is not valid!\n";res=false;}}
if($("#sb_email2").val()!=$("#sb_email").val()){msg+="e-mail is not the same\n";res=false;}
if(msg!="")alert(msg);return res;}
function isEmailValid_BH(email){var reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;return reg.test(email);}
