﻿
function BadgeName(c, fn, ln, bn)
{
    var chk = document.getElementById(c);
    var fname = document.getElementById(fn);
    var lname = document.getElementById(ln);
    var bname = document.getElementById(bn);

    if(chk != null && fname != null && lname != null && bname != null)
    {
        if(chk.checked == true)
        {
            var name = Trim(fname.value) + " " + Trim(lname.value);
            bname.value = Trim(name);
            bname.disabled = true;
        }
        else
        {
            bname.disabled = false;
            bname.parentNode.disabled = false;
        }     
    }
}


function validLogin()
{
    var valid = true;
    var email = Trim(document.getElementById('txtEmail').value);
    
    valid = showRequired(valid, 'txtEmail', 'spEmail', 0);
    if(email.length > 0 && !isValidEmail(email))
    {
        valid = false;
	    document.getElementById('spInvEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvEmail').style.display = "none";
	    
    valid = showRequired(valid, 'txtPass', 'spPass', 0);
  
    if(valid)
    {     
        document.frmCMMI.loginid.value="true";
	    document.frmCMMI.submit();
		   
//        var theform;
//        if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)   
//            theform = document.frmCMMI;  
//        else
//            theform = document.forms["frmCMMI"];  
//        
//        
//        if (!theform.onsubmit || (theform.onsubmit() != false)) 
//        {        
//            theform.__EVENTTARGET.value = '__Page';        
//            theform.__EVENTARGUMENT.value = 'Login';        
//            theform.submit();
//        }
    }
}

function validRegister()
{
    var valid = true;
    var email = Trim(document.getElementById('txtEmail').value);
    var cemail = Trim(document.getElementById('txtCEmail').value);
    
    valid = showRequired(valid, 'txtEmail', 'spEmail', 0);
    valid = showRequired(valid, 'txtCEmail', 'spCEmail', 0);
    
    if(email.length > 0 && !isValidEmail(email))
    {
        valid = false;
	    document.getElementById('spInvEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvEmail').style.display = "none";
	    
	if(cemail.length > 0 && !isValidEmail(cemail))
    {
        valid = false;
	    document.getElementById('spInvCEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvCEmail').style.display = "none";
    
    if(isValidEmail(email) && isValidEmail(cemail))
        valid = showMatching(valid, 'txtEmail', 'txtCEmail', 'spEmailMatch');
    
    valid = showRequired(valid, 'txtPass', 'spPass', 0);
    valid = showRequired(valid, 'txtCPass', 'spCPass', 0);
    valid = showMatching(valid, 'txtPass', 'txtCPass', 'spPassMatch');
    
    valid = showRequired(valid, 'txtFName', 'spFName', 0);
    valid = showRequired(valid, 'txtLName', 'spLName', 0);
    valid = showRequired(valid, 'txtCName', 'spCName', 0);
    valid = showRequired(valid, 'txtBadgeName', 'spBName', 0);
    
    valid = showRequired(valid, 'txtAddress1', 'spAddress1', 0);
    valid = showRequired(valid, 'txtCity', 'spCity', 0);
    valid = showRequired(valid, 'ddlState', 'spState', 1);
    valid = showRequired(valid, 'txtZip', 'spZip', 0);
    if(Trim(document.getElementById('txtZip').value).length > 0 && InvalidZip(Trim(document.getElementById('txtZip').value)))
    {
        valid = false;
	    document.getElementById('spInvZip').style.display = "inline";
        
    }
    else
	    document.getElementById('spInvZip').style.display = "none";
        
    valid = showPhoneNoExt(valid, 'txtPhoneArea','txtPhone3','txtPhone4','chkExt','txtPhoneExt', 'spPhone', 'spInvPhone');
    valid = showInvPhoneNo(valid, 'txtFaxArea','txtFax3','txtFax4', 'spInvFax');
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
      
//        var theform;
//        if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1)   
//            theform = document.frmCMMIReg;  
//        else
//            theform = document.forms["frmCMMIReg"];  
//        
//        if (!theform.onsubmit || (theform.onsubmit() != false)) 
//        {        
//            theform.__EVENTTARGET.value = '__Page';        
//            theform.__EVENTARGUMENT.value = 'RegisterUser';        
//            theform.submit();
//        }
    }
}


function validLoginHeader()
{
    var valid = true;
    var email = Trim(document.getElementById('Header1_txtHeaderEmail').value);
    
    valid = showRequired(valid, 'Header1_txtHeaderEmail', 'spHEmail', 0);
    if(email.length > 0 && !isValidEmail(email))
    {
        valid = false;
	    document.getElementById('spInvHEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvHEmail').style.display = "none";
	    
    valid = showRequired(valid, 'Header1_txtHeaderPass', 'spHPass', 0);
  
    if(valid)
    {     
        document.frmCMMI.hloginid.value="true";
	    document.frmCMMI.submit();
    }
    else
    {
	    document.getElementById('Header1_lblInvalidLogin').style.display="none";
    }
}

function validForgot()
{
    var valid = true;
    var email = Trim(document.getElementById('txtEmail').value);
    
    valid = showRequired(valid, 'txtEmail', 'spEmail', 0);
    if(email.length > 0 && !isValidEmail(email))
    {
        valid = false;
	    document.getElementById('spInvEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvEmail').style.display = "none";
  
    if(valid)
    {        
        document.frmCMMI.forgotid.value="true";
	    document.frmCMMI.submit();
    }
}

function selectSearch(td1,td2,blk,sp1,sp2,con,show,type)
{
    var search1 = document.getElementById(td1);
    var search2 = document.getElementById(td2);
    var span1 = document.getElementById(sp1);
    var span2 = document.getElementById(sp2);
    var blank = document.getElementById(blk);
    var content = document.getElementById(con);


    if(show == 0)
    {
        search1.className = "offtab";
        search2.className = "offtab";
        blank.className = "ontab_all";
        content.className = "hidecontent";
        
        span1.style.display = "none";
        span2.style.display = "none";
        
        if(type == 0)
            CourseList();
        else if(type == 1)
            CertificationList();
    }
    else if(show == 1)
    {
        if(search1.className == "offtab")
        {
            search1.className = "ontab";
            search2.className = "offtab";
            blank.className = "offtab_all";
            content.className = "searchcontent";
            
            span1.style.display = "inline";
            span2.style.display = "none";
            
            if(type == 0)
            {
                if(document.getElementById('ddlCourseTitle').selectedIndex != 0)
                    CourseListId();
                else
                    CourseListSubject()
            }
            else if(type == 1)
            {
                if(document.getElementById('ddlCourseTitle').selectedIndex != 0)
                    CertificationListId();
                else
                    CertificationListSubject()
            }
            
        }
        else
        {
            search1.className = "offtab";
            search2.className = "offtab";
            blank.className = "ontab_all";
            content.className = "hidecontent";
            
            span1.style.display = "none";
            span2.style.display = "none";
                
            if(type == 0)
                CourseList();
            else if(type == 1)
                CertificationList();
        }
    }
    else if(show == 2)
    {
        if(search2.className == "offtab")
        {
            search1.className = "offtab";
            search2.className = "ontab";
            blank.className = "offtab_all";
            content.className = "searchcontent";
            
            span1.style.display = "none";
            span2.style.display = "inline";
            
            if(type == 0)
                CourseListCityState();
            else if(type == 1)
                CertificationListCityState();
        }
        else
        {
            search1.className = "offtab";
            search2.className = "offtab";
            blank.className = "ontab_all";
            content.className = "hidecontent";
            
            span1.style.display = "none";
            span2.style.display = "none";
            
            if(type == 0)
                CourseList();
            else if(type == 1)
                CertificationList();
        }
    }
    else
    {
        search1.className = "offtab";
        search2.className = "offtab";
        blank.className = "ontab_all";
        content.className = "hidecontent";
        
        span1.style.display = "none";
        span2.style.display = "none";
        
        if(type == 0)
            CourseList();
        else if(type == 1)
            CertificationList();
    }    
}


function validUpdateProfile()
{
    var valid = true;
    var email = Trim(document.getElementById('txtEmail').value);
    var cemail = Trim(document.getElementById('txtCEmail').value);
    
    valid = showRequired(valid, 'txtEmail', 'spEmail', 0);
    valid = showRequired(valid, 'txtCEmail', 'spCEmail', 0);
    
    if(email.length > 0 && !isValidEmail(email))
    {
        valid = false;
	    document.getElementById('spInvEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvEmail').style.display = "none";
	    
	if(cemail.length > 0 && !isValidEmail(cemail))
    {
        valid = false;
	    document.getElementById('spInvCEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvCEmail').style.display = "none";
    
    if(isValidEmail(email) && isValidEmail(cemail))
        valid = showMatching(valid, 'txtEmail', 'txtCEmail', 'spEmailMatch');
    
    var pass = Trim(document.getElementById('txtPass').value);
    var cpass = Trim(document.getElementById('txtCPass').value);
    
    valid = showRequired(valid, 'txtOldPassword', 'spOPass', 0);
    
    if(pass.length > 0)
    {
        valid = showRequired(valid, 'txtCPass', 'spCPass', 0);
        valid = showMatching(valid, 'txtPass', 'txtCPass', 'spPassMatch');
    }
    
    valid = showRequired(valid, 'txtFName', 'spFName', 0);
    valid = showRequired(valid, 'txtLName', 'spLName', 0);
    valid = showRequired(valid, 'txtCName', 'spCName', 0);
    valid = showRequired(valid, 'txtBadgeName', 'spBName', 0);
    
    valid = showRequired(valid, 'txtAddress1', 'spAddress1', 0);
    valid = showRequired(valid, 'txtCity', 'spCity', 0);
    valid = showRequired(valid, 'ddlState', 'spState', 1);
    valid = showRequired(valid, 'txtZip', 'spZip', 0);
    if(Trim(document.getElementById('txtZip').value).length > 0 && InvalidZip(Trim(document.getElementById('txtZip').value)))
    {
        valid = false;
	    document.getElementById('spInvZip').style.display = "inline";
        
    }
    else
	    document.getElementById('spInvZip').style.display = "none";
        
    valid = showPhoneNoExt(valid, 'txtPhoneArea','txtPhone3','txtPhone4','chkExt','txtPhoneExt', 'spPhone', 'spInvPhone');
    valid = showInvPhoneNo(valid, 'txtFaxArea','txtFax3','txtFax4', 'spInvFax');
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}


function validAdminUpdateUser()
{
    var valid = true;
    var email = Trim(document.getElementById('txtEmail').value);
    
    valid = showRequired(valid, 'txtEmail', 'spEmail', 0);
    
    if(email.length > 0 && !isValidEmail(email))
    {
        valid = false;
	    document.getElementById('spInvEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvEmail').style.display = "none";
        
    valid = showRequired(valid, 'txtPassword', 'spPass', 0);
    
    valid = showRequired(valid, 'txtFName', 'spFName', 0);
    valid = showRequired(valid, 'txtLName', 'spLName', 0);
    valid = showRequired(valid, 'txtCName', 'spCName', 0);
    valid = showRequired(valid, 'txtBadgeName', 'spBName', 0);
    
    valid = showRequired(valid, 'txtAddress1', 'spAddress1', 0);
    valid = showRequired(valid, 'txtCity', 'spCity', 0);
    valid = showRequired(valid, 'ddlState', 'spState', 1);
    valid = showRequired(valid, 'txtZip', 'spZip', 0);
    if(Trim(document.getElementById('txtZip').value).length > 0 && InvalidZip(Trim(document.getElementById('txtZip').value)))
    {
        valid = false;
	    document.getElementById('spInvZip').style.display = "inline";
        
    }
    else
	    document.getElementById('spInvZip').style.display = "none";
        
    valid = showPhoneNoExt(valid, 'txtPhoneArea','txtPhone3','txtPhone4','chkExt','txtPhoneExt', 'spPhone', 'spInvPhone');
    valid = showInvPhoneNo(valid, 'txtFaxArea','txtFax3','txtFax4', 'spInvFax');
    
    valid = showRequired(valid, 'txtFailedLogins', 'spFailedLogins', 0);
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}


function validAdminUpdateCourse()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtCName', 'spCName', 0);
    
    valid = showRequired(valid, 'txtDesc', 'spDesc', 0);    
    valid = showRequired(valid, 'txtAudience', 'spAudience', 0);
    
    valid = showRequired(valid, 'txtCost', 'spCost', 0);
    
    var pcost = Trim(document.getElementById('txtPCost').value);
    var cost = Trim(document.getElementById('txtCost').value);
    
    if(pcost.length > 0)
    {
        if(!isMoney(pcost))
        {
            valid = false;
            document.getElementById('spInvPCost').style.display = "inline";        
        }
        else
        {
            document.getElementById('spInvPCost').style.display = "none";     
        }
    }
    
    if(cost.length > 0)
    {
        if(!isMoney(cost))
        {
            valid = false;
            document.getElementById('spInvCost').style.display = "inline";        
        }
        else
        {
            document.getElementById('spInvCost').style.display = "none";     
        }
    }
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}

function adminDeleteCourse(type,id)
{
    var blnRemove = false;
    
    if(type == 0)
        blnRemove = window.confirm("Are you sure you want to delete this course?");
    else if(type == 1)
        blnRemove = window.confirm("Are you sure you want to delete this certification?");
        
    if(blnRemove)
        location.href = "admin_deletecourse.aspx?type=" + type + "&id=" + id;

}

function TBD(c,f,t,sf,st)
{
    var chk = document.getElementById(c);
    var from = document.getElementById(f);
    var to = document.getElementById(t);
    var spanF = document.getElementById(sf);
    var spanT = document.getElementById(st);
    
    if(chk.checked == true)
    {
        from.value = "TBD";
        to.value = "TBD";
        spanF.style.display = "none";
        spanT.style.display = "none";        
    }
    else
    {
        if(from.value == "TBD")
            from.value = "";
        if(to.value == "TBD")
            to.value = "";
            
        spanF.style.display = "inline";
        spanT.style.display = "inline";
    }
}


function validAdminUpdateSchedule()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtFromDate', 'spFromDate', 0);
    valid = showRequired(valid, 'txtToDate', 'spToDate', 0);    
    valid = showRequired(valid, 'txtTime', 'spTime', 0);
    
    valid = showRequired(valid, 'txtAddress1', 'spAddress1', 0);
    valid = showRequired(valid, 'txtCity', 'spCity', 0);
    valid = showRequired(valid, 'ddlState', 'spState', 1);
    valid = showRequired(valid, 'txtZip', 'spZip', 0);
    if(Trim(document.getElementById('txtZip').value).length > 0 && InvalidZip(Trim(document.getElementById('txtZip').value)))
    {
        valid = false;
	    document.getElementById('spInvZip').style.display = "inline";
        
    }
    else
	    document.getElementById('spInvZip').style.display = "none";
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}

function validAdminSiteConstants()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtPayOptions', 'spPay', 0);
    valid = showRequired(valid, 'txtRefundPolicy', 'spRefund', 0);   
    
    valid = showRequired(valid, 'txtLoginTries', 'spLogins', 0);
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}

function adminDeleteSelect(select,id)
{
    var blnRemove = blnRemove = window.confirm("Are you sure you want to delete this item?");
    
    if(blnRemove)
        location.href = "admin_deleteselect.aspx?select=" + select + "&id=" + id;

}


function adminDeleteFreeStuff(id,type)
{
    var blnRemove = blnRemove = window.confirm("Are you sure you want to delete this document?");
    
    if(blnRemove)
        location.href = "admin_deletefreestuff.aspx?type=" + type + "&id=" + id;
}


function adminDeleteSeminar(id)
{
    var blnRemove = blnRemove = window.confirm("Are you sure you want to delete this seminar?");
    
    if(blnRemove)
        location.href = "admin_deleteseminar.aspx?id=" + id;
}


function validAdminUpdateSelect()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtName', 'spName', 0);
    
    if(document.getElementById('spSection').style.display == "inline")
    {
        valid = showRequired(valid, 'txtOrder', 'spOrder', 0);   
    }
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}

function validAdminUpdateFreeStuff()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtName', 'spName', 0);
    
    var span = document.getElementById('spPath');
    if(span.style.display == "inline")
    {
        var path = Trim(document.getElementById('txtPath').value);
        var upload = Trim(document.getElementById('filFileUpload').value);
        
        if(path.length == 0 && upload.length == 0)
            document.getElementById('spUpload').style.display = "inline";
        else
            document.getElementById('spUpload').style.display = "none";
    
    }
    else
    {
        valid = showRequired(valid, 'filFileUpload', 'spUpload', 0);    
    }
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}


function adminDeleteSeminar(id)
{
    var blnRemove = blnRemove = window.confirm("Are you sure you want to delete this seminar?");
    
    if(blnRemove)
        location.href = "admin_deleteseminar.aspx?id=" + id;

}


function validContact()
{
    var valid = true;
    var email = Trim(document.getElementById('txtEmail').value);
    
    valid = showRequired(valid, 'txtEmail', 'spEmail', 0);
    
    if(email.length > 0 && !isValidEmail(email))
    {
        valid = false;
	    document.getElementById('spInvEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvEmail').style.display = "none";
        
    valid = showRequired(valid, 'txtContact', 'spContact', 0);
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}


function validAdminUpdateFAQ()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtQuestion', 'spQuestion', 0);
    valid = showRequired(valid, 'txtAnswer', 'spAnswer', 0);   
    valid = showRequired(valid, 'txtOrder', 'spOrder',0);
        
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}

function adminDeleteFAQ(id)
{
    var blnRemove = blnRemove = window.confirm("Are you sure you want to delete this FAQ?");
    
    if(blnRemove)
        location.href = "admin_deletefaq.aspx?id=" + id;

}

function validAdminUpdateSIG()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtName', 'spName', 0);
    valid = showRequired(valid, 'txtURL', 'spURL', 0);   
        
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}

function adminDeleteSIG(id)
{
    var blnRemove = blnRemove = window.confirm("Are you sure you want to delete this group?");
    
    if(blnRemove)
        location.href = "admin_deletesig.aspx?id=" + id;

}

function adminDeleteNews(id)
{
    var blnRemove = blnRemove = window.confirm("Are you sure you want to delete this News item?");
    
    if(blnRemove)
        location.href = "admin_deletenews.aspx?id=" + id;

}



function adminDeleteItem(id, name, link)
{
    var blnRemove = blnRemove = window.confirm("Are you sure you want to delete this " + name + "?");
    
    if(blnRemove)
        location.href = link + "?id=" + id;

}


function adminDeleteSurveyQuestion(qid,sid,link)
{
    var blnRemove = blnRemove = window.confirm("Are you sure you want to delete this Survey Question?");
    
    if(blnRemove)
        location.href = link + "?id=" + qid + "&sid=" + sid;

}



function checkDownloadInfo()
{
    if(document.getElementById('panGetInfo') != null)
    {
        var button = document.getElementById('btnDownload');
        var valid = true;
        var email = Trim(document.getElementById('txtEmail').value);
        
        valid = showRequired(valid, 'txtName', 'spName', 0);var email = Trim(document.getElementById('txtEmail').value);
        valid = showRequired(valid, 'txtEmail', 'spEmail', 0);
        
        if(email.length > 0 && !isValidEmail(email))
        {
            valid = false;
	        document.getElementById('spInvEmail').style.display = "inline";
        }
        else
	        document.getElementById('spInvEmail').style.display = "none"; 
	        
        valid = showRequired(valid, 'txtCompany', 'spCompany',0);
            
        if(valid)
        {      
            button.disabled = false;
            button.parentNode.disabled = false;
        }
        else
        {
            button.disabled = true;
        }     
    }
}


function validPartner()
{
    var valid = true;
    var email = Trim(document.getElementById('txtEmail').value);
    
    valid = showRequired(valid, 'txtEmail', 'spEmail', 0);
    
    if(email.length > 0 && !isValidEmail(email))
    {
        valid = false;
	    document.getElementById('spInvEmail').style.display = "inline";
    }
    else
	    document.getElementById('spInvEmail').style.display = "none";
    
    valid = showRequired(valid, 'txtFName', 'spFName', 0);
    valid = showRequired(valid, 'txtLName', 'spLName', 0);
    valid = showRequired(valid, 'txtCName', 'spCName', 0);
    
    valid = showRequired(valid, 'txtAddress1', 'spAddress1', 0);
    valid = showRequired(valid, 'txtCity', 'spCity', 0);
    valid = showRequired(valid, 'ddlState', 'spState', 1);
    valid = showRequired(valid, 'txtZip', 'spZip', 0);
    if(Trim(document.getElementById('txtZip').value).length > 0 && InvalidZip(Trim(document.getElementById('txtZip').value)))
    {
        valid = false;
	    document.getElementById('spInvZip').style.display = "inline";
        
    }
    else
	    document.getElementById('spInvZip').style.display = "none";
        
    valid = showPhoneNoExt(valid, 'txtPhoneArea','txtPhone3','txtPhone4','chkExt','txtPhoneExt', 'spPhone', 'spInvPhone');
    valid = showPhoneNo(valid, 'txtPhoneArea','txtPhone3','txtPhone4','spCPhone', 'spInvCPhone');
    valid = showInvPhoneNo(valid, 'txtFaxArea','txtFax3','txtFax4', 'spInvFax');
    valid = showRequired(valid, 'txtWebsite', 'spWebsite', 0);
    valid = showRequired(valid, 'txtExperience', 'spExperience', 0);
    valid = showRequired(valid, 'txtInterest', 'spInterest', 0);
    var chk1 = document.getElementById('chkInterest1').checked;
    var chk2 = document.getElementById('chkInterest2').checked;
    var chk3 = document.getElementById('chkInterest3').checked;
    var chk4 = document.getElementById('chkInterest4').checked;
    
    if(!chk1 && !chk2 && !chk3 && !chk4)
    {
        valid = false;
        document.getElementById('spChkInterest').style.display = "inline";
    }
    else
        document.getElementById('spChkInterest').style.display = "none";
    
    var yes = document.getElementById('rbtnSEIPartnerY').checked;
    var no = document.getElementById('rbtnSEIPartnerN').checked;
    
    if(!yes && !no)
    {
        valid = false;
        document.getElementById('spSEIPartner').style.display = "inline";
    }
    else
        document.getElementById('spSEIPartner').style.display = "none";
    
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}

function validAdminUpdateNews()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtHeadline', 'spHeadline', 0);
        
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}

function validAdminUpdateSeminar()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtName', 'spName', 0);
    valid = showRequired(valid, 'txtDate', 'spDate', 0);
    valid = showRequired(valid, 'txtTime', 'spTime', 0);
        
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}

function validAdminUpdateBook()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtName', 'spName', 0);
        
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}


function validAdminUpdatePresenter()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtName', 'spName', 0);
        
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}


function validAdminUpdateTemplate()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtName', 'spName', 0);
    
    var span = document.getElementById('spPath');
    if(span.style.display == "inline")
    {
        var path = Trim(document.getElementById('txtPath').value);
        var upload = Trim(document.getElementById('filFileUpload').value);
        
        if(path.length == 0 && upload.length == 0)
            document.getElementById('spUpload').style.display = "inline";
        else
            document.getElementById('spUpload').style.display = "none";
    
    }
    else
    {
        valid = showRequired(valid, 'filFileUpload', 'spUpload', 0);    
    }
    
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}


function validSurvey()
{
    var valid = true;
    
    document.getElementById('spReq').style.display = "none";
    
    for(i=0; i<document.forms[0].elements.length; i++)
    {
        if(document.forms[0].elements[i].name.indexOf('txtbox') != -1)
        {
            if(Trim(document.forms[0].elements[i].value).length == 0)
            {
                document.getElementById('spReq').style.display = "inline";
                valid = false;
            }
        }
    }
    
    if(valid)
    {     
        document.frmCMMI.surveyid.value="true";
	    document.frmCMMI.submit();
    }
}


function validAdminUpdateSurvey()
{
    var valid = true;
    
    valid = showRequired(valid, 'txtName', 'spName', 0);
        
    if(valid)
    {      
        document.frmCMMI.regid.value="true";
		document.frmCMMI.submit();
    }
}
