// JavaScript Document
function check_attached_files(ob)
{

        // FUNCTION IS USED FOR ATTACHED FILES TO THE ANNOUNCEMENT

        good_ext = true;

// var allowedExt = ['gif', 'jpg', 'doc', 'xls', 'pdf', 'txt', 'peg','.qt','tml','isf','pub'];
// extension 'peg' stands for 'jpeg' since we take only get the last 3 characters of the file

for (var i = 0; i < ob["file[]"].length; i++)
{
        if(ob["file[]"][i].value != "")
        {
                var imgName = ob["file[]"][i].value;
                imgName = imgName.toLowerCase();


                if ((ob["file[]"][i].value) && ((imgName.lastIndexOf(".trojan")> 0)
                || (imgName.lastIndexOf(".scr")>0)
                || (imgName.lastIndexOf(".vbs")>0)
                || (imgName.lastIndexOf(".pif")>0)
                || (imgName.lastIndexOf(".hta")>0)
                || (imgName.lastIndexOf(".reg")>0)
                || (imgName.lastIndexOf(".bat")>0)
                || (imgName.lastIndexOf(".exe")>0)
                || (imgName.lastIndexOf(".cgi")>0)
                || (imgName.lastIndexOf(".shtml")>0)
                || (imgName.lastIndexOf(".pl")>0)
                || (imgName.lastIndexOf(".php")>0))) {

                alert("The system administrator has determined the attachment type you are uploading is not valid. You may not upload attachments of the following type:\n\n.trojan\n.src\n.vbs\n.pif\n.hta\n.reg\n.bat\n.exe\n.cgi\n.shtml\n.php\n.pl");
                        good_ext = false;
                        return false;
                        break;
                }
        }
}
 return true;

}


function check_image_ext(ob)
{

        // FUNCTION IS USED FOR THE IMAGE ATTACHED TO THE ANNOUNCEMENT


  var allowed = new Array("jpg", "jpeg", "gif", "png");
  var reg = new RegExp("\.("+allowed.join("|")+")", "i");

  var test_info = ob.img.value.toLowerCase();
                if(!reg.test(test_info))
                {
                        alert("Your image is not a proper image file.  The only image files allowed are \n\n.jpg\n.gif\n.png\n");
                        return false;
                }
                else
                        return true;
}

function uname_focus()
{
                document.login.uname.focus();
}

function delete_school_closing()
{
        var msg;
        msg = confirm("Are you sure you want to remove this school closing?");

        if(!msg)
        {

                return false;
        }

        return true;
}

function check_PorS_message(formname)
{
        if(formname.message.value == "")
        {
                alert("Please fill in a message before submitting.");
                formname.message.focus();
                return false;
        }

        disable_submit(formname);

        return true;
}

function check_add_department_page(formname)
{
        if(formname.title.value == "")
        {
                alert("Please fill in a page title before submitting.");
                formname.title.focus();
                return false;
        }

        if(formname.lname.value == "")
        {
                alert("Please fill in a link name before submitting.");
                formname.lname.focus();
                return false;
        }
        disable_submit(formname);

        return true;
}

/*
function change_sub_name()
{
        if (document.getElementById)
        {
                if(document.school_closing.ddelete.checked)
                {
                        document.getElementById("sub_button").value = "Delete";
                }

                else
                {
                        document.getElementById("sub_button").value = "Preview";
                }
        }
        else if (document.all)
        {
                if(document.school_closing.ddelete.checked)
                {
                        document.all("sub_button").value = "Delete";
                }

                else
                {
                        document.all("sub_button").value = "Preview";
                }
        }
        return true;

}
*/

function verify_closings2(formname)
{
        if(formname.ddelete.checked)
        {
                var cnf = confirm("Are you sure you want to delete this school closing");
                if(!cnf)
                {
                        return false;
                }
        }

        if(formname.message.value == "")
        {
                alert("Please give this school closing a message before submitting.");
                formname.message.focus();
                return false;
        }

        var bdate = checkDate(formname.bmonth.options[formname.bmonth.selectedIndex].value,formname.bday.options[formname.bday.selectedIndex].value,formname.byear.options[formname.byear.selectedIndex].value,'Start Message');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formname.bmonth.focus();
                return false;
        }
        var edate = checkDate(formname.emonth.options[formname.emonth.selectedIndex].value,formname.eday.options[formname.eday.selectedIndex].value,formname.eyear.options[formname.eyear.selectedIndex].value,'End Message');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formname.emonth.focus();
                return false;
        }





        disable_submit(formname);

        return true;
}


function verify_closings(formname)
{


        if(formname.message.value == "")
        {
                alert("Please give this school closing a message before submitting.");
                formname.message.focus();
                return false;
        }

        var bdate = checkDate(formname.bmonth.options[formname.bmonth.selectedIndex].value,formname.bday.options[formname.bday.selectedIndex].value,formname.byear.options[formname.byear.selectedIndex].value,'Start Message');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formname.bmonth.focus();
                return false;
        }
        var edate = checkDate(formname.emonth.options[formname.emonth.selectedIndex].value,formname.eday.options[formname.eday.selectedIndex].value,formname.eyear.options[formname.eyear.selectedIndex].value,'End Message');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formname.emonth.focus();
                return false;
        }





        disable_submit(formname);

        return true;
}

function check_privilege(formname)
{
                if(formname.remove_user.checked)
                {
                        var msg;
                        msg = confirm("Are you sure you want to remove this user from the system?");

                        if(!msg)
                        {
                                formname.remove_user.checked = false;
                                return false;
                        }
                        else
                        {
                                var removeuser = true;
                        }
                }

                if(formname.verify_pass.value == "")
                {
                        alert("Please type in your password before submitting the new privileges.");
                        formname.verify_pass.focus();
                        return false;
                }

                if(!removeuser)
                {
                        if(formname.superuser.checked)
                        {
                                var msg;
                                msg = confirm("Are you sure you want to make this user a super user?");

                                if(!msg)
                                {
                                        formname.superuser.checked = false;
                                        return false;
                                }
                        }
                }


        disable_submit(formname);

        return true;
}

function verify_event_type(formname)
{
                if(formname.title.value == "")
                {
                        alert("Please fill an a title for this event type before submitting.");
                        formname.title.focus();
                        return false;
                }

        disable_submit(formname);

        return true;
}

function check_add_user(formname)
{
        if(formname.uname.value == "")
        {
                alert("Please fill in the username before submitting.");
                formname.uname.focus();
                return false;
        }

        disable_submit(formname);

        return true;
}

function check_change_passwd(formname)
{
        if(formname.passwd.value == "")
        {
                alert("Please fill in the password before submitting.");
                formname.passwd.focus();
                return false;
        }

        if(formname.repasswd.value == "")
        {
                alert("Please retype password before submitting.");
                formname.repasswd.focus();
                return false;
        }

        if(formname.repasswd.value != formname.passwd.value)
        {
                alert("The password fields do not match.  Please retype both.");
                formname.passwd.value = "";
                formname.repasswd.value = "";
                formname.passwd.focus();
                return false;
        }

        if(formname.passwd.value == "lcjvs")
        {
                alert("Your password must be something different than 'lcjvs'.");
                formname.passwd.value = "";
                formname.repasswd.value = "";
                formname.passwd.focus();
                return false;
        }

        disable_submit(formname);

        return true;
}

function submit_this(formname,school,date)
{
        top.location = "/"+school+"/calendar/"+date+"/"+formname+"/";
        return true;
}


function check_wmessage(formname)
{

        disable_submit(formname);

        return true;
}

function check_receive_email(formname)
{
        if(formname.email.value == "Your Email Address")
        {
                alert("Please fill in your e-mail address before submitting this form.");
                formname.email.focus();
                return false;
        }

        if(formname.email_name.value == "Your Name")
        {
                alert("Please fill in your name before submitting this form.");
                formname.email_name.focus();
                return false;
        }


        if(!checkMail(formname))
        {
                alert("Please fill in a proper e-mail address");
                formname.email.focus();
                return false;
        }

        disable_submit(formname);

        return true;
}


function verifiy_announcements(formobject)
{
var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Begin');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        if (formobject.emonth && formobject.eday && formobject.eyear) {
            var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'End');
            //alert(edate);
            if (!edate) {
                    //alert("The date entered for the End Date is not valid.");
                    formobject.emonth.focus();
                    return false;
            }
        }
        
        if (formobject.title.value == "") {
                alert("The announcement title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The announcement details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

        if(formobject.img.value != ""){
        if(!check_image_ext(formobject))
                return false;
        }

        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;
}

function verifiy_class_notes(formobject)
{
var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Begin');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'End');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The class note's title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The class note's description must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

        if(formobject.img.value != ""){
        if(!check_image_ext(formobject))
                return false;
        }

        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;
}


function verifiy_job(formobject)
{
var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Release');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The job position title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The job position details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

        if (formobject.skills.value == "") {
                alert("The job position skills must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

        disable_submit(formobject);

        return true;
}

function verifiy_address_book(formobject)
{
var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Release');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The email list's name must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        disable_submit(formobject);

        return true;
}


function verifiy_sub_categories(formname)
{
        if(formname.name.value == "")
        {
                alert("Please fill in a name for your sub-category before submitting the form.");
                formname.name.focus();
                return false;
        }

        disable_submit(formname);

        return true;
}


function verifiy_links_of_interest(formobject)
{
var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Release');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'End');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        if ((formobject.author.value == "") || (formobject.author.value == "http://")) {
                alert("The web address must be filled in before submitting.");
                formobject.author.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The description must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

                 if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }





        disable_submit(formobject);

        return true;
}

function verifiy_content_links(formobject)
{



        if ((formobject.author.value == "") || (formobject.author.value == "http://")) {
                alert("The web address must be filled in before submitting.");
                formobject.author.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The description must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }



        disable_submit(formobject);

        return true;
}

function check_department_edit(formname)
{
        if (formname.title.value == "") {
                alert("The department name must be filled in before submitting.");
                formname.title.focus();
                return false;
        }
        if (formname.lname.value == "") {
                alert("The Leader's name must be filled in before submitting.");
                formname.lname.focus();
                return false;
        }

                if (formname.ltitle.value == "") {
                alert("The Leader's title must be filled in before submitting.");
                formname.ltitle.focus();
                return false;
        }
        disable_submit(formname);

        return true;
}

function verifiy_content_links_mod(formobject)
{

                if(formobject.deleted.checked)
                {
                        var msg;
                        msg = confirm("Are you sure you want to delete this page?");

                        if(!msg)
                        {
                                return false
                        }
                }

                if(!msg)
                {


        if ((formobject.author.value == "") || (formobject.author.value == "http://")) {
                alert("The web address must be filled in before submitting.");
                formobject.author.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The description must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }


                }
        disable_submit(formobject);

        return true;
}


function verifiy_content_text_mod(formobject)
{

                if(formobject.deleted.checked)
                {
                        var msg;
                        msg = confirm("Are you sure you want to delete this page?");

                        if(!msg)
                        {
                                return false
                        }
                }

                if(!msg)
                {



        if (formobject.description.value == "") {
                alert("The description must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }


                }
        disable_submit(formobject);

        return true;
}

function verifiy_content_text(formobject)
{

        if (formobject.description.value == "") {
                alert("The description must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }



        disable_submit(formobject);

        return true;
}





function verifiy_employee_links(formobject)
{
var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Release');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        if ((formobject.author.value == "") || (formobject.author.value == "http://")) {
                alert("The web address must be filled in before submitting.");
                formobject.author.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The description must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

        disable_submit(formobject);

        return true;
}


function verifiy_book_lists(formobject)
{

        var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Begin');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The book title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The book details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

                 if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }


        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;

}

function verifiy_online_activities(formobject)
{

        var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Release');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The activity title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The activity details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }
                      if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }





        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;

}

function verifiy_homework(formobject)
{

        var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Release');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        var ddate = checkDate(formobject.dmonth.options[formobject.dmonth.selectedIndex].value,formobject.dday.options[formobject.dday.selectedIndex].value,formobject.dyear.options[formobject.dyear.selectedIndex].value,'Due');
        //alert(edate);
        if (!ddate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.dmonth.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The homework title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The homework details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

         if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }





        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject)){
                return false;
                }
        }

        disable_submit(formobject);

        return true;

}

function verifiy_class_projects(formobject)
{

        var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Begin');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        var ddate = checkDate(formobject.dmonth.options[formobject.dmonth.selectedIndex].value,formobject.dday.options[formobject.dday.selectedIndex].value,formobject.dyear.options[formobject.dyear.selectedIndex].value,'Due');
        //alert(edate);
        if (!ddate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.dmonth.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The project title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The project details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

        if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }





        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;

}

function verifiy_multimedia_files(formobject)
{

        var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Begin');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }


        if (formobject.title.value == "") {
                alert("The file title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The file details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }
                      if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }





        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;

}

function verifiy_supply_list(formobject)
{

        var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Begin');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }


        if (formobject.title.value == "") {
                alert("The title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The supplies details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

                 if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }





        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;

}

function verifiy_faqs(formobject)
{

        var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Release');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }


        if (formobject.title.value == "") {
                alert("The question must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The answer must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }
          if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }





        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;

}

function verifiy_handouts(formobject)
{

        var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Begin');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }


        if (formobject.title.value == "") {
                alert("The handout title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The handout details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }
                 if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }





        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;

}

function verifiy_important_reminders(formobject)
{

        var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Release');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'Archive');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        var ddate = checkDate(formobject.dmonth.options[formobject.dmonth.selectedIndex].value,formobject.dday.options[formobject.dday.selectedIndex].value,formobject.dyear.options[formobject.dyear.selectedIndex].value,'Due');
        //alert(edate);
        if (!ddate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.dmonth.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The reminder title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The reminder details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

        if (formobject.img.value) {

         if (!check_image_ext(formobject)) {
         return false;
         }
         }






        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;

}

function verifiy_job_postings(formobject)
{
var bdate = checkDate(formobject.bmonth.options[formobject.bmonth.selectedIndex].value,formobject.bday.options[formobject.bday.selectedIndex].value,formobject.byear.options[formobject.byear.selectedIndex].value,'Begin');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formobject.bmonth.focus();
                return false;
        }
        var edate = checkDate(formobject.emonth.options[formobject.emonth.selectedIndex].value,formobject.eday.options[formobject.eday.selectedIndex].value,formobject.eyear.options[formobject.eyear.selectedIndex].value,'End');
        //alert(edate);
        if (!edate) {
                //alert("The date entered for the End Date is not valid.");
                formobject.emonth.focus();
                return false;
        }

        if (formobject.title.value == "") {
                alert("The job posting title must be filled in before submitting.");
                formobject.title.focus();
                return false;
        }

        if (formobject.description.value == "") {
                alert("The job posting details must be filled in before submitting.");
                formobject.description.focus();
                return false;
        }

        if(formobject.img.value != ""){
        if(!check_image_ext(formobject))
                return false;
        }

        if(formobject["file[]"].length > 0)
          {
        if(!check_attached_files(formobject))
                return false;
        }

        disable_submit(formobject);

        return true;
}

function check_update(formname)
{

        if(formname.fname.value == "")
        {
                alert("Please fill in your first name before submitting the form.");
                formname.fname.focus();
                return false;
        }
        if(formname.lname.value == "")
        {
                alert("Please fill in your last name before submitting the form.");
                formname.lname.focus();
                return false;
        }

        if(formname.email.value == "")
        {
                alert("Please fill in your e-mail address before submitting the form.");
                formname.email.focus();
                return false;
        }

        //if(!checkMail(formname))
        //{
        //        alert("Please fill in a proper e-mail address");
        //        formname.email.focus();
        //        return false;
        //}

        disable_submit(formname);

        return true;
}

function check_add_website(formname)
{



        if(formname.class_title.value == "")
        {
                alert("Please fill in a subject name before submitting the form.");
                formname.class_title.focus();
                return false;
        }

         for (var i = 0; i < formname["subsection[]"].length; i++)
         {
                if(formname["subsection[]"][i].checked)
                {
                        var one_checked = true;
                }
        }



        if(!one_checked)
        {
                alert("Please select one of the elements before adding a website.");
                return false;
        }


        disable_submit(formname);

        return true;

}

function check_welcome(formname)
{
        disable_submit(formname);

        return true;
}

function check_welcome2(formname)
{
        disable_submit(formname);

        return true;
}

function checkMail(formname)
{
        var x = formname.email.value;
        var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        return filter.test(x);
}

function confirm_remove_class(formname)
{
        var answer = "";
        answer = confirm("Are you sure you want to delete this website and all of its content?");

        if(answer){
                disable_submit(formname);
                return true;
        }
        else{
                return false;
        }
}

function confirm_delete_subcategory()
{
        var answer = "";
        answer = confirm("Are you sure you want to remove this subcategory and all of its content?");

        if(answer){
                return true;
        }
        else{
                return false;
        }
}

function confirm_hide_subcategory()
{
        var answer = "";
        answer = confirm("Are you sure you want to hide this subcategory and all of its content?");

        if(answer){
                return true;
        }
        else{
                return false;
        }
}




function confirm_reactivate()
{
        var answer = "";
        answer = confirm("Are you sure you want to activate this archived website?");

        if(answer){
                return true;
        }
        else{
                return false;
        }
}

function disable_submit(formname)
{
        formname.sub_button.disabled = true;
}



function checkDate(SM,SD,SY,msg) {


  // check to make sure that selected date is valid


        //  var SM = document.dateForm.bmonth.selectedIndex;
         // var SD = document.dateForm.bday.selectedIndex;
         // var SY = document.dateForm.byear.selectedIndex;

                SM = (SM*1)-1;
                SD = (SD*1)-1;

                //alert("SM = "+SM +" SD= "+SD+ " SY= "+SY);

          // check months with only 30 days - January starts at 0
         if (((SM == 3) || (SM == 5) || (SM == 8) || (SM == 10)) && (SD == 30)) {
                errorMsg = "Incorrect date entered. ";
                errorMsg = errorMsg + msg;
                errorMsg = errorMsg + " month only has 30 days."
                alert(errorMsg);
                return false;
          }

          // check February on leap years (only 29 days)
          var leapyear = false;
          var i = parseInt(SY);

          // check for leapyear - Any year divisible by 4, except those divisible by 100 (but NOT 400)
          if ( (Math.floor(i/4) == (i/4)) && ((Math.floor(i/100) != (i/100)) || (Math.floor(i/400) == (i/400))) )
                leapyear = true;
          else
                leapyear = false;

          if ( leapyear && (SM == 1) && (SD > 28) ){
                  errorMsg = "Incorrect date entered.  February only has 29 days.";
                  //errorMsg = errorMsg + formname.year.options[SY].value;
                  alert(errorMsg);
                  return false;
                }

          // check February for all other years (only 28 days)
          if ( (SM == 1) && (SD > 27) && (leapyear == false) ) {
                errorMsg = "Incorrect date entered.  February only has 28 days.";
                //errorMsg = errorMsg + formname.year.options[SY].value;
                alert(errorMsg);
                return false;
          }


          // to make the date form and this JavaScript function work with a CGI script
          // delete the subsequent alert line, and change the return value from false
          // to return true

         // alert("This would submit the form.  Please check the Javascript source and comments");
          return (1);
}

function check_edit_website2(formname)
{

                if(formname.class_title.value == "")
                {
                        alert("Please fill in a title for this class before submitting.");
                        formname.class_title.focus();
                        return false;
                }

        disable_submit(formname);

        return true;
}

function confirm_kill()
{
        var answer = "";
        answer = confirm("Are you sure you want to take away this element and all of its content?\n\n");

        return answer;
}

function toggleLayer(whichLayer)
{
        if (document.getElementById)
        {
                // this is the way the standards work
                var style2 = document.getElementById(whichLayer).style;
                style2.display = style2.display ? "":"block";
        }
        else if (document.all)
        {
                // this is the way old msie versions work
                var style2 = document.all[whichLayer].style;
                style2.display = style2.display ? "":"block";
        }
        else if (document.layers)
        {
                // this is the way nn4 works
                var style2 = document.layers[whichLayer].style;
                style2.display = style2.display ? "":"block";
        }
}

function verify_update_email(formname)
{
        if(formname.from.value == "")
        {
                alert("Please fill in the 'From' part of this form before submitting.");
                formname.from.focus();
                return false;
        }
        var emaill = formname.from.value;
        var atsign = emaill.substring(0,emaill.lastIndexOf('@')+1);
        var domain = emaill.substring(atsign.length,emaill.length+1);

        if(domain.toLowerCase() != "lcjvs.net")
        {
                alert("Sorry, but only e-mail addresses with the domain 'lcjvs.net' are valid for sending an update.");
                formname.from.focus();
                return false;
        }

        if(formname.subject.value == "")
        {
                alert("Please fill in the 'Subject' part of this form before submitting.");
                formname.subject.focus();
                return false;
        }



        disable_submit(formname);

return true;
}

function verify_edit_email_list(formname)
{
                if(formname.student_name.value == "")
                {
                                alert("Please fill in the student's name before submitting.");
                                formname.student_name.focus();
                                return false;
                }

                if(formname.subscriber_name.value == "")
                {
                                alert("Please fill in the subscriber's name before submitting.");
                                formname.subscriber_name.focus();
                                return false;
                }
                if(formname.email.value == "")
                {
                                alert("Please fill in an email for this student before submitting.");
                                formname.email.focus();
                                return false;
                }

                if(!checkMail(formname))
                {
                        alert("Please fill in a proper e-mail address");
                        formname.email.focus();
                        return false;
                }

                if(formname.delete1.checked == true)
                {
                        var answer = confirm("Are you sure you want to remove this student from the e-mail list?");
                }

                if(!answer){
                        return false;
                }

        disable_submit(formname);

        return true;
}

function set_todays_date()
{

                var t = new Date;

                var newdate = "";
                var newmonth = "";

                var thismonth = t.getMonth()+1;

                if(t.getDate() < 10)
                {
                        newdate = "0"+t.getDate();
                }
                else
                {
                        newdate = t.getDate();
                }

                if(thismonth < 10)
                {
                        newmonth = "0"+thismonth;
                }
                else
                {
                        newmonth = thismonth;
                }

                sd_announcement.bday.value = newdate;
                sd_announcement.bmonth.value = newmonth;
                sd_announcement.byear.value = t.getFullYear();

}

function set_todays_date_archived()
{

                var t = new Date;

                var newdate = "";
                var newmonth = "";

                var thismonth = t.getMonth()+1;

                if(t.getDate() < 10)
                {
                        newdate = "0"+t.getDate();
                }
                else
                {
                        newdate = t.getDate();
                }

                if(thismonth < 10)
                {
                        newmonth = "0"+thismonth;
                }
                else
                {
                        newmonth = thismonth;
                }

                sd_announcement.eday.value = newdate;
                sd_announcement.emonth.value = newmonth;
                sd_announcement.eyear.value = t.getFullYear();

}

function show_selected_schools()
{

                var style2 = document.getElementById("selected_schools").style;
                var checkbox = document.getElementById("show_selected_schools1").checked;

                if(checkbox)
                {
                                style2.display = style2.display = "block";
                }
                else
                {
                        style2.display = style2.display = "none";

                        for (var i = 0; i < document.add_calendar_event.selected_schools_checkboxes.length; i++)
                         {
                                document.add_calendar_event.selected_schools_checkboxes[i].checked=false;
                        }
                }

}

function show_selected_schools_w_date()
{

                var style2 = document.getElementById("selected_schools").style;
                var checkbox = document.getElementById("show_selected_schools1").checked;

                if(checkbox)
                {
                                style2.display = style2.display = "block";
                }
                else
                {
                        style2.display = style2.display = "none";

                        for (var i = 0; i < document.sd_announcement.selected_schools_checkboxes.length; i++)
                         {
                                document.sd_announcement.selected_schools_checkboxes[i].checked=false;
                        }
                }

}


function verify_calendar(formname)
{
                if(formname.title.value == "")
                {
                                alert("Please fill in the title of the event before submitting.");
                                formname.title.focus();
                                return false;
                }

                if(formname.description.value == "")
                {
                                alert("Please fill in the description before submitting.");
                                formname.description.focus();
                                return false;
                }
                var bdate = checkDate(formname.bmonth.options[formname.bmonth.selectedIndex].value,formname.bday.options[formname.bday.selectedIndex].value,formname.byear.options[formname.byear.selectedIndex].value,'Event');

        if (!bdate) {
                //alert("The date entered for the Begin Date is not valid.");
                formname.bmonth.focus();
                return false;
        }

        if((formname.used_for_district_only.checked == false) && (formname.used_for_all_schools.checked == false) && (formname.used_for_selected_schools.checked == false))
        {
                alert("Please select what this announcement will be used for before submitting.");
                return false;
        }

        if((formname.used_for_all_schools.checked == true) && (formname.used_for_selected_schools.checked == true))
        {
                alert("You can't have 'All Schools' and 'Selected Schools' checked.  Only one or the other is allowed.");
                return false;
        }

        if(formname.used_for_selected_schools.checked == true)
        {
                 for (var i = 0; i < formname["selected_schools[]"].length; i++)
                 {
                        if(formname["selected_schools[]"][i].checked)
                        {
                                var one_checked = true;
                        }
                }
                if(!one_checked)
                {
                        alert("Please select one of the schools before submitting.");
                        return false;
                }

        }




                if(formname.v_venue_name.value != "")
                {

                                if(formname.v_address.value == "")
                                {
                                alert("Please fill in the address for the venue before submitting.");
                                formname.v_address.focus();
                                return false;
                                }

                                if(formname.v_city.value == "")
                                {
                                alert("Please fill in the city for the venue before submitting.");
                                formname.v_city.focus();
                                return false;
                                }

                                if(formname.v_state.value == "")
                                {
                                alert("Please fill in the state for the venue before submitting.");
                                formname.v_state.focus();
                                return false;
                                }

                                if(formname.v_zip.value == "")
                                {
                                alert("Please fill in the zip code for the venue before submitting.");
                                formname.v_zip.focus();
                                return false;
                                }
                                if(formname.v_phone.value == "")
                                {
                                alert("Please fill in the phone number for the venue before submitting.");
                                formname.v_phone.focus();
                                return false;
                                }

                                if(formname.venue_description.value == "")
                                {
                                alert("Please fill in the description for the venue before submitting.");
                                formname.venue_description.focus();
                                return false;
                                }
                }

        disable_submit(formname);

        return true;
}

// Clipart Functions
function popup_clipart()
{
var top = window.height/2;
var left = window.width/2;

window.open('/clipart.php','clipart','width=720,height=520,top=200,left=300,statusbar=no,scrollbars=yes,resizeable=yes');
}

function imgpath(c)
{
        var thedoc = (arguments.length>1)?arguments[1]:window.document;
        var d = thedoc.getElementById("img");
        d.value = c;

}
// End of Clipart


// ----- START OF ATTACHING ANOTHER FILE ---- \\



// JavaScript Document
//var max = 1000; // maximum # of attachments allowed
var currentUploads = 0; // current # of attachment sections on the web page
var nameDesc = 'desc'; // Name property for the Description Input field
var nameFile = 'file'; // Name property for the File Input field
var scrollPosVert = 0; // stores the current scroll position on the form
// for some reason when a div is taken out, the form
// will scroll to the top on both Firefox and IE

// SCROLL FUNCTIONS
function saveScrollPos(offset)
{
scrollPosVert=(document.all)?document.body.scrollTop:window.pageYOffset-offset;
}

function setScrollPos()
{
window.scrollTo(0, scrollPosVert);
setTimeout('window.scrollTo(0, scrollPosVert)',1);
}




// This function adds a new attachment section to the form
// It is called when the user clicks the "Attach a file" button...
// It takes three arguments:
// maxUploads - the maximum number of attachments allowed
// descFieldName - the field name for the Description Input field
// fileFieldName - the field name for the File Input field
function addUpload(descFieldName, fileFieldName)
{
nameDesc=descFieldName;
nameFile=fileFieldName;
//max = Number(maxUploads);

currentUploads++;
//if (currentUploads>max) return;

if (currentUploads>0)
document.getElementById('addupload').childNodes[0].data='Attach another file';

//if (currentUploads==max) document.getElementById('addupload').style.visibility='hidden';


// First, clone the hidden attachment section
var newFields = document.getElementById('attachment').cloneNode(true);
newFields.id = '';

// Make the new attachments section visible
newFields.style.display = 'block';


// loop through tags in the new Attachment section
// and set ID and NAME properties
//
// NOTE: the control names for the Description Input
// field and the file input field are created
// by appending the currentUploads variable
// value to the nameFile and nameDesc values
// respectively
//
// In terms of Xaraya, this means you'll need to name your
// DD properties will need names like the following:
// "AttachmentDesc1"
// "AttachmentFile1"
// "AttachmentDesc2"
// "AttachmentFile2"
// "AttachmentDesc3"
// "AttachmentFile3"
// et cetera...

var newField = newFields.childNodes;
for (var i=0;i<newField.length;i++)
{
if (newField[i].name==nameFile)
{
newField[i].id=nameFile+currentUploads;
newField[i].name=nameFile+currentUploads;
}

if (newField[i].name==nameDesc)
{
newField[i].id=nameDesc+currentUploads;
newField[i].name=nameDesc+currentUploads;
}
if (newField[i].id=='dropcap')
{
newField[i].id='dropcap'+currentUploads;
newField[i].childNodes[0].data=currentUploads;
}
}


// Insert our new Attachment section into the Attachments Div
// on the form...
var insertHere = document.getElementById('attachmentmarker');
insertHere.parentNode.insertBefore(newFields,insertHere);
}





// This function removes an attachment from the form
// and updates the ID and Name properties of all other
// Attachment sections
function removeFile(container, item)
{
// get the ID number of the upload section to remove
var tmp = item.getElementsByTagName('input')[0];
var basefieldname = '';
if (tmp.type=='text') basefieldname = nameDesc; else basefieldname = nameFile;


var iRemove=Number(tmp.id.substring(basefieldname.length, tmp.id.length));

// Shift all INPUT field IDs and NAMEs down by one (for fields with a
// higher ID than the one being removed)
var x = document.getElementById('attachments').getElementsByTagName('input');
for (i=0;i<x.length;i++)
{
if (x[i].type=='text') basefieldname=nameDesc; else basefieldname=nameFile;

var iEdit = Number(x[i].id.substring(basefieldname.length, x[i].id.length));
if (iEdit>iRemove)
{
x[i].id=basefieldname+(iEdit-1);
x[i].name=basefieldname+(iEdit-1);
}
}

// Run through all the DropCap divs (the number to the right of the attachment
// section) and update that number...
x=document.getElementById('attachments').getElementsByTagName('div');
for (i=0;i<x.length;i++)
{
// Verify this is actually the "dropcap" div
if (x[i].id.substring(0, String('dropcap').length)=='dropcap')
{
ID = Number(x[i].id.substring(String('dropcap').length, x[i].id.length));

// check to see if current attachment had a higher ID than the one we're
// removing (and thus needs to have its ID dropped)
if (ID>iRemove)
{
x[i].id='dropcap'+(ID-1);
x[i].childNodes[0].data=(ID-1);
}
}
}

currentUploads--;
saveScrollPos(0);
container.removeChild(item);
setScrollPos();
document.getElementById('addupload').style.visibility='visible';
if (currentUploads==0)
document.getElementById('addupload').childNodes[0].data='Attach a file';

}

// ----- END OF ATTACHING ANOTHER FILE ---- \\


// ----- COLOR PICKER  --- \\\
function popup(input_name)
{
window.open('/libraries/color_table.php?name='+input_name+'','color','width=375,height=325,top=100,left=100,statusbar=no');
}

function sltcolor(c,name)
{
                var d = document.getElementById(name);
                d.value = c;
}

// ----- END OF COLOR PICKER  ----- \\\


function check_all()
{
        document.modify_user.pvg1.checked = true;
        document.modify_user.pvg2.checked = true;
        document.modify_user.pvg3.checked = true;
        document.modify_user.pvg4.checked = true;
        document.modify_user.pvg5.checked = true;
        document.modify_user.pvg6.checked = true;
        document.modify_user.pvg7.checked = true;
        document.modify_user.pvg8.checked = true;
        document.modify_user.pvg9.checked = true;
        document.modify_user.pvg10.checked = true;
        document.modify_user.pvg11.checked = true;

        document.modify_user.pvg12.checked = true;
        document.modify_user.pvg13.checked = true;

        document.modify_user.superuser.checked = true;
}

function uncheck_all()
{
        document.modify_user.pvg1.checked = false;
        document.modify_user.pvg2.checked = false;
        document.modify_user.pvg3.checked = false;
        document.modify_user.pvg4.checked = false;
        document.modify_user.pvg5.checked = false;
        document.modify_user.pvg6.checked = false;
        document.modify_user.pvg7.checked = false;
        document.modify_user.pvg8.checked = false;
        document.modify_user.pvg9.checked = false;
        document.modify_user.pvg10.checked = false;
        document.modify_user.pvg11.checked = false;

        document.modify_user.pvg12.checked = false;
        document.modify_user.pvg13.checked = false;

        document.modify_user.superuser.checked = false;

}

function new_window(url,win_name)
{
var top = window.height/2;
var left = window.width/2;

window.open(url,win_name,'width=790,height=635,top=50,left=50,statusbar=no');
}

function new_window2(url,win_name,width,height)
{


window.open(url,win_name,'width='+width+',height='+height+',top=100,left=100,statusbar=no');
}


function checkInputIn(str,obj,whichId)
{
        if(obj.value == str)
        {
                obj.value = "";
                newstyle = document.getElementById(whichId).style;
                newstyle.color = "000000";
        }
}

function checkInputOut(str,obj,whichId)
{
                if(obj.value == "")
                {
                        obj.value = str;
                        newstyle = document.getElementById(whichId).style;
                        newstyle.color = "666666";
                }
}



// ----- START OF ATTACHING ANOTHER FILE with captions---- \\




// This function adds a new attachment section to the form
// It is called when the user clicks the "Attach a file" button...
// It takes three arguments:
// maxUploads - the maximum number of attachments allowed
// descFieldName - the field name for the Description Input field
// fileFieldName - the field name for the File Input field
function addUploadcaption(descFieldName, fileFieldName)
{
nameDesc=descFieldName;
nameFile=fileFieldName;
//max = Number(maxUploads);

currentUploads++;
//if (currentUploads>max) return;

if (currentUploads>0)
document.getElementById('addupload').childNodes[0].data='Attach another file';

//if (currentUploads==max) document.getElementById('addupload').style.visibility='hidden';


// First, clone the hidden attachment section
var newFields = document.getElementById('attachment').cloneNode(true);
newFields.id = '';

// Make the new attachments section visible
newFields.style.display = 'block';


// loop through tags in the new Attachment section
// and set ID and NAME properties
//
// NOTE: the control names for the Description Input
// field and the file input field are created
// by appending the currentUploads variable
// value to the nameFile and nameDesc values
// respectively
//
// In terms of Xaraya, this means you'll need to name your
// DD properties will need names like the following:
// "AttachmentDesc1"
// "AttachmentFile1"
// "AttachmentDesc2"
// "AttachmentFile2"
// "AttachmentDesc3"
// "AttachmentFile3"
// et cetera...

var newField = newFields.childNodes;
for (var i=0;i<newField.length;i++)
{
if (newField[i].name==nameFile)
{
newField[i].id=nameFile+currentUploads;
newField[i].name=nameFile+currentUploads;
newField2[i].id='caption'+currentUploads;
newField2[i].name='caption'+currentUploads;
}

if (newField[i].name==nameDesc)
{
newField[i].id=nameDesc+currentUploads;
newField[i].name=nameDesc+currentUploads;
newField2[i].id='caption'+currentUploads;
newField2[i].name='caption'+currentUploads;
}
if (newField[i].id=='dropcap')
{
newField[i].id='dropcap'+currentUploads;
newField[i].childNodes[0].data=currentUploads;
newField2[i].id='caption'+currentUploads;
newField2[i].name='caption'+currentUploads;
}
}


// Insert our new Attachment section into the Attachments Div
// on the form...
var insertHere = document.getElementById('attachmentmarker');
insertHere.parentNode.insertBefore(newFields,insertHere);
insertHere.parentNode.insertBefore(newFields2,insertHere);
}





// This function removes an attachment from the form
// and updates the ID and Name properties of all other
// Attachment sections
function removeFilecaption(container, item)
{
// get the ID number of the upload section to remove
var tmp = item.getElementsByTagName('input')[0];
var basefieldname = '';
if (tmp.type=='text') basefieldname = nameDesc; else basefieldname = nameFile;


var iRemove=Number(tmp.id.substring(basefieldname.length, tmp.id.length));

// Shift all INPUT field IDs and NAMEs down by one (for fields with a
// higher ID than the one being removed)
var x = document.getElementById('attachments').getElementsByTagName('input');
for (i=0;i<x.length;i++)
{
if (x[i].type=='text') basefieldname=nameDesc; else basefieldname=nameFile;

var iEdit = Number(x[i].id.substring(basefieldname.length, x[i].id.length));
if (iEdit>iRemove)
{
x[i].id=basefieldname+(iEdit-1);
x[i].name=basefieldname+(iEdit-1);
}
}

// Run through all the DropCap divs (the number to the right of the attachment
// section) and update that number...
x=document.getElementById('attachments').getElementsByTagName('div');
for (i=0;i<x.length;i++)
{
// Verify this is actually the "dropcap" div
if (x[i].id.substring(0, String('dropcap').length)=='dropcap')
{
ID = Number(x[i].id.substring(String('dropcap').length, x[i].id.length));

// check to see if current attachment had a higher ID than the one we're
// removing (and thus needs to have its ID dropped)
if (ID>iRemove)
{
x[i].id='dropcap'+(ID-1);
x[i].childNodes[0].data=(ID-1);
}
}
}

currentUploads--;
saveScrollPos(0);
container.removeChild(item);
setScrollPos();
document.getElementById('addupload').style.visibility='visible';
if (currentUploads==0)
document.getElementById('addupload').childNodes[0].data='Attach a file';

}

// ----- END OF ATTACHING ANOTHER FILE  with captions---- \\