// JavaScript Document
commentsString = "<ul><li>All the comments are the solo opinion of the travelers and do not represent the viewpoints of TravelChinaGuide.com.</li></ul><table style=\"width:86%;margin:20px auto 0;\"><form name=\"form2\" method=\"post\" action=\"/hotel/commentsave.asp\" onSubmit=\"return (check(this));\">";
commentsString = commentsString + "<tr><td>Full Name </td>";
commentsString = commentsString + "<td><select name=\"Gender\"><option value=\"Mr.\">Mr.</option><option value=\"Mrs.\">Mrs.</option><option value=\"Miss\">Miss</option><option value=\"Ms.\">Ms.</option></select>"

commentsString = commentsString + "<input type=\"text\" style=\"width:100px;\" name=\"GName\" /></td></tr><input type=\"hidden\" name=\"HID\" value=\"" + hid + "\" /><input type=\"hidden\" name=\"HName\" value=\"" + hname + "\" /><input type=\"hidden\" name=\"HCity\" value=\"" + hcity + "\" />";
commentsString = commentsString + "<tr><td>Nationality</td>";
commentsString = commentsString + "<td><input type=\"text\" name=\"GNation\"></td></tr>";
commentsString = commentsString + "<tr><td>Email<span style=\"color:#f00;\">**</span> </td>";
commentsString = commentsString + "<td><input type=\"text\" name=\"email\"></td></tr>";
commentsString = commentsString + "<tr><td colspan=\"2\">Content <span style=\"color:#f00;\">**</span> (Text length should be between 50-2,000 characters) </td></tr>";
commentsString = commentsString + "<tr><td colspan=\"2\"><textarea style=\"width:95%;height:120px;margin:10px 0 3px;\" name=\"CContent\" ></textarea></td></tr>";
commentsString = commentsString + "<tr><td colspan=\"2\">Identifying code: <input name=\"checkCode\" type=\"text\" style=\"width:80px;\"/> <img src=\"/hotel/inc/code.asp?r=" + new Date() + "\" style=\"vertical-align:middle;margin-right:5px;\" id=\"picCode\" /> <a href=\"javascript:next();\">Try another code</a></td></tr>";
commentsString = commentsString + "<tr><td colspan=\"2\" style=\"text-align:center;padding-top:12px;\"><input type=\"image\" src=\"/hotel/images/icon/hotelmo-button-submit.gif\" />&nbsp;&nbsp;<input type=\"image\" src=\"/hotel/images/icon/hotelmo-button-reset.gif\" /></td></tr></form></table>";
document.write(commentsString);


String.prototype.trim = function(){return this.replace(/(^\s+)|\s+$/g,"");};
 function check(form){
  if (form.CContent.value.trim().length==0){
	   alert("Sorry, the content should not be empty.");
	   form.CContent.focus();
	   return false;
  }
  if (form.email.value.trim().length==0){
	   alert("Sorry, the email should not be empty.");
	   form.email.focus();
	   return false;
  }
  
  if (form.checkCode.value.trim().length == 0){
	   alert("Sorry the identifying code can not be empty.");
	   form.checkCode.focus();
	   return false;
  } 
  return true;
 }
 function next(){
    var d  = new Date();

   document.getElementById("picCode").src = "/hotel/inc/code.asp?r=" + d;
 }
