//ChkValidcolorcode
function ChkValidcolorcode() {
missinginfo = "";
var v1=document.frm.elements['Img1'].value.substr(frm.elements['Img1'].value.indexOf('.')+1,frm.elements['Img1'].value.length);
var v2=document.frm.elements['Img2'].value.substr(frm.elements['Img2'].value.indexOf('.')+1,frm.elements['Img2'].value.length);
var v3=document.frm.elements['Img3'].value.substr(frm.elements['Img3'].value.indexOf('.')+1,frm.elements['Img3'].value.length);
var v4=document.frm.elements['Img4'].value.substr(frm.elements['Img4'].value.indexOf('.')+1,frm.elements['Img4'].value.length);
var v5=document.frm.elements['Img5'].value.substr(frm.elements['Img5'].value.indexOf('.')+1,frm.elements['Img5'].value.length);
var v6=document.frm.elements['Img6'].value.substr(frm.elements['Img6'].value.indexOf('.')+1,frm.elements['Img6'].value.length);
var v7=document.frm.elements['Img7'].value.substr(frm.elements['Img7'].value.indexOf('.')+1,frm.elements['Img7'].value.length);
var v8=document.frm.elements['Img8'].value.substr(frm.elements['Img8'].value.indexOf('.')+1,frm.elements['Img8'].value.length);
var v9=document.frm.elements['Img9'].value.substr(frm.elements['Img9'].value.indexOf('.')+1,frm.elements['Img9'].value.length);
var v10=document.frm.elements['Img10'].value.substr(frm.elements['Img10'].value.indexOf('.')+1,frm.elements['Img10'].value.length);
v1=v1.toLowerCase();v2=v2.toLowerCase();v3=v3.toLowerCase();v4=v4.toLowerCase();v5=v5.toLowerCase();
v6=v6.toLowerCase();v7=v7.toLowerCase();v8=v8.toLowerCase();v9=v9.toLowerCase();v10=v10.toLowerCase();
if ((v1 !="jpg" && v1 !="gif" && v1 !="png") && frm.elements['Img12'].value == "" && frm.elements['CodeCode1'].value != "")
{
missinginfo += "\n - Please Select picture 1/file type is jpg,gif,png only";
}
if ((v2 !="jpg" && v2 !="gif" && v2 !="png") && frm.elements['Img2'].value != "" && frm.elements['CodeCode2'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v2 !="jpg" && v3 !="gif" && v3 !="png") && frm.elements['Img3'].value != "" && frm.elements['CodeCode3'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v4 !="jpg" && v4 !="gif" && v4 !="png") && frm.elements['Img4'].value != "" && frm.elements['CodeCode4'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v5 !="jpg" && v5 !="gif" && v5 !="png") && frm.elements['Img5'].value != "" && frm.elements['CodeCode5'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v6 !="jpg" && v6 !="gif" && v6 !="png") && frm.elements['Img6'].value != "" && frm.elements['CodeCode6'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v7 !="jpg" && v7 !="gif" && v7 !="png") && frm.elements['Img7'].value != "" && frm.elements['CodeCode7'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v8 !="jpg" && v8 !="gif" && v8 !="png") && frm.elements['Img8'].value != "" && frm.elements['CodeCode8'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v9 !="jpg" && v9 !="gif" && v9 !="png") && frm.elements['Img9'].value != "" && frm.elements['CodeCode9'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v10 !="jpg" && v10 !="gif" && v10 !="png") && frm.elements['Img10'].value != "" && frm.elements['CodeCode10'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if (missinginfo != "") {
missinginfo = "Please input data:\n" + missinginfo + "\n ";
alert(missinginfo);
return false;
}
else
return true;
}
function chkform(frm) {
if(!frm.Name.value){
alert("Please enter your name.");
frm.Name.focus();
return false;
}
if(!frm.Email.value){
alert("Please enter your E-mail address.");
frm.Email.focus();
return false;
}
if(frm.Email.value.indexOf('@') == -1 || frm.Email.value.indexOf('.')== -1){
alert("Please enter your Full E-mail address.");
frm.Email.focus();
return false;
}
if(!frm.Address.value){
alert("Please enter your address.");
frm.Address.focus();
return false;
}
if(!frm.City.value){
alert("Please enter your full address --> City.");
frm.City.focus();
return false;
}
if(!frm.State.value){
alert("Please enter your full address --> State.");
frm.State.focus();
return false;
}
if(!frm.Zip.value){
alert("Please enter your full address --> Postal Code.");
frm.Zip.focus();
return false;
}
if(!frm.Country.value){
alert("Please enter Country.");
frm.Country.focus();
return false;
}
if(!frm.Phone.value){
alert("Please enter your Telephone Number.");
frm.Phone.focus();
return false;
}
if(frm.PayMethod.value=='0'){
alert("Please select your Payment Option.");
frm.PayMethod.focus();
return false;
}
return true;
}
//Basket
function RemoveBasket(pID,color) {
document.getElementById('indicator').innerHTML = '
';
var URL = "basketFunc.php";
var data = "action=RemoveBasket&pID="+pID+"&color="+color;
ajaxLoad('get', URL, data, 'basketDiv');
document.getElementById('indicator').innerHTML = "";
}
function AddBasket(pID,color,catID,iqty) {
document.getElementById('indicator').innerHTML = ' ';
var URL = "basketFunc.php";
var data = "action=AddBasket&pID="+pID+"&color="+color+"&iqty="+iqty;
//alert(data);
ajaxLoad('get', URL, data, 'basketDiv');
document.getElementById('indicator').innerHTML = "";
window.location="index.php?ActionCase=category&C="+catID+"#list";
}
function AddBasket4Detail(pID,catID,iqty,color) {
document.getElementById('indicator').innerHTML = ' ';
var URL = "basketFunc.php";
var data = "action=AddBasket&pID="+pID+"&iqty="+iqty+"&color="+color;
//alert(data);
var result=ajaxLoad('get', URL, data, 'basketDiv');
document.getElementById('indicator').innerHTML = "";
//if(catID!="5"){
window.location="index.php?ActionCase=category&C="+catID+"#list";
//}
}
//Basket
//News
function ChkValidNews() {
missinginfo = "";
var v1=document.frm.elements['Img1'].value.substr(frm.elements['Img1'].value.indexOf('.')+1,frm.elements['Img1'].value.length);
var v2=document.frm.elements['Img2'].value.substr(frm.elements['Img2'].value.indexOf('.')+1,frm.elements['Img2'].value.length);
var v3=document.frm.elements['Img3'].value.substr(frm.elements['Img3'].value.indexOf('.')+1,frm.elements['Img3'].value.length);
var v4=document.frm.elements['Img4'].value.substr(frm.elements['Img4'].value.indexOf('.')+1,frm.elements['Img4'].value.length);
var v5=document.frm.elements['Img5'].value.substr(frm.elements['Img5'].value.indexOf('.')+1,frm.elements['Img5'].value.length);
var v6=document.frm.elements['Img6'].value.substr(frm.elements['Img6'].value.indexOf('.')+1,frm.elements['Img6'].value.length);
var v7=document.frm.elements['Img7'].value.substr(frm.elements['Img7'].value.indexOf('.')+1,frm.elements['Img7'].value.length);
var v8=document.frm.elements['Img8'].value.substr(frm.elements['Img8'].value.indexOf('.')+1,frm.elements['Img8'].value.length);
var v9=document.frm.elements['Img9'].value.substr(frm.elements['Img9'].value.indexOf('.')+1,frm.elements['Img9'].value.length);
var v10=document.frm.elements['Img10'].value.substr(frm.elements['Img10'].value.indexOf('.')+1,frm.elements['Img10'].value.length);
v1=v1.toLowerCase();v2=v2.toLowerCase();v3=v3.toLowerCase();v4=v4.toLowerCase();v5=v5.toLowerCase();
v6=v6.toLowerCase();v7=v7.toLowerCase();v8=v8.toLowerCase();v9=v9.toLowerCase();v10=v10.toLowerCase();
var aName=FCKeditorAPI.GetInstance('aName').GetHTML();
var aDesc=FCKeditorAPI.GetInstance('aDesc').GetHTML();
if (aName=="
" || aName==""){
missinginfo += "\n - Title";
}
if (aDesc=="
" || aDesc==""){
missinginfo += "\n - Description";
}
if ((v1 !="jpg" && v1 !="gif" && v1 !="png") && frm.elements['Img12'].value == "")
{
missinginfo += "\n - Please Select picture 1/file type is jpg,gif,png only";
}
if ((v2 !="jpg" && v2 !="gif" && v2 !="png") && frm.elements['Img2'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v2 !="jpg" && v3 !="gif" && v3 !="png") && frm.elements['Img3'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v4 !="jpg" && v4 !="gif" && v4 !="png") && frm.elements['Img4'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v5 !="jpg" && v5 !="gif" && v5 !="png") && frm.elements['Img5'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v6 !="jpg" && v6 !="gif" && v6 !="png") && frm.elements['Img6'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v7 !="jpg" && v7 !="gif" && v7 !="png") && frm.elements['Img7'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v8 !="jpg" && v8 !="gif" && v8 !="png") && frm.elements['Img8'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v9 !="jpg" && v9 !="gif" && v9 !="png") && frm.elements['Img9'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v10 !="jpg" && v10 !="gif" && v10 !="png") && frm.elements['Img10'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if (missinginfo != "") {
missinginfo = "Please input data:\n" + missinginfo + "\n ";
alert(missinginfo);
return false;
}
else
return true;
}
//lampang-Attractions
function ChkValidAttractions() {
missinginfo = "";
var v1=document.frm.elements['Img1'].value.substr(frm.elements['Img1'].value.indexOf('.')+1,frm.elements['Img1'].value.length);
var v2=document.frm.elements['Img2'].value.substr(frm.elements['Img2'].value.indexOf('.')+1,frm.elements['Img2'].value.length);
var v3=document.frm.elements['Img3'].value.substr(frm.elements['Img3'].value.indexOf('.')+1,frm.elements['Img3'].value.length);
var v4=document.frm.elements['Img4'].value.substr(frm.elements['Img4'].value.indexOf('.')+1,frm.elements['Img4'].value.length);
var v5=document.frm.elements['Img5'].value.substr(frm.elements['Img5'].value.indexOf('.')+1,frm.elements['Img5'].value.length);
var v6=document.frm.elements['Img6'].value.substr(frm.elements['Img6'].value.indexOf('.')+1,frm.elements['Img6'].value.length);
var v7=document.frm.elements['Img7'].value.substr(frm.elements['Img7'].value.indexOf('.')+1,frm.elements['Img7'].value.length);
var v8=document.frm.elements['Img8'].value.substr(frm.elements['Img8'].value.indexOf('.')+1,frm.elements['Img8'].value.length);
var v9=document.frm.elements['Img9'].value.substr(frm.elements['Img9'].value.indexOf('.')+1,frm.elements['Img9'].value.length);
var v10=document.frm.elements['Img10'].value.substr(frm.elements['Img10'].value.indexOf('.')+1,frm.elements['Img10'].value.length);
v1=v1.toLowerCase();v2=v2.toLowerCase();v3=v3.toLowerCase();v4=v4.toLowerCase();v5=v5.toLowerCase();
v6=v6.toLowerCase();v7=v7.toLowerCase();v8=v8.toLowerCase();v9=v9.toLowerCase();v10=v10.toLowerCase();
var aName=FCKeditorAPI.GetInstance('aName').GetHTML();
var aDesc=FCKeditorAPI.GetInstance('aDesc').GetHTML();
if (aName=="
" || aName==""){
missinginfo += "\n - Title";
}
if (aDesc=="
" || aDesc==""){
missinginfo += "\n - Description";
}
if ((v1 !="jpg" && v1 !="gif" && v1 !="png") && frm.elements['Img12'].value == "")
{
missinginfo += "\n - Please Select picture 1/file type is jpg,gif,png only";
}
if ((v2 !="jpg" && v2 !="gif" && v2 !="png") && frm.elements['Img2'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v2 !="jpg" && v3 !="gif" && v3 !="png") && frm.elements['Img3'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v4 !="jpg" && v4 !="gif" && v4 !="png") && frm.elements['Img4'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v5 !="jpg" && v5 !="gif" && v5 !="png") && frm.elements['Img5'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v6 !="jpg" && v6 !="gif" && v6 !="png") && frm.elements['Img6'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v7 !="jpg" && v7 !="gif" && v7 !="png") && frm.elements['Img7'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v8 !="jpg" && v8 !="gif" && v8 !="png") && frm.elements['Img8'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v9 !="jpg" && v9 !="gif" && v9 !="png") && frm.elements['Img9'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if ((v10 !="jpg" && v10 !="gif" && v10 !="png") && frm.elements['Img10'].value != "")
{
missinginfo += "\n - file type is jpg,gif,png only";
}
if (missinginfo != "") {
missinginfo = "Please input data:\n" + missinginfo + "\n ";
alert(missinginfo);
return false;
}
else
return true;
}
//BAContact
function ChkValidBAContact() {
var v=frm.elements['Email'].value;
AtPos = v.indexOf("@");
StopPos = v.lastIndexOf(".");
missinginfo = "";
if (frm.elements['Customer'].value == "") {
missinginfo += "\n - Name:";
}
if ((AtPos == -1 || StopPos == -1)) {
missinginfo += "\n - E-mail";
}
if (missinginfo != "") {
missinginfo = "Please input your information :\n" + missinginfo + "\n ";
alert(missinginfo);
return false;
}
else
return true;
}
//Product
function ChkValidProduct() {
missinginfo = "";
if (frm.elements['Ref_Code'].value == "") {
missinginfo += "\n - New Code:";
}
if (frm.elements['catID'].value == "") {
missinginfo += "\n - Category";
}
if (frm.elements['Description'].value == "") {
missinginfo += "\n - Description ";
}
if (missinginfo != "") {
missinginfo = "ท่านกรอกข้อมูลไม่ถูกต้องในช่องต่อไปนี้ :\n" + missinginfo + "\nกรุณากลับไปตรวจสอบอีกครั้ง";
alert(missinginfo);
return false;
}
else
return true;
}
//Maker New
function ChkValidMakerNew() {
missinginfo = "";
var notes=FCKeditorAPI.GetInstance('notes').GetHTML();
if (frm.elements['name'].value == "") {
missinginfo += "\n - Name";
}
if (frm.elements['size_category'].value == "") {
missinginfo += "\n - Size Category";
}
if (frm.elements['address_1'].value == "") {
missinginfo += "\n - Address ";
}
if (frm.elements['province'].value == "") {
missinginfo += "\n - Province";
}
if (frm.elements['country'].value == "") {
missinginfo += "\n - Country";
}
if (frm.elements['phone'].value == "") {
missinginfo += "\n - Phone ";
}
// if (frm.elements['email'].value == "") {
// missinginfo += "\n - Email";
// }
if (frm.elements['secID'].value == "") {
missinginfo += "\n - Product Category";
}
/* if (notes=="
" || notes==""){
missinginfo += "\n - Notes";
}
*/
if (missinginfo != "") {
missinginfo = "ท่านกรอกข้อมูลไม่ถูกต้องในช่องต่อไปนี้ :\n" + missinginfo + "\nกรุณากลับไปตรวจสอบอีกครั้ง";
alert(missinginfo);
return false;
}
else
return true;
}
//เกี่ยวกับ LAMPANG CERAMIC ASSOCIATION
function Search4LPCeramic(page,txtSearch3) {
document.getElementById('indicator').innerHTML = ' ';
var URL = "AssociationFunc.php";
var data = "action=Search4LPCeramic&txtSearch3="+txtSearch3+"&page="+page;
ajaxLoad('get', URL, data, 'formDiv');
document.getElementById('indicator').innerHTML = "";
}
function ChkValidLPCeramic() {
missinginfo = "";
var Description=FCKeditorAPI.GetInstance('Description').GetHTML();
if (frm.elements['clpID'].value == "") {
missinginfo += "\n - Product Category";
}
if (frm.elements['CompanyName'].value == "") {
missinginfo += "\n - Company Name";
}
if (frm.elements['ContactName'].value == "") {
missinginfo += "\n - Contact Name";
}
if (frm.elements['Phone'].value == "") {
missinginfo += "\n - Phone";
}
if (frm.elements['Products'].value == "") {
missinginfo += "\n - Products";
}
if (Description=="
" || Description==""){
missinginfo += "\n - Description";
}
if (frm.elements['Username'].value == "") {
missinginfo += "\n - Username";
}
if (frm.elements['Password'].value == "") {
missinginfo += "\n - Password";
}
if (missinginfo != "") {
missinginfo = "ท่านกรอกข้อมูลไม่ถูกต้องในช่องต่อไปนี้ :\n" + missinginfo + "\nกรุณากลับไปตรวจสอบอีกครั้ง";
alert(missinginfo);
return false;
}
else
return true;
}
function NewLPCeramic() {
parent.FCKeditorAPI = null;
parent.FCKeditorNS = null;
var URL = "AssociationFunc.php";
var data = "action=New";
ajaxLoad('get', URL, data, 'formDiv');
}
function showList4LPCeramic(page,txtSearch) {
document.getElementById('indicator').innerHTML = ' ';
var URL = "AssociationFunc.php";
var data = "action=showList4LPCeramic&txtSearch="+txtSearch+"&page="+page;
ajaxLoad('get', URL, data, 'formDiv');
document.getElementById('indicator').innerHTML = "";
}
function edit4LPCeramic(cID) {
parent.FCKeditorAPI = null;
parent.FCKeditorNS = null;
document.getElementById('indicator').innerHTML = ' ';
var URL = "AssociationFunc.php";
var data = 'action=edit4LPCeramic&cID='+cID;
ajaxLoad('get', URL, data, 'formDiv');
document.getElementById('indicator').innerHTML = "";
}
function del4LPCeramic(cID) {
var URL = "AssociationFunc.php";
var data = 'action=del4LPCeramic&cID='+cID;
document.getElementById('indicator').innerHTML = ' ';
var result=ajaxLoad('get', URL, data, 'showResult');
document.getElementById('indicator').innerHTML = "";
alert(result);
showList4LPCeramic('1','');
}
//ปิด LAMPANG CERAMIC ASSOCIATION
//แสดงที่หน้าหลักหลังจากเพิ่มรายการ
function LeftMenu() {
parent.FCKeditorAPI = null;
parent.FCKeditorNS = null;
var URL = "MenuFunc.php";
var data = "action=LeftMenu";
ajaxLoad('get', URL, data, 'LeftMenuDiv');
}
//เกี่ยวกับ showList4Category
function ChkValidCategory() {
missinginfo = "";
var catDesc=FCKeditorAPI.GetInstance('catDesc').GetHTML();
if (frm.elements['secID'].value == "") {
missinginfo += "\n - กลุ่มของผลิตภัณฑ์";
}
if (frm.elements['catName'].value == "") {
missinginfo += "\n - หมวดหมู่ผลิตภัณฑ์";
}
if (catDesc=="
" || catDesc==""){
missinginfo += "\n - รายละเอียด";
}
if (missinginfo != "") {
missinginfo = "ท่านกรอกข้อมูลไม่ถูกต้องในช่องต่อไปนี้ :\n" + missinginfo + "\nกรุณากลับไปตรวจสอบอีกครั้ง";
alert(missinginfo);
return false;
}
else
return true;
}
function NewCategory() {
parent.FCKeditorAPI = null;
parent.FCKeditorNS = null;
var URL = "CategoryFunc.php";
var data = "action=New";
ajaxLoad('get', URL, data, 'formDiv');
}
function CategoryInsert2DB() {
if (ChkValidCategory() == true){
document.getElementById('indicator').innerHTML = ' ';
var catDesc=FCKeditorAPI.GetInstance('catDesc').GetHTML();
var URL = "CategoryFunc.php";
var data = getFormData("frm")+"&catDesc="+catDesc;
var result=ajaxLoad('get', URL, data, 'showResult');
document.getElementById('indicator').innerHTML = "";
alert(result);
NewCategory();
//LeftMenu();
} else
return false;
}
function showList4Category(page,txtSearch,secID) {
document.getElementById('indicator').innerHTML = ' ';
var URL = "CategoryFunc.php";
var data = "action=showList4Category&txtSearch="+txtSearch+"&page="+page+"&secID="+secID;
ajaxLoad('get', URL, data, 'formDiv');
document.getElementById('indicator').innerHTML = "";
}
function edit4Category(catID) {
parent.FCKeditorAPI = null;
parent.FCKeditorNS = null;
document.getElementById('indicator').innerHTML = ' ';
var URL = "CategoryFunc.php";
var data = 'action=edit4Category&catID='+catID;
ajaxLoad('get', URL, data, 'formDiv');
document.getElementById('indicator').innerHTML = "";
}
function CategoryUpdate2DB() {
if (ChkValidCategory() == true){
document.getElementById('indicator').innerHTML = ' ';
var catDesc=FCKeditorAPI.GetInstance('catDesc').GetHTML();
var URL = "CategoryFunc.php";
var data = getFormData("frm")+"&catDesc="+catDesc;
var result=ajaxLoad('get', URL, data, 'showResult');
document.getElementById('indicator').innerHTML = "";
alert(result);
showList4Category('1','','');
//LeftMenu();
} else
return false;
}
function del4Category(catID) {
var URL = "CategoryFunc.php";
var data = 'action=del4Category&catID='+catID;
document.getElementById('indicator').innerHTML = ' ';
var result=ajaxLoad('get', URL, data, 'showResult');
document.getElementById('indicator').innerHTML = "";
alert(result);
showList4Category('1','');
//LeftMenu();
}
//ปิด showList4Category
//เกี่ยวกับ showList4Section
function ChkValidSection() {
missinginfo = "";
var secDesc=FCKeditorAPI.GetInstance('secDesc').GetHTML();
if (frm.elements['secName'].value == "") {
missinginfo += "\n - Section Name";
}
if (secDesc=="
" || secDesc==""){
missinginfo += "\n - Description";
}
if (missinginfo != "") {
missinginfo = "ท่านกรอกข้อมูลไม่ถูกต้องในช่องต่อไปนี้ :\n" + missinginfo + "\nกรุณากลับไปตรวจสอบอีกครั้ง";
alert(missinginfo);
return false;
}
else
return true;
}
function NewSection() {
parent.FCKeditorAPI = null;
parent.FCKeditorNS = null;
var URL = "SectionFunc.php";
var data = "action=New";
ajaxLoad('get', URL, data, 'formDiv');
}
function SectionInsert2DB() {
if (ChkValidSection() == true){
document.getElementById('indicator').innerHTML = ' ';
var secDesc=FCKeditorAPI.GetInstance('secDesc').GetHTML();
var URL = "SectionFunc.php";
var data = getFormData("frm")+"&secDesc="+secDesc;
var result=ajaxLoad('get', URL, data, 'showResult');
document.getElementById('indicator').innerHTML = "";
alert(result);
NewSection();
//LeftMenu();
} else
return false;
}
function showList4Section(page,txtSearch) {
document.getElementById('indicator').innerHTML = ' ';
var URL = "SectionFunc.php";
var data = "action=showList4Section&txtSearch="+txtSearch+"&page="+page;
ajaxLoad('get', URL, data, 'formDiv');
document.getElementById('indicator').innerHTML = "";
}
function edit4Section(secID) {
parent.FCKeditorAPI = null;
parent.FCKeditorNS = null;
document.getElementById('indicator').innerHTML = ' ';
var URL = "SectionFunc.php";
var data = 'action=edit4Section&secID='+secID;
ajaxLoad('get', URL, data, 'formDiv');
document.getElementById('indicator').innerHTML = "";
}
function SectionUpdate2DB() {
if (ChkValidSection() == true){
document.getElementById('indicator').innerHTML = ' ';
var secDesc=FCKeditorAPI.GetInstance('secDesc').GetHTML();
var URL = "SectionFunc.php";
var data = getFormData("frm")+"&secDesc="+secDesc;
var result=ajaxLoad('get', URL, data, 'showResult');
document.getElementById('indicator').innerHTML = "";
alert(result);
showList4Section('1','');
//LeftMenu();
} else
return false;
}
function del4Section(secID) {
var URL = "SectionFunc.php";
var data = 'action=del4Section&secID='+secID;
document.getElementById('indicator').innerHTML = ' ';
var result=ajaxLoad('get', URL, data, 'showResult');
document.getElementById('indicator').innerHTML = "";
alert(result);
showList4Section('1','');
//LeftMenu();
}
//ปิด showList4Section
//MENU
function Menu() {
var URL = "MenuFunc.php";
var data = "";
ajaxLoad('get', URL, data, 'formDiv');
}
//=========================================================================================================//
function number_format( number, decimals, dec_point, thousands_sep ) {
var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
var d = dec_point == undefined ? "," : dec_point;
var t = thousands_sep == undefined ? "." : thousands_sep, s = n < 0 ? "-" : "";
var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
function openFree(url,w,h) {
win=window.open(url,'Display','resizable=yes,scrollbars=yes,toolbar=0,location=0,directories=0,menubar=0,width=' + w + ',height=' + h + '')
}
function Start(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=yes,menubar=no,location=no,scrollbars=yes,resize=yes");
}
function number_format( number, decimals, dec_point, thousands_sep ) {
// http://kevin.vanzonneveld.net
// + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfix by: Michael White (http://crestidg.com)
// + bugfix by: Benjamin Lupton
// + bugfix by: Allan Jensen (http://www.winternet.no)
// + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// * example 1: number_format(1234.5678, 2, '.', '');
// * returns 1: 1234.57
var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
var d = dec_point == undefined ? "," : dec_point;
var t = thousands_sep == undefined ? "." : thousands_sep, s = n < 0 ? "-" : "";
var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
function openFree(url,w,h) { win=window.open(url,'Display','resizable=yes,scrollbars=yes,toolbar=0,location=0,directories=0,menubar=0,width=' + w + ',height=' + h + '')
}
function Start(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=yes,menubar=no,location=no,scrollbars=yes,resize=yes");
}
function number_format( number, decimals, dec_point, thousands_sep ) {
// http://kevin.vanzonneveld.net
// + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfix by: Michael White (http://crestidg.com)
// + bugfix by: Benjamin Lupton
// + bugfix by: Allan Jensen (http://www.winternet.no)
// + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// * example 1: number_format(1234.5678, 2, '.', '');
// * returns 1: 1234.57
var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
var d = dec_point == undefined ? "," : dec_point;
var t = thousands_sep == undefined ? "." : thousands_sep, s = n < 0 ? "-" : "";
var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}
function validDate(obj){
date=obj.value
if (/[^\d/]|(\/\/)/g.test(date)) {obj.value=obj.value.replace(/[^\d/]/g,'');obj.value=obj.value.replace(/\/{2}/g,'/'); return }
if (/^\d{2}$/.test(date)){obj.value=obj.value+'/'; return }
if (/^\d{2}\/\d{2}$/.test(date)){obj.value=obj.value+'/'; return }
if (!/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(date)) return
test1=(/^\d{1,2}\/?\d{1,2}\/\d{4}$/.test(date))
date=date.split('/')
date[2]=date[2]-543;
d=new Date(date[2],date[1]-1,date[0])
test2=(1*date[0]==d.getDate() && 1*date[1]==(d.getMonth()+1) && 1*date[2]==d.getFullYear())
if (test1 && test2) return true
alert("กรุณาป้อนวันที่ให้ถูกต้อง วว/ดด/พ.ศ. เช่น 01/12/2520")
//obj.select();
obj.value="";
obj.focus()
return false
}
function IsValidTime(obj) {
timeStr=obj.value;
var times =new Array();
times[0]="";times[1]="";times[2]="";
times = timeStr.split('.');
if(times.length>3){
missinginfo += "\n - กรุณาป้อนเวลาให้ถูกต้อง Ex.8.30";
}else
{
if(times[0]<0 || times[0]>23){ alert(" ชั่วโมงต้องไม่เกิน 23 และมากกว่าหรือเท่ากับ 0");obj.value="";}
if(times.length>1 && (times[1]<0 || times[1]>59)){alert("นาทีต้องไม่เกิน 59 และมากกว่าหรือเท่ากับ 0");obj.value=times[0]; }
if(times.length==3 && (times[2]<0 || times[2]>59)){alert("วินาทีต้องไม่เกิน 59 และมากกว่าหรือเท่ากับ 0"); obj.value=times[0]+'.'+times[1];}
}
}
function CheckKeyCode()
{
if( (event.keyCode == 46 || event.keyCode == 190 || event.keyCode == 110 ||event.keyCode == 35 ||event.keyCode == 36
||event.keyCode == 8 || event.keyCode == 189 || event.keyCode == 109 || event.keyCode == 13 || event.keyCode == 9) ||
(event.keyCode >= 48 && event.keyCode <= 57) ||
(event.keyCode >= 96 && event.keyCode <= 105) ) {
return true }
else {
alert("Number Only");
return false
}
}
function checkAll(id)
{
elm=document.getElementsByTagName('input');
for(i=0; i