﻿// JScript File

    function isValidPost(fm,n) {
        var an = fm.txtName.value;
        var ae = fm.txtEmail.value;
        var aq = fm.txtQuery.value;
        var qid = fm.queryID.value;
        
        var res = true;
        res = (res==true) ? chkFld(fm.txtName,"","Name Required !") : false;
        res = (res==true) ? chkEmail(fm.txtEmail,"1") : false;
        res = (res==true) ? chkFld(fm.txtQuery,"","Reply/Query Required !") : false;
                
        if(res==true) {
            if(n==1) {
                doCmd("replied","q1="+an+"&q2="+ae+"&q3="+aq+"&q4="+qid);
            } else {
                doCmd("newpost","q1="+an+"&q2="+ae+"&q3="+aq+"&q4="+qid);
            }
        }
        return false;
    }

    function isValidPostCategory(fm,n) {
        var an = fm.txtName.value;

        var res = true;
        res = (res==true) ? chkFld(fm.txtName,"","Category Name Required !") : false;
                
        if(res==true) {
            doCmd("createcatg","q1="+an);
        }
        return false;
    }    
    
    function setFocus() {
        try {
            var d = document.forms[0].elements['txtName'];
            if(d.value=="")
                d.focus();
        } catch(e) {}            
    }
    
    function isValidPostCountry(th) {
        var cn = th.selCnty.value;
        var cn1 = th.selCnty.options[th.selCnty.selectedIndex].text;
        var d = new Date("December 31, 2010");
        var cd = d.toString();
        document.cookie = "country="+cn+"; expires="+cd;
        doCmd("gotocnty","q1="+cn+"&q2="+cn1);        
    }
