/**************************************************************/
function LTrim(str){
    if (str==null){return null;}
    for(var i=0;str.charAt(i)==" ";i++);
    return str.substring(i,str.length);
}
function RTrim(str){
    if (str==null){return null;}
    for(var i=str.length-1;str.charAt(i)==" ";i--);
    return str.substring(0,i+1);
}
function Trim(str){
    return LTrim(RTrim(str));
}

function addToFavorite(url,title){ // Function ·ÕèàÃÕÂ¡àÁ×èÍ¤ÅÔ¡ Mouse
	if(document.all)
	window.external.AddFavorite(url,title); // ¤ÓÊÑè§ÊÓËÃÑº Add Bookmark
}

/*********************************************************/
// generateListBox(value)
/*********************************************************/
function generateListBox(value){
	if(value == "dateList"){
		var oDate = new Date();
		document.getElementById('monthList').selectedIndex = oDate.getMonth();
		month_change('monthList', 'dateList');
		document.getElementById('dateList').selectedIndex = oDate.getDate()-1;

		//alert(document.getElementById('dateList').selectedIndex + " , " + oDate.getDate());
		
	} else if (value == "timeList")
	{
		genNumberValue('hourList' , 0, 23);
		genNumberValue('minList' , 0, 59);
	}

}
/***********************************************************/
function genNumberValue(target, start, end) {
	var oTarget = document.getElementById(target);

	if (!(oTarget == null))
	{
		for (start = 0; start <= end; ++start )
		{
			var elOptNew = document.createElement('option');
			elOptNew.text = (start<10)? '0' + start : start;
			elOptNew.value = (start<10)? '0' + start : start;

			try {
				oTarget.add(elOptNew, null); // standards compliant; doesn't work in IE
			}
			catch(ex) {
				oTarget.add(elOptNew); // IE only
			}
		}
	}
}

function getDayOfMonth(month) {
	if ((month == 1)||(month == 3)||(month == 5)||(month == 7)||(month == 8)||(month == 10)||(month == 12))
	{
		return 31;
	} else if (month == 2)
	{
		return 29;
	} else
	{
		return 30;
	}
}

function month_change(source, target) {
	var oSource = document.getElementById(source);
	var oTarget = document.getElementById(target);
	
	var targetIndex = oTarget.selectedIndex;

	if ((oSource != null) && (oTarget != null))
	{
		var day = getDayOfMonth(oSource.value);
		oTarget.options.length = 0;

		for (iDay = 1; iDay <= day; ++iDay )
		{
			var elOptNew = document.createElement('option');
			if(iDay >= 1 && iDay <= 9){
				iDay = ""+"0"+iDay;
			}
			elOptNew.text = iDay;
			elOptNew.value = iDay;

			try {
				oTarget.add(elOptNew, null); // standards compliant; doesn't work in IE
			}
			catch(ex) {
				oTarget.add(elOptNew); // IE only
			}
		}

		if(targetIndex < oTarget.options.length){
			oTarget.selectedIndex = targetIndex;
		}
	}	
}


/*********************************************************/
// validate_form(thisform)
/*********************************************************/
function validate_form(thisform)
{

	if(thisform.ctype.value == "order"){
		
		if (validate_required(thisform.name,"กรุณากรอก ชื่อ นามสกุล ด้วยค่ะ!")==false)
		  {thisform.name.focus(); thisform.name.select(); return false;}

		if (validate_required(thisform.telephone,"กรุณากรอก เบอร์โทรศัพท์ ด้วยค่ะ!")==false)
		  {thisform.telephone.focus(); thisform.telephone.select(); return false;}
		
		if (validate_numeric(thisform.telephone.value,"กรุณากรอก เบอร์โทรศัพท์เป็นตัวเลข ด้วยค่ะ!")==false)
		  {thisform.telephone.focus(); thisform.telephone.select(); return false;}
		
		if (validate_required(thisform.address,"กรุณากรอก ที่อยู่ ด้วยค่ะ!")==false)
		  {thisform.address.focus(); thisform.address.select(); return false;}

		if (validate_required(thisform.postcode,"กรุณากรอก รหัสไปรษณีย์ ด้วยค่ะ!")==false)
		  {thisform.postcode.focus(); thisform.postcode.select(); return false;}

		if (validate_numeric(thisform.postcode.value,"กรุณากรอก รหัสไปรษณีย์เป็นตัวเลข ด้วยค่ะ!")==false)
		  {thisform.postcode.focus(); thisform.postcode.select(); return false;}
		  
		 if (validate_numeric(thisform.strCheck.value,"กรุณากรอกเลขที่ท่านเห็นด้วยค่ะ!")==false)
		  {thisform.strCheck.focus(); thisform.strCheck.select(); return false;}
		 
		  
		
	}

	

}
/*********************************************************/
// validate_required(field,alerttxt)
/*********************************************************/
function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value==""||value.replace(/^\s+|\s+$/g,"").length==0)
		{
			alert(alerttxt);
			return false;
		}
		else {
			return true
		}
	}
}

/*********************************************************/
// validate_numeric(field,alerttxt)
/*********************************************************/
function validate_numeric(strString,alerttxt)
//  check for valid numeric strings	
{
	var strValidChars = "0123456789.";
	var strChar;
	var blnResult = true;

	if (strString.length == 0){
		alert(alerttxt);
		return false;
	}
	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length; i++)
	{
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1)
		{
			alert(alerttxt);
			return false;
		}
	 }
	return true;
}

/*********************************************************/
// ajaxchangeform(value)
/*********************************************************/
function ajaxchangeform(value){

	var currentdiv = document.getElementById('formcontact');
	var formtext = '';

	if(value == "order"){
		formtext = formtext + '<form name="contactfrm" action="http://www.creamsamunpaijula.com/shop.php"  onSubmit="return validate_form(this)" method="post" >';
		formtext = formtext + '  <table width="600" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#FFFFFF" class="commonTxt14_Black">';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right"width="180">ª×èÍ-¹ÒÁÊ¡ØÅ:</td>';
		formtext = formtext + '      <td width="445" colspan="2" align="left"><input name="nameOrder" type="text" id="nameOrder" size="30" />';
		formtext = formtext + '          <span class="smallTxt13_green">(*)</span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right">ÍÕàÁÅÅì:</td>';
		formtext = formtext + '      <td colspan="2" align="left"><input name="emailOrder" type="text" id="emailOrder" size="30" /></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right">àºÍÃìâ·ÃÈÑ¾·ì:</td>';
		formtext = formtext + '      <td colspan="2" align="left"><input name="telephoneOrder" type="text" id="telephoneOrder" size="30" class="required"/>';
		formtext = formtext + '          <span class="smallTxt13_green">(*)</span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" valign="top">·ÕèÍÂÙè: </td>';
		formtext = formtext + '      <td colspan="2" align="left"><span class="smallTxt13_green" style="padding-right:10px; ">';
		formtext = formtext + '        <label>';
		formtext = formtext + '        <textarea name="addressOrder" cols="30" id="addressOrder"></textarea>';
		formtext = formtext + '        </label>';
		formtext = formtext + '      </span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" valign="middle">ÃËÑÊä»ÃÉ³ÕÂì :</td>';
		formtext = formtext + '      <td colspan="2" align="left"><input name="postcodeOrder" type="text" id="postcodeOrder" size="15" />        ';
		formtext = formtext + '        <span class="smallTxt13_green">(*)</span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" valign="top">«×éÍ¤ÃÕÁËÁÍ¨ØÌÒ</td>';
		formtext = formtext + '      <td colspan="2" align="left"><select name="pSelect1" id="pSelect1" class="orderSelect">';
		formtext = formtext + '        <option value="1" selected="selected">1 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="2">2 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="3">3 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="4">4 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="5">5 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="6">6 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="7">7 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="8">8 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="9">9 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="10">10 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="11">11 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="12">12 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="13">13 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="14">14 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="15">15 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="16">16 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="17">17 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="18">18 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="19">19 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="20">20 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="24">24 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="25">25 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="26">26 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="27">27 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="28">28 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="29">29 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="30">30 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="31">31 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="32">32 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="33">33 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="34">34 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="35">35 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="36">36 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="37">37 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="38">38 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="39">39 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="40">40 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="41">41 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="42">42 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="43">43 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="44">44 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="45">45 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="46">46 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="47">47 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="48">48 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="49">49 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="50">50 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="51">51 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="52">52 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="53">53 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="54">54 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="55">55 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="56">56 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="57">57 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="58">58 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="59">59 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="60">60 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="61">61 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="62">62 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="63">63 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="64">64 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="65">65 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="66">66 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="67">67 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="68">68 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="69">69 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="70">70 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="71">71 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '<option value="72">72 ¡ÃÐ»Ø¡</option>';
		formtext = formtext + '                    ';
		formtext = formtext + '      ';
		formtext = formtext + '      </select>      ';
		formtext = formtext + '        <span style="padding-right:10px; "><span class="smallTxt13_green" style="padding-right:10px; ">';
		formtext = formtext + '        <input name="hidden_productSet" id="hidden_productSet" type="hidden" />';
		formtext = formtext + '        </span></span><br />';
		formtext = formtext + '        <span class="smallTxt13_green" >¶éÒµéÍ§¡ÒÃÊÔ¹¤éÒ¹Í¡àË¹×Í¨Ò¡·ÕèÁÕãËéàÅ×Í¡<br />';
		formtext = formtext + '        ¡ÃØ³Òâ·ÃÊÑè§«×éÍ¡Ñº·Ò§ÃéÒ¹â´ÂµÃ§¹Ð¤èÐ </span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    ';
		formtext = formtext + '    <tr valign="top">';
		formtext = formtext + '      <td align="right" width="180">¨Ñ´Êè§áºº:</td>';
		formtext = formtext + '      <td colspan="2" rowspan="2" align="left"><input type="radio" id="sendtype" name="sendtype" value="00" onclick="shoporderchangesendtype(this.value)" checked="checked" />';
		formtext = formtext + '        Êè§Å§·ÐàºÕÂ¹¸ÃÃÁ´Ò';
		formtext = formtext + '        <input type="radio" id="sendtype" name="sendtype" value="01" onclick="shoporderchangesendtype(this.value)" />';
		formtext = formtext + '        Êè§áºº EMS';
		formtext = formtext + '        <input type="radio" id="sendtype" name="sendtype" value="03" onclick="shoporderchangesendtype(this.value)" />';
		formtext = formtext + '        Êè§·Ò§Ã¶·ÑÇÃì';
		formtext = formtext + '        <input name="hidden_sendprice" type="hidden" id="hidden_sendprice" value="0" />';
		formtext = formtext + '        <div id="sendTip" class="smallTxt13_red">¤èÒÊè§¿ÃÕ!! ¨Ðä´éÃÑº¢Í§»ÃÐÁÒ³ 3- 5 ÇÑ¹·Ó¡ÒÃ ¹Ñº¨Ò¡ÇÑ¹·ÕèÊè§</div>';
		formtext = formtext + '        <div class="logisticDiv" style=""></div></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr valign="top">';
		formtext = formtext + '      <td align="right" valign="bottom">&nbsp;</td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" valign="top" style="padding-right:10px; ">ËÁÒÂàËµØ:</td>';
		formtext = formtext + '      <td colspan="2" align="left" class="smallTxt13_green" style="padding-right:10px; "><span class="smallTxt13_green" style="padding-right:10px; ">';
		formtext = formtext + '        <input name="customer_remarkOrder" type="text" id="customer_remarkOrder" size="60" />';
		formtext = formtext + '      </span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td style="padding-right:10px; ">&nbsp;</td>';
		formtext = formtext + '      <td colspan="2" align="left" class="smallTxt13_green" style="padding-right:10px; "><input name="btnOrder" type="submit" id="btnOrder" value="ÊÑè§«×éÍÊÔ¹¤éÒ"/>';
		formtext = formtext + '        <br />';
		formtext = formtext + '        ÃÐºº¨Ð·Ó¡ÒÃ¤Ô´¤èÒÊÔ¹¤éÒãËéàÁ×èÍ·Ó¡ÒÃ¡´»ØèÁÊÑè§«×éÍàÊÃç¨àÃÕÂºÃéÍÂ¤èÐ</td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '  </table><input name="ctype" type="hidden" id="ctype" value="order" />';
		formtext = formtext + '</form>';

		currentdiv.innerHTML = formtext;
	}

	/**************************************************************************************************************/
	/**************************************************************************************************************/
	/**************************************************************************************************************/

	if(value == "payment"){

		var formtext = '';


		formtext = formtext + '<form name="contactfrm" action="http://www.creamsamunpaijula.com/payment.php"  onSubmit="return validate_form(this)"  method="post" >';
		formtext = formtext + '  <table width="600" class="commonTxt14_Black" border="0" align="center" cellpadding="2" cellspacing="0">';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right">ËÁÒÂàÅ¢ÊÑè§«×éÍ:</td>';
		formtext = formtext + '      <td align="left"><input name="saleorderid" type="text" id="saleorderid" size="30" /></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" width="150">ª×èÍ-¹ÒÁÊ¡ØÅ:</td>';
		formtext = formtext + '      <td align="left"><input name="namePayment" type="text" id="namePayment" size="30" />';
		formtext = formtext + '          <span class="smallTxt13_green">(µéÍ§¡ÃÍ¡´éÇÂ¹Ð¤èÐ)</span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" width="150">ÍÕàÁÅÅì:</td>';
		formtext = formtext + '      <td align="left"><input name="emailPayment" type="text" id="emailPayment" size="30" /></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" width="150">àºÍÃìâ·ÃÈÑ¾·ì:</td>';
		formtext = formtext + '      <td align="left"><input name="telephonePayment" type="text" id="telephonePayment" size="30" />';
		formtext = formtext + '          <span class="smallTxt13_green">(µéÍ§¡ÃÍ¡´éÇÂ¹Ð¤èÐ)</span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" width="150">ªÓÃÐà§Ô¹à¢éÒºÑ­ªÕ</td>';
		formtext = formtext + '      <td align="left"><label>';
		formtext = formtext + '        <select name="banktransfer" id="banktransfer"  style="width:180px">';
		formtext = formtext + '          <option value="">¡ÃØ³ÒàÅ×Í¡¸¹Ò¤ÒÃ</option>';
		formtext = formtext + '          <option value="scb">¸.ä·Â¾Ò³ÔªÂì</option>';
		formtext = formtext + '          <option value="bbl">¸.¡ÃØ§à·¾</option>';
		formtext = formtext + '          <option value="ktb">¸.¡ÃØ§ä·Â</option>';
		formtext = formtext + '          <option value="tfb">¸.¡ÊÔ¡Ãä·Â</option>';
		formtext = formtext + '          <option value="ayd">¸.¡ÃØ§ÈÃÕÍÂØ¸ÂÒ</option>';
		formtext = formtext + '        </select>';
		formtext = formtext + '      </label></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" width="150">¨Ó¹Ç¹à§Ô¹·ÕèâÍ¹ (ºÒ·):</td>';
		formtext = formtext + '      <td align="left"><input name="amount" type="text" id="amount" size="30" />';
		formtext = formtext + '          <span class="smallTxt13_green">(µéÍ§¡ÃÍ¡´éÇÂ¹Ð¤èÐ)</span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" width="150">ÇÑ¹·ÕèªÓÃÐà§Ô¹:</td>';
		formtext = formtext + '      <td align="left"><span style="padding-right:10px; ">';
		formtext = formtext + '        <input name="paymentDate" type="hidden" id="paymentDate" value="" />';
		formtext = formtext + '        <select name="dateList" size="1" id="dateList">';
		formtext = formtext + '        </select>';
		formtext = formtext + '<select name="monthList" size="1" id="monthList" onChange="month_change(\'monthList\', \'dateList\')">';
		formtext = formtext + '  <option value="01" selected>Á¡ÃÒ¤Á</option>';
		formtext = formtext + '  <option value="02">¡ØÁÀÒ¾Ñ¹¸ì</option>';
		formtext = formtext + '  <option value="03">ÁÕ¹Ò¤Á</option>';
		formtext = formtext + '  <option value="04">àÁÉÒÂ¹</option>';
		formtext = formtext + '  <option value="05">¾ÄÉÀÒ¤Á</option>';
		formtext = formtext + '  <option value="06">ÁÔ¶Ø¹ÒÂ¹</option>';
		formtext = formtext + '  <option value="07">¡Ã¡®Ò¤Á</option>';
		formtext = formtext + '  <option value="08">ÊÔ§ËÒ¤Á</option>';
		formtext = formtext + '  <option value="09">¡Ñ¹ÂÒÂ¹</option>';
		formtext = formtext + '  <option value="10">µØÅÒ¤Á</option>';
		formtext = formtext + '  <option value="11">¾ÄÈ¨Ô¡ÒÂ¹</option>';
		formtext = formtext + '  <option value="12">¸Ñ¹ÇÒ¤Á</option>';
		formtext = formtext + '</select>';
		formtext = formtext + '        <select name="yearList" id="yearList">';
		formtext = formtext + '          <option value="2009">2552</option>';
		formtext = formtext + '          <option value="2010" selected="selected">2553</option>';
		formtext = formtext + '                                </select>';
		formtext = formtext + '        <span class="smallTxt13_green">(µéÍ§¡ÃÍ¡´éÇÂ¹Ð¤èÐ)</span></span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" style="padding-right:10px; "><span>àÇÅÒâ´Â»ÃÐÁÒ³</span></td>';
		formtext = formtext + '      <td align="left" style="padding-right:10px; "><select name="hourList" id="hourList">';
		formtext = formtext + '        </select>';
		formtext = formtext + '        :';
		formtext = formtext + '        <select name="minList" id="minList">';
		formtext = formtext + '        </select>';
		formtext = formtext + '        ¹.</td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td align="right" valign="top" style="padding-right:10px; "><span>ËÁÒÂàËµØ</span></td>';
		formtext = formtext + '      <td align="left" style="padding-right:10px; "><input name="remark_payment" type="text" id="remark_payment" size="30" />';
		formtext = formtext + '          <br />';
		formtext = formtext + '          <span class="smallTxt13_green">àªè¹ âÍ¹ÁÒ¨Ò¡ÊÒ¢ÒÍÐäÃ à»ç¹µé¹ </span></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '    <tr>';
		formtext = formtext + '      <td style="padding-right:10px; "><input name="ctype" type="hidden" id="ctype" value="payment" /></td>';
		formtext = formtext + '      <td align="left" style="padding-right:10px; "><input name="btnPayment" type="submit" id="btnPayment" value="Êè§¢éÍÁÙÅ" /></td>';
		formtext = formtext + '    </tr>';
		formtext = formtext + '  </table>';
		formtext = formtext + '</form>';

		currentdiv.innerHTML = formtext;
		generateListBox('dateList');
		generateListBox('timeList');

	}
	
	/**************************************************************************************************************/
	/**************************************************************************************************************/
	/**************************************************************************************************************/

	if(value == "checksaleorderid"){

		formtext = formtext + '<form name="contactfrm" action="http://www.creamjula.com/contact.php" onsubmit="return validate_form(this)" method="post" >';
		formtext = formtext + '<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" class="style9">';
		formtext = formtext + '<tr bgcolor="#DDFEB1">';
		formtext = formtext + '  <td width="130" align="right" bgcolor="#DDFEB1" class="headcontact" >&nbsp;</td>';
		formtext = formtext + '  <td align="left">&nbsp;</td>';
		formtext = formtext + '</tr>';
		formtext = formtext + '<tr bgcolor="#DDFEB1">';
		formtext = formtext + '  <td colspan="2" bgcolor="#DDFEB1" class="headcontact" style="padding-left:70px;padding-right:50px;"><hr>µÑé§áµèÇÑ¹·Õè 24/11/2551 à»ç¹µé¹ä» ·Ò§ÃéÒ¹¢ÍÂ¡àÅÔ¡ÃÐººÊÍº¶ÒÁáººà´ÔÁ(·Ò§ÍÕàÁÅÅì)¹Ð¤èÐ ';
		formtext = formtext + '      ÊÓËÃÑº¼Ùé·ÕèµéÍ§¡ÒÃÊÍº¶ÒÁÃÒÂÅÐàÍÕÂ´à¾ÔèÁàµÔÁ ¢ÍãËéãªéàÇººÍÃì´¢Í§·Ò§ÃéÒ¹à»ç¹ªèÍ§·Ò§ã¹¡ÒÃÊÍº¶ÒÁ¹Ð¤èÐ<br>';
		formtext = formtext + '      <br>';
		formtext = formtext + '      <a href="http://www.creamjula.com/webboard" target="_blank" rel="nofollow">àÇººÍÃì´¢Í§ÃéÒ¹ http://www.creamjula.com/webboard ¤ÅÔ¡·Õè¹ÕèàÅÂ¤èÐ</a><br>';
		formtext = formtext + '      <br>';
		formtext = formtext + '      ¶éÒÅÙ¡¤éÒ·èÒ¹ã´äÁèÊÐ´Ç¡·Õè¨Ð¶ÒÁ·ÕèàÇººÍÃì´¨ÃÔ§æ ËÃ×Í¨ÐÊÍº¶ÒÁÃÒ¤Ò¢ÒÂÊè§µÑé§áµè 2 âËÅ¢Öé¹ä»';
		formtext = formtext + '      ÊÒÁÒÃ¶ email ËÃ×Í â·ÃÁÒ¶ÒÁä´éàËÁ×Í¹à´ÔÁ¹Ð¤èÐ·Õè<br>';
		formtext = formtext + '      ÍÕàÁÅÅì: creamjula@hotmail.com<br>';
		formtext = formtext + '      â·ÃÈÑ¾·ì: 086-3697848 (áÍ¹), 086-6096945 (â¨) </p></td>';
		formtext = formtext + '  </tr>';
		formtext = formtext + '<tr bgcolor="#DDFEB1">';
		formtext = formtext + '<td style="padding-right:10px; "><input name="ctype" type="hidden" id="ctype" value="moredetail"></td>';
		formtext = formtext + '<td align="left" style="padding-right:10px; ">&nbsp;</td>';
		formtext = formtext + '</tr>';
		formtext = formtext + '</table>';
		formtext = formtext + '</td>';
		formtext = formtext + '</tr>';
		formtext = formtext + '<tr>';
		formtext = formtext + '<td>&nbsp;</td>';
		formtext = formtext + '</tr>';
		formtext = formtext + '</tbody>';
		formtext = formtext + '</table>';
		formtext = formtext + '</form>';

		currentdiv.innerHTML = formtext;
	}


}
/******************************************************************/
// function showAmountDetail()
/******************************************************************/
function showDetail(boxName,divName){
	var currentdiv = document.getElementById(divName);
	if(boxName.checked == true) { 
		currentdiv.style.display = "";
	}else{
		currentdiv.style.display = "none";
	}
}
/******************************************************************/
function shoporderchangesendtype(value){
//	alert(value);
	if(value == "00"){
		sendpriceTextDiv = document.getElementById('sendTip');
		sendpriceTextDiv.innerHTML = "¤èÒÊè§¿ÃÕ!! ¨Ðä´éÃÑº¢Í§»ÃÐÁÒ³ 3- 5 ÇÑ¹·Ó¡ÒÃ ¹Ñº¨Ò¡ÇÑ¹·ÕèÊè§";

		hidden_sendprice = document.getElementById('hidden_sendprice');
		hidden_sendprice.value = 0;

	}
	if(value == "01"){
		sendpriceTextDiv = document.getElementById('sendTip');
		sendpriceTextDiv.innerHTML = "¤èÒÊè§ 30 ºÒ· ¨Ðä´éÃÑº¢Í§»ÃÐÁÒ³ 1-2 ÇÑ¹·Ó¡ÒÃ ¹Ñº¨Ò¡ÇÑ¹·ÕèÊè§";

		hidden_sendprice = document.getElementById('hidden_sendprice');
		hidden_sendprice.value = 30;
	}
	if(value == "03"){
		sendpriceTextDiv = document.getElementById('sendTip');
		sendpriceTextDiv.innerHTML = "¤èÒÊè§ 100 ºÒ· ¨Ðä´éÃÑº¢Í§äÁèà¡Ô¹ 1 ÇÑ¹·Ó¡ÒÃ ¹Ñº¨Ò¡ÇÑ¹·ÕèÊè§";

		hidden_sendprice = document.getElementById('hidden_sendprice');
		hidden_sendprice.value = 100;
	}
	
}




/*************************************************************************/
function updateproductset(){
	var nValue = document.getElementById('pSelect1').value;
	document.getElementById('hidden_pvalue1').value = document.getElementById('pSelect1').value ;


	/******************* Begin change pset, pvalue **************************/
		var pSet = "";
		var pidArr= new Array();

		var arrHidden1 =  $('#productIdDiv input[type=hidden]');
		for(var idx = 0; idx < arrHidden1.length; ++idx) {
			 pidArr.push(arrHidden1[idx].value);
		}
		var pvalueArr = new Array();
		var arrHidden2 = $('#productValueDiv input[type=hidden]');
		for(var idx = 0; idx < arrHidden2.length; ++idx) {
			 pvalueArr.push(arrHidden2[idx].value);
		}

		for(var idx = 0; idx < pvalueArr.length; ++idx) {
			pSet = pSet + pidArr[idx] + "," + pvalueArr[idx];
			if(idx != pvalueArr.length - 1){
				pSet = pSet+"|";
			}
		}

		$('#hidden_productSet').val(pSet);
}



