function SetInitR(idx, obj_name) {
	if (idx != 0) {
		show_r_atz_R(obj_name, 'p_city_', 'p_city_index_', idx,'Select (Province)');
	}
	else {
		noshow_r_atz('selProvince');
	}
}
function SetInitAdvanceSearch(idx, obj_name) {
	if (idx != 0) {
		show_r_atz_R(obj_name, 'p_city_', 'p_city_index_', idx,'All Province');
	}
	else {
		noshow_r_atz('selProvince');
	}
}
function noshow_r_atz(obj_name) {
	var temp = eval("document.form." + obj_name + ";");
	var len = temp.options.length;
	for (i=1; i<len; i++) {
		temp.options.remove(1)
	}
	temp.options[0].text = '------------------------------------------';temp.options[0].value = 0; temp.options[0].selected = true;
}
function show_r_atz(obj_name, str_name, index, titlesl) {
	var str = eval( str_name + index + ".split(', ');" );
	var temp = eval( "document.form." + obj_name + ";" );
	for ( var m=temp.options.length-1; m>0; m-- ) temp.options[m] = null;
	var new_obj = new Array( str.length ); 
	for ( var i=0; i<str.length; i++ ) new_obj[i] = new Option( str[i], i+1 );
	for ( var i=1; i<str.length+1; i++ ) {temp.options[i] = new Option( new_obj[i-1].text );temp.options[i].value = temp.options[i].text;}
	temp.options[0].text= titlesl;temp.options[0].value= 0;temp.options[0].selected = true;
}
function show_r_atz_R(obj_name, str_name, str_name_value, index, titlesl) {
	var str = eval( str_name + index + ".split(', ');" );
	var str_value = eval( str_name_value + index + ".split(', ');" );
	var temp = eval( "document.form." + obj_name + ";" );
	for ( var m=temp.options.length-1; m>0; m-- ) temp.options[m] = null;
	var new_obj = new Array( str.length );
	var new_obj_value = new Array( str_value.length );
	for ( var i=0; i<str.length; i++ ) new_obj[i] = new Option( str[i], i+1 );
	for ( var i=1; i<str.length+1; i++ ) {temp.options[i] = new Option( new_obj[i-1].text ); temp.options[i].value = str_value[i-1];}
	temp.options[0].text= titlesl;temp.options[0].value= 0;temp.options[0].selected = true;
}

today = 2547;
p_city_index_01 = "01, 02, 03, 04";
p_city_index_02 = "05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22";
p_city_index_03 = "23, 24, 25, 26";
p_city_index_04 = "27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43";
p_city_index_05 = "44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57";
p_city_index_06 = "58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76";

p_city_01 = "Bangkok, Pathum Thani, Nonthaburi, Samut Prakarn";
p_city_02 = "Kanchanaburi, Chachoengsao, Chainat, Nakhon Nayok, Nakhon Phatom, Prachuap Khilikhan, Phachinburi, Phra Nakhon Si Ayudhya, Phetchaburi, Ratchaburi, Lopburi, Samut Songkham, Samut Sakhon, Sa Kaeo, Saraburi, Singburi, Suphanburi, Ang Thong";
p_city_03 = "Chanthaburi, Chonburi, Trad, Rayong";
p_city_04 = "Kampaeng Phet, Chiang Rai, Chiang Mai, Tak, Nakhon Sawan, Nan, Phayao, Phichit, Phitsanulok, Phetchabun, Phrae, Mae Hong Son, Lampang, Lamphun, Sukhothai, Uttaradit, Uthai Thani";
p_city_05 = "Krabi, Chumphon, Trang, Nakhon Si Thammarat, Narathiwat, Pattani, Phangnga, Phatthalung, Phuket, Yala, Ranong, Songkhla, Satun, Surat Thani";
p_city_06 = "Kalasin, Khon Kaen, Chaiyaphum, Nakhon Phanom, Nakhon Ratchasima, Buriram, Maha Sarakham, Mukdahan, Yasothon, Roi Et, Loei, Si Saket, Sakon Nakhon, Surin, Nong Khai, Nong Bau Lamphu, Amnat Charoen, Udon Thani, Ubon Ratchathani"
