function setOptions(dirID){ var selbox = document.SuggestForm.DirectoryList; selbox.options.length = 0; // Enable Optional if(dirID=="0"){ SetEnableOptional(true); }else{ SetEnableOptional(false); } //---------------- if(dirID==""){ selbox.options[selbox.options.length] = new Option('Select one of the directory above first',''); //document.SuggestForm.btnPopUpsBox.disabled = true; //document.SuggestForm.btnPopUpsBox.value = 'Select Directory'; }else{ //document.SuggestForm.btnPopUpsBox.disabled = false; //document.SuggestForm.btnPopUpsBox.value = 'Load Exist data'; // Load 2nd Dropdown switch(dirID){ //hotel case "0": selbox.options[selbox.options.length] = new Option('Hotel','Hotel'); selbox.options[selbox.options.length] = new Option('Guest houses','Guest houses'); selbox.options[selbox.options.length] = new Option('Resorts','Resorts'); selbox.options[selbox.options.length] = new Option('Hostels','Hostels'); //directory break; case "39": selbox.options[selbox.options.length] = new Option('Galleries','18'); break; case "40": selbox.options[selbox.options.length] = new Option('American','20'); selbox.options[selbox.options.length] = new Option('Australian','21'); selbox.options[selbox.options.length] = new Option('British','158'); selbox.options[selbox.options.length] = new Option('Chinese','22'); selbox.options[selbox.options.length] = new Option('Coffee Shops','39'); selbox.options[selbox.options.length] = new Option('Danish','23'); selbox.options[selbox.options.length] = new Option('Dutch','167'); selbox.options[selbox.options.length] = new Option('French','24'); selbox.options[selbox.options.length] = new Option('German','25'); selbox.options[selbox.options.length] = new Option('Indian','27'); selbox.options[selbox.options.length] = new Option('International','28'); selbox.options[selbox.options.length] = new Option('Irish','29'); selbox.options[selbox.options.length] = new Option('Italian','30'); selbox.options[selbox.options.length] = new Option('Japanese','32'); selbox.options[selbox.options.length] = new Option('Korean','33'); selbox.options[selbox.options.length] = new Option('Lebanese','34'); selbox.options[selbox.options.length] = new Option('Mediterranean','35'); selbox.options[selbox.options.length] = new Option('Mexican','36'); selbox.options[selbox.options.length] = new Option('Other','161'); selbox.options[selbox.options.length] = new Option('Polynesian','37'); selbox.options[selbox.options.length] = new Option('Scandanavian Cuisine','194'); selbox.options[selbox.options.length] = new Option('Seafood','38'); selbox.options[selbox.options.length] = new Option('Spanish','40'); selbox.options[selbox.options.length] = new Option('Steaks / Grills & Roasts','41'); selbox.options[selbox.options.length] = new Option('Swiss','42'); selbox.options[selbox.options.length] = new Option('Thai','43'); selbox.options[selbox.options.length] = new Option('Vegetarian','44'); selbox.options[selbox.options.length] = new Option('Vietnamese','45'); break; case "41": selbox.options[selbox.options.length] = new Option('Internet Cafés','51'); selbox.options[selbox.options.length] = new Option('Internet Providers','49'); break; case "42": selbox.options[selbox.options.length] = new Option('Gold Class Movie Theatres','59'); selbox.options[selbox.options.length] = new Option('Karaoke','54'); selbox.options[selbox.options.length] = new Option('Movie Theatres','58'); selbox.options[selbox.options.length] = new Option('Playhouses','57'); selbox.options[selbox.options.length] = new Option('Shows','56'); break; case "43": selbox.options[selbox.options.length] = new Option('Spas','63'); break; case "44": selbox.options[selbox.options.length] = new Option('Discos and Night Clubs','65'); selbox.options[selbox.options.length] = new Option('Karaoke','66'); selbox.options[selbox.options.length] = new Option('Massage Parlours and Saunas','67'); break; case "45": selbox.options[selbox.options.length] = new Option('Camp Sites','79'); selbox.options[selbox.options.length] = new Option('Diving and Snorkeling','70'); selbox.options[selbox.options.length] = new Option('Golf Courses','85'); break; case "46": selbox.options[selbox.options.length] = new Option('Airports','164'); selbox.options[selbox.options.length] = new Option('Bus Stations','91'); selbox.options[selbox.options.length] = new Option('Car and truck rental centers','87'); selbox.options[selbox.options.length] = new Option('Cruises','94'); selbox.options[selbox.options.length] = new Option('Low-cost and Independent Airlines','165'); selbox.options[selbox.options.length] = new Option('National airlines and other carrier...','166'); selbox.options[selbox.options.length] = new Option('Taxis','93'); selbox.options[selbox.options.length] = new Option('Trains','92'); selbox.options[selbox.options.length] = new Option('Van','88'); break; case "47": selbox.options[selbox.options.length] = new Option('Antiques','150'); selbox.options[selbox.options.length] = new Option('Department Stores & Malls','102'); selbox.options[selbox.options.length] = new Option('Discount Stores','104'); selbox.options[selbox.options.length] = new Option('Duty Free Shops','105'); selbox.options[selbox.options.length] = new Option('Handicrafts','149'); selbox.options[selbox.options.length] = new Option('Jewelry','106'); selbox.options[selbox.options.length] = new Option('Super Markets','103'); selbox.options[selbox.options.length] = new Option('Thai Silk','107'); break; case "48": selbox.options[selbox.options.length] = new Option('Banks','153'); break; case "49": selbox.options[selbox.options.length] = new Option('English Language Bookstores','148'); break; case "51": selbox.options[selbox.options.length] = new Option('Cosmetic Dentistry','181'); selbox.options[selbox.options.length] = new Option('Cosmetic Surgery','117'); selbox.options[selbox.options.length] = new Option('Hospitals and Clinics','154'); selbox.options[selbox.options.length] = new Option('Laser Sight Correction','180'); break; case "52": selbox.options[selbox.options.length] = new Option('Embassies and Consulates','125'); selbox.options[selbox.options.length] = new Option('Emergency numbers','126'); selbox.options[selbox.options.length] = new Option('Police Stations','123'); selbox.options[selbox.options.length] = new Option('TAT Offices in Thailand','121'); break; case "53": selbox.options[selbox.options.length] = new Option('Mobile Phone Providers','127'); break; case "54": selbox.options[selbox.options.length] = new Option('English language newspapers and mag...','130'); break; case "69": selbox.options[selbox.options.length] = new Option('Travel Agents','184'); break; case "70": selbox.options[selbox.options.length] = new Option('Handmade Suits, Shirts, Dresses and...','189'); break; case "73": selbox.options[selbox.options.length] = new Option('Training Courses for Visitors','190'); break; case "74": selbox.options[selbox.options.length] = new Option('Tour','192'); break; case "75": selbox.options[selbox.options.length] = new Option('English Language Courses','201'); selbox.options[selbox.options.length] = new Option('English Teacher Training Courses','197'); selbox.options[selbox.options.length] = new Option('International Schools','205'); selbox.options[selbox.options.length] = new Option('Thai Cookery Courses','198'); selbox.options[selbox.options.length] = new Option('Thai Language Courses','199'); selbox.options[selbox.options.length] = new Option('Traditional Thai Massage and Thai M...','200'); selbox.options[selbox.options.length] = new Option('University Courses','196'); break; case "76": selbox.options[selbox.options.length] = new Option('Modern and Traditional Tattooists','204'); selbox.options[selbox.options.length] = new Option('Traditional Thai Tattooists','203'); break; default:selbox.options[selbox.options.length] = new Option('Please select one of the directory above first',''); }// End Swtch }// End If }// End Function function SendMail(){ var pass = true; var tempValue; msg = '---Please specify---'; if (document.SuggestForm.Name.value == '') { pass = false; msg+= '\nFirst Name'; } if (document.SuggestForm.LastName.value == '') { pass = false; msg+= '\nLast Name'; } if (document.SuggestForm.Business_Name.value == '') { pass = false; msg+= '\nBusiness name'; } if (document.SuggestForm.Directory.value == '') { pass = false; msg+= '\nDirecotory'; } if (document.SuggestForm.DirectoryList.value == '') { pass = false; msg+= '\nDirecotory Group'; } if (document.SuggestForm.Address1.value == '') { pass = false; msg+= '\nAddress Line1'; } if (document.SuggestForm.District.value == '') { pass = false; msg+= '\nDistrict'; } if (document.SuggestForm.SubDistrict.value == '') { pass = false; msg+= '\nSubDistrict'; } if (document.SuggestForm.Province.value == '') { pass = false; msg+= '\nProvince'; } if (!document.SuggestForm.Zone.disabled){ if(document.SuggestForm.Zone.value==0&&document.SuggestForm.Zone.value!='') { pass = false; msg+= '\nZone'; } } if (document.SuggestForm.ZipCode.value == '') { pass = false; msg+= '\nPostCode'; }else{ if(document.SuggestForm.ZipCode.value.length>5){ pass = false; msg+= '\nValid PostCode'; } } if (document.SuggestForm.Phone.value == '') { pass = false; msg+= '\nPhone'; } if (document.SuggestForm.eMail.value == '') { pass = false; msg+= '\nEmail'; } msg += '\n---Error Message---'; if (document.SuggestForm.Info.value == '') { pass = false; msg+= '\nCompany/Service Description'; } if(document.SuggestForm.Password.value == ''){ pass=false; msg+="\nPassword"; }else{ if(document.SuggestForm.Password.value != document.SuggestForm.RePassword.value){ pass=false; msg+="\nComfirm password not match"; } } if (document.SuggestForm.eMail.value != '') { if(!chkEmail(document.SuggestForm.eMail.value)){ pass=false; msg+="\nInvalid Email address"; } } if(isNaN(document.SuggestForm.StartPrice.value)){ pass=false; msg+="\nStart price should be numeric"; } if(isNaN(document.SuggestForm.EndPrice.value)){ pass=false; msg+="\nEnd price should be numeric"; } if(isNaN(document.SuggestForm.RoomNumber.value)){ pass=false; msg+="\nRoom number should be numeric"; } if (document.SuggestForm.strCAPTCHA.value == '') { pass = false; msg+= '\nPlease enter the text from the image'; } if (pass == true) { if(isNaN(document.SuggestForm.StartPrice.value)==false && isNaN(document.SuggestForm.EndPrice.value)==false){ if(parseInt(document.SuggestForm.StartPrice.value)>parseInt(document.SuggestForm.EndPrice.value)){ if(confirm("Your start price is more expensive than highest price.\nShould i switch them for you?")){ tempValue = document.SuggestForm.EndPrice.value; document.SuggestForm.EndPrice.value = document.SuggestForm.StartPrice.value; document.SuggestForm.StartPrice.value = tempValue; } } } document.SuggestForm.method = "post"; document.SuggestForm.target = "_self"; document.SuggestForm.action = "new_directory_submit_details2.asp"; document.SuggestForm.submit(); } else { alert (msg); } } function chkEmail(sEmail){ var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid if (!reg1.test(sEmail) && reg2.test(sEmail)) { // if syntax is valid return true; } else{ return false; } } // chkEmail function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas) /********************************************************************** IN: NUM - the number to format decimalNum - the number of decimal places to format the number to bolLeadingZero - true / false - display a leading zero for numbers between -1 and 1 bolParens - true / false - use parenthesis around negative numbers bolCommas - put commas as number separators. RETVAL: The formatted number! **********************************************************************/ { if (isNaN(parseInt(num))) return "NaN"; var tmpNum = num; var iSign = num < 0 ? -1 : 1; // Get sign of number // Adjust number so only the specified number of numbers after // the decimal point are shown. tmpNum *= Math.pow(10,decimalNum); tmpNum = Math.round(Math.abs(tmpNum)) tmpNum /= Math.pow(10,decimalNum); tmpNum *= iSign; // Readjust for sign // Create a string object to do our formatting on var tmpNumStr = new String(tmpNum); // See if we need to strip out the leading zero or not. if (!bolLeadingZero && num < 1 && num > -1 && num != 0) if (num > 0) tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length); else tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length); // See if we need to put in the commas if (bolCommas && (num >= 1000 || num <= -1000)) { var iStart = tmpNumStr.indexOf("."); if (iStart < 0) iStart = tmpNumStr.length; iStart -= 3; while (iStart >= 1) { tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length) iStart -= 3; } } // See if we need to use parenthesis if (bolParens && num < 0) tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")"; return tmpNumStr; // Return our formatted string! } function PopUpsBox(dirID,groupID){ if(dirID=="0"){ window.open("./Popups/Accommodation.asp?type="+groupID); }else{ window.open("./Popups/Directory.asp?id="+dirID+"&gid="+groupID); } } function SetEnableOptional(bEnable){ try{ if(!bEnable){ document.getElementById('hotelOptionalArea1').style.display='none'; document.getElementById('hotelOptionalArea2').style.display='none'; }else{ document.getElementById('hotelOptionalArea1').style.display='block'; document.getElementById('hotelOptionalArea2').style.display='block'; } //document.SuggestForm.StartPrice.disabled=!bEnable; //document.SuggestForm.EndPrice.disabled=!bEnable; //document.SuggestForm.RoomNumber.disabled=!bEnable; }catch(e){} }