// JavaScript Document
$(function(){
// regular customer
$('input[name="traveltype"],input[name="traveltype-new"]').click(function(){
//$('input[name="traveltype"]').parent().removeClass('selected');
$('.whoTravel').children('.requiredArea').remove();
$('.selectpeo').removeClass('selected');
$('.familyDetail').html('');
var thisval = $(this).val();
var __anum = 0;
var __cnum = 0;
if(thisval == 'Family'){
__anum = 2;
__cnum = 1;
}else if(thisval =='Group'){
__anum = 3;
}
var cstr ='';
cstr += '';
if(thisval == 'Solo') {
var cstr = '';
}
if(thisval =='Two People') {
var cstr = '';
}
$(this).parent().children('.familyDetail').html(cstr);
});
$('input[type="radio"]').click(function() {
var _name = $(this).attr('name');
$('input[name="'+_name+'"]').parent().removeClass('selected');
$(this).parent().addClass('selected')
});
// $('input:radio[name="pc-up-di"]').click(function(){
// $('#discount').children('.requiredArea').remove();
// });
// $('select[name="los"]').focus(function(){
// $('#travel-days').children('.requiredArea').remove();
// });
$('input[name="flexible"]').click(function(){
$('#travel-days').children('.requiredArea').remove();
});
$('#Starting_Date').focus(function(){
$('#date_re').children('.requiredArea').remove();
})
$('input[name="hotel"]').click(function(){
$('.hotelBlock').children('.requiredArea').remove();
});
$('input[name="realname"]').focus(function(){
$('#realname').parent().parent().children('.requiredArea').remove()
})
$('input[name="email"]').focus(function(){
$(this).parent().children('.requiredArea').remove();
})
// new customer
$('#Starting_Date_new').focus(function(){
$('#Date_new').children('.requiredArea').remove();
});
// $('#los-new').focus(function(){
// $('#travel-days-new').children('.requiredArea').remove();
// });
// $('#flexible-new').click(function(){
// $('#travel-days-new').children('.requiredArea').remove();
// });
// $('input:checkbox[name="agerange"]').click(function(){
// $('#age-range-new').children('.requiredArea').remove();
// });
// $('input[name="hotel-new"]').click(function(){
// $('#hotelBlock-new').children('.requiredArea').remove();
// });
// $('input:checkbox[name="city"],#AdditionalRequirements2').click(function(){
// $('#city-new').children('.requiredArea').remove();
// })
$('#realname-new').focus(function(){
$('#realname-new').parent().parent().children('.requiredArea').remove()
})
$('#email-new').focus(function(){
$(this).parent().children('.requiredArea').remove();
})
//Check Mobile
// if(typeof WURFL != 'undefined'){
// if(WURFL.is_mobile){
// var _str = '';
// $('form').append(_str)
// var _deviceInfo = WURFL.form_factor + ' / ' + WURFL.complete_device_name;
// $('input[name="deviceinfo"]').val(_deviceInfo)
// }
// }
//===================点击下一步操作 验证===============================
function checkForm(obj_form){
var requirei = 0;
if (obj_form.attr('id') == 'js_submitting') {
// regular customer check
// if($('input:radio[name="pc-up-di"]:checked').val()== undefined && $('input[name="deviceinfo"]').val() == undefined){
// $('
Please select one of the items
').appendTo('#discount');
// requirei ++;
// };
if($('input[name="Starting_Date"]').val()== ''){
$('Please select your approximate arrival date
').appendTo('#date_re');
requirei ++;
};
// if($('select[name="los"]').val()== '' || $('input:radio[name="flexible"]:checked').val()== undefined){
// $('Please select travel days
').appendTo('#travel-days');
// requirei ++;
// };
if($('input:radio[name="traveltype"]:checked').val()== undefined){
$('Please select your group type
').appendTo('#whoTravel-re');
requirei ++;
};
if($('input:radio[name="hotel"]:checked').val()== undefined){
$('Please select your hotel style
').appendTo('#hotelBlock-re');
requirei ++;
}
if($('#realname').val()==''){
$('#realname').parent().parent().append('Please enter your full name
');
requirei ++;
}
if($('#email').val()==''){
$('#email').parent().append('Please enter your email
');
requirei ++;
}
}
if (obj_form.attr('id') == 'js_submitting_new') {
// new customer check
if($('#Starting_Date_new').val()== ''){
$('Please select your approximate arrival date
').appendTo('#Date_new');
requirei ++;
};
// if($('#los-new').val()== '' || $('#flexible-new:checked').val()== undefined){
// $('Please select travel days
').appendTo('#travel-days-new');
// requirei ++;
// };
// if($('input:radio[name="traveltype-new"]:checked').val()== undefined){
// $('Please select your group type
').appendTo('#whoTravel-new');
// requirei ++;
// };
// if($('input:checkbox[name="agerange"]:checked').val()== undefined){
// $('Please select an age range
').appendTo('#age-range-new');
// requirei ++;
// }
// if($('input:radio[name="hotel-new"]:checked').val()== undefined){
// $('Please select your hotel style
').appendTo('#hotelBlock-new');
// requirei ++;
// }
// if($('#AdditionalRequirements2').val()== '' || $('input:checkbox[name="city"]:checked').val()== undefined){
// $('Please tell us your travel destinations, your interests, and your special requirements.
').appendTo('#city-new');
// requirei ++;
// }
if($('#realname-new').val()== ''){
$('#realname-new').parent().parent().append('Please enter your full name
');
requirei ++;
}
if($('#email-new').val()== ''){
$('#email-new').parent().append('Please enter your email
');
requirei ++;
}
}
if(requirei>0){
return false;
}
return true;
}
$("#js_submitting").click(function(){
$('.requiredArea').remove();
if(!checkForm($("#js_submitting"))){
return false;
}
});
$("#js_submitting_new").click(function(){
$('.requiredArea').remove();
if(!checkForm($("#js_submitting_new"))){
return false;
}
});
//"australia", "canada", "china", "france", "germany", "italy", "malaysia", "singapore", "united kingdom", "united states",
var nationality_map = ["afghanistan", "albania", "algeria", "american samoa", "andorra", "angola", "anguilla", "antarctica", "antigua and barbuda", "argentina", "armenia", "aruba", "australia", "austria", "azerbaijan", "bahamas", "bahrain", "bangladesh", "barbadian", "barbados", "belarus", "belgium", "belize", "benin", "bermuda", "bhutan", "bolivia", "botswana", "bouvet island", "brazil", "british indian ocean territory", "brunei darussalam", "bulgaria", "burkina faso", "burundi", "cambodia", "cameroon", "canada", "cape verde", "cayman islands", "central african republic", "chad", "chile", "china", "china HK", "christmas island", "colombia", "comoros", "congo", "cook islands", "costa rica", "croatia", "cuba", "cyprus", "czech republic", "czechoslovakia", "denmark", "djibouti", "dominica", "dominican republic", "east timor", "ecuador", "egypt", "el salvador", "equatorial guinea", "eritrea", "estonia", "ethiopia", "falkland islands", "faroe islands", "fiji", "finland", "france", "french guiana", "french polynesia", "gabon", "gambia", "georgia", "germany", "ghana", "gibraltar", "greece", "greenland", "grenada", "guadeloupe", "guam", "guatemala", "guernsey", "guinea", "guinea-bissau", "guyana", "haiti", "honduras", "hong kong", "hungary", "iceland", "india", "indonesia", "iran", "iraq", "ireland", "isle of man", "israel", "italy", "jamaica", "japan", "jersey", "jordan", "kazakhstan", "kazakhstan2", "kenya", "kiribati", "korea", "kuwait", "kyrgyzstan", "laos", "latvia", "lebanon", "lesotho", "liberia", "libyan arab jamahiriya", "liechtenstein", "lithuania", "luxembourg", "macau", "macedonia", "madagascar", "malawi", "malaysia", "maldives", "mali", "malta", "marshall islands", "martinique", "mauritania", "mauritius", "mayotte", "mexican", "micronesia", "moldova", "monaco", "mongolia", "montserrat", "morocco", "mozambique", "myanmar", "namibia", "nauru", "nepal", "netherlands", "netherlands antilles", "neutral zone", "new caledonia", "new zealand", "nicaragua", "niger", "nigeria", "niue", "norfolk island", "north korea", "northern mariana islands", "norway", "oman", "pakistan", "palau", "panama", "papua new guinea", "paraguay", "peru", "philippines", "pitcairn", "poland", "portugal", "puerto rico", "qatar", "reunion", "romania", "russian federation", "rwanda", "saint helena", "samoa", "san marino", "sao tome and principe", "saudi arabia", "scotland", "senegal", "seychelles", "sierra leone", "singapore", "slovakia", "slovenia", "solomon islands", "somalia", "south africa", "south georgia and the sandwich", "spain", "sri lanka", "sudan", "suriname", "swaziland", "sweden", "switzerland", "syrian arab republic", "taiwan", "tanzania", "thailand", "the republic of cote d'ivoire", "togo", "tokelau", "tonga", "trinidad and tobago", "tunisia", "turkey", "turkmenistan", "turks and caicos islands", "tuvalu", "uganda", "ukraine", "united arab emirates", "united kingdom", "united states", "unknown", "uruguay", "ussr", "uzbekistan", "vanuatu", "vatican city state", "venezuela", "vietnam", "virgin islands (british)", "virgin islands (u.s.)", "western sahara", "yemen", "yugoslavia", "zaire", "zambia", "zimbabwe"];
$(function() {
$('#Nationality').autocomplete({
source:nationality_map,
});
$('#family-re,#group-re,#family-new,#group-new').click(function(){
var cls = $(this).attr('class');
if ($(this).attr('id') == 'family-re' || $(this).attr('id') == 'group-re') {
if (cls.indexOf('selected')<0)
{
$(this).children('input:radio[name="traveltype"]').click();
}
} else if($(this).attr('id') == 'family-new' || $(this).attr('id') == 'group-new'){
if (cls.indexOf('selected')<0)
{
$(this).children('input:radio[name="traveltype-new"]').click();
}
}
});
});
$("#Starting_Date,#Starting_Date_new,#Date_of_departure,#Date_of_departure_from_China").datepicker({
showAnim:"fadeIn",
duration:0,
minDate: 2,
maxDate:"2y",
numberOfMonths: 2,
showButtonPanel: true
});
});
function dispTips(eid){
$("#"+eid).show();
}
function hideTips(eid){
$("#"+eid).hide();
}
function cover(){
var _BodyBox = $("body");
var _LoadingBox = $("#submitLoading");
var _Lstruc = {};
_Lstruc.top = (_BodyBox.height() / 2) - (_LoadingBox.height() / 2);
_Lstruc.left= (_BodyBox.width() / 2) - (_LoadingBox.width() / 2);
$("#submitLoading").show();
$("#submitLoading").css({"position": "absolute", "left": _Lstruc.left, "top": _Lstruc.top, "z-index": "10000"});
$("#cover").css({"position": "absolute", "left": 0, "top": 0, "z-index": "988", "width": "100%", "height": _BodyBox.height(), "opacity": "0.8", "background": "#333"});
}
function Anchor(did)
{
$(".tourlist").show();
$(".topattaction").show();
$("html,body").animate({scrollTop: $("#"+did).offset().top}, 1000);
}