You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
6.8 KiB
JavaScript

if( typeof(questiontype) == "undefined") {
questiontype = ""
}
document.writeln("<script type='text/javascript' src='http://data.chinahighlights.com/js/in-field-labels/jquery.infieldlabel.min.js'>\<\/script>");
document.writeln("<script type='text/javascript' src='http://data.chinahighlights.com/js/validation/jquery.validate.min.js'>\<\/script>");
document.writeln("<script language=\"javascript\" src=\"/js/newcalendar.js\"></script>");
$(function() {
var html = "";
html ="<form action=\"/forms/reserve-tour-simple-save.asp\" id=\"formquestion\" method=\"post\" novalidate=\"novalidate\">";
html +="<div id=\"questionBox\" class=\"hiddenBg\"> ";
html +="<div class=\"priceTop\">";
html +="<div class=\"tourPrice\">from <span class=\"largeFont\">$99</span> USD P/P</div>";
html +="<div class=\"priceDes\">Daily Departure</div>";
html +="</div>";
html +=" <div class=\"questionContent addPadding\">";
html +=" <div class=\"infoRequired\">";
html +=" <p>";
html +=" <label for=\"realname\">Full Name: </label>";
html +=" <input name=\"realname\" type=\"text\" id=\"realname\" value=\"\" />";
html +=" </p>";
html +=" <p>";
html +=" <label for=\"yemail\">Email: </label>";
html +=" <input name=\"yemail\" type=\"text\" id=\"yemail\" value=\"\" />";
html +=" </p>";
html +=" <p>";
html +=" <label for=\"Starting_Date\">Approx. tour start </label>";
html +=" <input type=\"text\" autocomplete=\"off\" value=\"\" id=\"Starting_Date\" name=\"Starting_Date\" class=\"\">";
html +=" </p>";
html +=" <p class=\"paxInfo\">";
html +=" <select name=\"padult\" id=\"padult\" style=\"width:50%\">";
html +=" <option value=\"0\" selected=\"selected\">Adults</option>";
html +=" <option value=\"1\">1</option>";
html +=" <option value=\"2\">2</option>";
html +=" <option value=\"3\">3</option>";
html +=" <option value=\"4\">4</option>";
html +=" <option value=\"5\">5</option>";
html +=" <option value=\"6\">6</option>";
html +=" <option value=\"7\">7</option>";
html +=" <option value=\"8\">8</option>";
html +=" <option value=\"9\">9</option>";
html +=" <option value=\"10\">10</option>";
html +=" </select>";
html +=" <select name=\"pinfant\" id=\"pinfant\" style=\"width:48%\">";
html +=" <option value=\"0\" selected=\"selected\">Children</option>";
html +=" <option value=\"1\">1</option>";
html +=" <option value=\"2\">2</option>";
html +=" <option value=\"3\">3</option>";
html +=" <option value=\"4\">4</option>";
html +=" </select>";
html +=" <div class=\"totalCost\" id=\"totalCost\">Total Price: <strong></strong></div>"
html +=" </p>";
html +=" <p class=\"des\">";
html +=" <label for=\"Aquestion\">Tell us your hotel information & contact number...<br />";
html +=" </label>";
html +=" <textarea name=\"Aquestion\" id=\"Aquestion\"></textarea>";
if ( questiontype == 'contactus' ) {
html +=" <input type=\"hidden\" name=\"questiontype\" value=\"contactus\" />";
}
html +=" <input type=\"hidden\" name=\"Q_URL\" id=\"Q_URL\" />";
html +=" </p>";
html +=" </div><input type=\"hidden\" name=\"pp_price\" id=\"pp_price\"><input type=\"hidden\" name=\"pp_pricea\" id=\"pp_pricea\" value=\"0\"><input type=\"hidden\" name=\"pp_pricei\" id=\"pp_pricei\" value=\"0\">";
html +=" <input type=\"submit\" value=\"Send Your Request\" class=\"sendButton\">";
html +="</div>";
html +="</div>";
html +="</form>";
$("#question-tour-pay").html(html);
$("#formquestion").stick_in_parent({parent: "#mcontent"});
$("#questionBox .infoRequired p").show();
$("#questionBox .infoRequired label").inFieldLabels();
$("#Starting_Date").datepicker({
showAnim:"fadeIn",
duration:0,
minDate: 2,
maxDate:"2y",
numberOfMonths: 2,
showButtonPanel: true
});
$(document).on("click",".error", function() {
$(this).parent("p").find(".arrowDownTest").remove();
});
$("#formquestion").validate({
rules: {
realname:{
required: true,
minlength: 1
},
yemail:{
required: true,
email: true
},
Starting_Date: {
required: true,
date: true
},
padult: {
required: true
}
},
messages: {
realname: "Enter your name",
yemail: "Enter your email address.",
Starting_Date : "Select the starting date",
padult: "Select the adults and infants number"
},
errorLabelContainer: "#questionBox .infoRequired p .arrowDownTest",
errorPlacement: function(error, element) {
var error_tip = "<div class=\"arrowDownTest\"><div class=\"arrowDown\"><img src=\"/css/images/whiteArrow.png\"></div></div>";
element.parent().append(error_tip);
error.appendTo(element.parent().find(".arrowDownTest"));
},
focusInvalid: true,
submitHandler: function(form){
$("#pp_price").val(parseInt($("#pp_pricea").val()) + parseInt($("#pp_pricei").val()));
//form.find(".arrowDownTest").show();
form.submit();
}
//debug: true
});
var adult_price = 0;
$("#padult").change(function () {
var adult_num = $(this).find("option:selected").val() || 0;
adult_price = $(".redprice.pp-adult strong").text().replace("USD", "").replace("$", "").replace("US", "");
adult_price = adult_price * adult_num;
$("#pp_pricea").val(adult_price);
chgprice();
});
var infant_price = 0;
$("#pinfant").change(function () {
var infant_num = $(this).find("option:selected").val() || 0;
infant_price = $(".redprice.pp-infant strong").text().replace("USD", "").replace("$", "").replace("US", "");
infant_price = infant_price * infant_num;
$("#pp_pricei").val(infant_price);
chgprice();
});
$("#Q_URL").val(location.href);
//pay 判断
var ispay = $('#payform').val();
if(typeof ispay != 'undefined'){
//$('#formquestion').append('<input name="ispay" type="hidden" value="pay">');
var acturl = $('#formquestion').attr('action') + '?type=pay';
$('#formquestion').attr('action', acturl);
}else{
$('#formquestion .sendButton').val('Send');
}
//
var cli_no = $('#cli_no').val();
if(typeof cli_no != 'undefined'){
$("#padult").children('option').eq(0).text('Adults');
$('#pinfant').children('option').eq(0).text('Children');
$('#formquestion').append('<input name="clino" type="hidden" value="'+ cli_no +'">');
}
var cli_source = $('#cli_source').val();
if(typeof cli_source != 'undefined'){
$('#formquestion').append('<input name="clisource" type="hidden" value="'+ cli_source +'">');
}
//---------------------------------------------------------------------------------------------------------------------------------------
});
function chgprice(){
$('#totalCost').show();
var totalprice = parseInt($("#pp_pricei").val()) + parseInt($("#pp_pricea").val());
//var ispay = $('#payform').val();
if(totalprice>0){
var str_cost = 'USD $ ' + totalprice.toString();
$('#totalCost strong').text(str_cost);
}
}