/**************************************************************/
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.nameOrder,"กรุณากรอกชื่อ-นามสกุลด้วยค่ะ!")==false)
		  {thisform.nameOrder.focus(); thisform.nameOrder.select(); return false;}

		if (validate_required(thisform.telephoneOrder,"กรุณากรอกเบอร์โทรศัพท์ด้วยค่ะ!")==false)
		  {thisform.telephoneOrder.focus(); thisform.telephoneOrder.select(); return false;}
		
		if (validate_required(thisform.addressOrder,"กรุณากรอกที่อยู่สำหรับจัดส่งสินค้าด้วยค่ะ")==false)
		  {thisform.addressOrder.focus(); thisform.addressOrder.select(); return false;}

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

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

	if(thisform.ctype.value == "payment"){

		var dateList = document.getElementById('dateList').value;
		var monthList = document.getElementById('monthList').value;
		var yearList = document.getElementById('yearList').value;

		var paymentDate = document.getElementById('paymentDate');
		paymentDate.value = dateList+"/"+monthList+"/"+yearList;


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

		if (validate_required(thisform.telephonePayment,"กรุณากรอกเบอร์โทรศัพท์ด้วยค่ะ!")==false)
		  {thisform.telephonePayment.focus(); thisform.telephonePayment.select(); return false;}

		if (validate_required(thisform.banktransfer,"กรุณาเลือกธนาคารที่ทำการโอนด้วยค่ะ!")==false)
		  {thisform.banktransfer.focus();  return false;}

		if (validate_required(thisform.amount,"กรุณากรอกจำนวนเงินที่โอนด้วยค่ะ!")==false)
		  {thisform.amount.focus(); thisform.amount.select(); return false;}
		
		if (validate_numeric(thisform.amount.value,"กรุณากรอกจำนวนเงินเป็นตัวเลขค่ะ!")==false)
		  {thisform.amount.focus(); thisform.amount.select(); return false;}



	}
	
	if(thisform.ctype.value == "moredetail"){
		if (validate_required(thisform.name,"กรุณากรอกชื่อ-นามสกุลด้วยค่ะ!")==false)
		  {thisform.name.focus(); thisform.txtyear.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.creamjula.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.creamjula.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);
}


