<!--

function popup(URL)
{
    attributes = 'height=310,width=440,scrollbars=0,resizable=0,left=50,top=50,screenX=50,screenY=50';
    mywindow = window.open(URL,'mailwin',attributes);
    preloadImages();
}

function popupUpload(URL)
{
    attributes = 'height=400,width=550,scrollbars=1,resizable=1,left=75,top=75,screenX=75,screenY=75';
    mywindow = window.open(URL,'uploadwin',attributes);
}

function popupBrowse(URL)
{
    attributes = 'height=500,width=700,scrollbars=1,resizable=1,left=75,top=75,screenX=75,screenY=75';
    mywindow = window.open(URL,'browsewin',attributes);
}


 function checkSearch(theform)
 { 
  
    
        if(theform.search_string.value == "")
        {
            alert("Please enter a search word or phrase");
            theform.search_string.focus();
            return false;
        }    
    
 } 

 
 
function isEmailValid(FormName,ElemName)
{
        var EmailOk  = true
        var Temp     = document.forms[FormName].elements[ElemName]
        var AtSym    = Temp.value.indexOf('@')
        var Period   = Temp.value.lastIndexOf('.')
        var Space    = Temp.value.indexOf(' ')
        var Length   = Temp.value.length - 1   // Array is from 0 to length-1

        if ((AtSym < 1) ||                     // '@' cannot be in first position
        (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
        (Period == Length ) ||             // Must be atleast one valid char after '.'
        (Space  != -1))                    // No empty spaces permitted
        {  
                EmailOk = false
        }

return EmailOk

}
 
 
 function checkEmail(theform)
 { 

        if (!isEmailValid('subscribe', 'Email'))
        {
                alert("Please enter a valid email address");
                theform.Email.focus();
                theform.Email.select();
                return false;
        }
        else

        return true;


 } 

 
 function checkEmailFriend(theform)
 { 

        if (!isEmailValid('mailfriend', 'recipient_email'))
        {
                alert("Please enter a valid recipient email address");
                theform.recipient_email.focus();
                theform.recipient_email.select();
                return false;
        }
        if( isEmpty(theform.sender_name.value) )
        {
                alert("Please enter your name to let your \nfriend know who is sending this email.");
                theform.sender_name.focus();
                theform.sender_name.select();
                return false;
        } 
        if (!isEmailValid('mailfriend', 'sender_email'))
        {
                alert("Please enter a valid sender email address");
                theform.sender_email.focus();
                theform.sender_email.select();
                return false;
        }
        
        return true;

 } 
 
 

function isEmpty(input)
{
        if (input == null || input == '')
        {
               return true;
        }
        return false;
}

function withinRange(input, lowRange, highRange)
{
        if (input > lowRange && input < highRange)
        {
               return true;
        }
        return false;
}


function validateAddArticle()
{
    var theForm = document.article;

    for (var i = 0; i < theForm.elements.length; i++)
    {
        if (theForm.html_title.value == '')
        {
            alert("please add an HTML title tag");
            theForm.html_title.focus();
            theForm.html_title.select();            
            return false;
        }
        if (theForm.article_title.value == '')
        {
            alert("please add an Article Title");
            theForm.article_title.focus();
            theForm.article_title.select();
            return false;
        }       
                 
        if (theForm.month.options.selectedIndex == 0 || theForm.day.options.selectedIndex == 0 || theForm.year.options.selectedIndex == 0)
        {
            alert("Please make a valid selection from each date menu: \n\nMonth\nDay\nYear");
            theForm.month.options.focus();
            return false;
        }
        
        if (isNaN(theForm.child_id.value))
        {
                alert("Sorry, only numbers are allowed in the Associate Article box.");
                theForm.child_id.focus();
                theForm.child_id.select();
                return false;
        }
        if (!isEmpty(theForm.child_id.value) && !withinRange(theForm.child_id.value, 1000,3000))
        {
                alert("Sorry, Article ID must be in the range 1001 - 2999");
                theForm.child_id.focus();
                theForm.child_id.select();
                return false;
        }

        
        if (isNaN(theForm.interview_id1.value))
        {
                alert("Sorry, only numbers are allowed in the Associate Interview boxes.");
                theForm.interview_id1.focus();
                theForm.interview_id1.select();
                return false;
        }
        if (!isEmpty(theForm.interview_id1.value) && !withinRange(theForm.interview_id1.value, 3000,5000))
        {
                alert("Sorry, Interview ID must be in the range 3001 - 4999");
                theForm.interview_id1.focus();
                theForm.interview_id1.select();
                return false;
        }

        if (isNaN(theForm.interview_id2.value))
        {
                alert("Sorry, only numbers are allowed in the Associate Interview boxes.");
                theForm.interview_id2.focus();
                theForm.interview_id2.select();
                return false;
        }
        if (!isEmpty(theForm.interview_id2.value) && !withinRange(theForm.interview_id2.value, 3000,5000))
        {
                alert("Sorry, Interview ID must be in the range 3001 - 4999");
                theForm.interview_id2.focus();
                theForm.interview_id2.select();
                return false;
        }

        
       else
       {
            return true;
       }
    }    

}




 
 
 
function validateEditArticle()
{
    var theForm = document.article;

    for (var i = 0; i < theForm.elements.length; i++)
    {
        if (theForm.html_title.value == '')
        {
            alert("please add an HTML title tag");
            theForm.html_title.focus();
            theForm.html_title.select();            
            return false;
        }
        if (theForm.article_title.value == '')
        {
            alert("please add an Article Title");
            theForm.article_title.focus();
            theForm.article_title.select();
            return false;
        }       
                 
        if (theForm.month.options.selectedIndex == 0 || theForm.day.options.selectedIndex == 0 || theForm.year.options.selectedIndex == 0)
        {
            alert("Please make a valid selection from each date menu: \n\nMonth\nDay\nYear");
            theForm.month.options.focus();
            return false;
        }
        
        if (isNaN(theForm.child_id_new.value))
        {
                alert("Sorry, only numbers are allowed in the Associate Article box.");
                theForm.child_id_new.focus();
                theForm.child_id_new.select();
                return false;
        }
        if (!isEmpty(theForm.child_id_new.value) && !withinRange(theForm.child_id_new.value, 1000,3000))
        {
                alert("Sorry, Article ID must be in the range 1001 - 2999");
                theForm.child_id_new.focus();
                theForm.child_id_new.select();
                return false;
        }


        
        if (isNaN(theForm.interview_id1_new.value))
        {
                alert("Sorry, only numbers are allowed in the Associate Interview boxes.");
                theForm.interview_id1_new.focus();
                theForm.interview_id1_new.select();
                return false;
        }
        if (!isEmpty(theForm.interview_id1_new.value) && !withinRange(theForm.interview_id1_new.value, 3000,5000))
        {
                alert("Sorry, Interview ID must be in the range 3001 - 4999");
                theForm.interview_id1_new.focus();
                theForm.interview_id1_new.select();
                return false;
        }

        
        if (isNaN(theForm.interview_id2_new.value))
        {
                alert("Sorry, only numbers are allowed in the Associate Interview boxes.");
                theForm.interview_id2_new.focus();
                theForm.interview_id2_new.select();
                return false;
        }
        if (!isEmpty(theForm.interview_id2_new.value) && !withinRange(theForm.interview_id2_new.value, 3000,5000))
        {
                alert("Sorry, Interview ID must be in the range 3001 - 4999");
                theForm.interview_id2_new.focus();
                theForm.interview_id2_new.select();
                return false;
        }
        

       else
       {
            return true;
       }
    }    

}





function validateInterview()
{
    var theForm = document.interview;

    for (var i = 0; i < theForm.elements.length; i++)
    {
        if (theForm.html_title.value == '')
        {
            alert("please add an HTML title tag");
            theForm.html_title.focus();
            theForm.html_title.select();
            return false;
        }
        if (theForm.headline.value == '')
        {
            alert("please add a headline")
            theForm.headline.focus();
            theForm.headline.select();
            return false;
        }
         
        if (theForm.month.options.selectedIndex == 0 || theForm.day.options.selectedIndex == 0 || theForm.year.options.selectedIndex == 0)
        {
            alert("Please make a valid selection from each date menu: \n\nMonth\nDay\nYear");
            theForm.month.options.focus();
            return false;
        }

        
       else
       {
            return true;
       }
    }    

}





function validateNews()
{
    var theForm = document.news;

    for (var i = 0; i < theForm.elements.length; i++)
    {
        if (theForm.html_title.value == '')
        {
            alert("please add an HTML title tag");
            theForm.html_title.focus();
            theForm.html_title.select();
            return false;
        }
        if (theForm.headline.value == '')
        {
            alert("please add a headline")
            theForm.headline.focus();
            theForm.headline.select();
            return false;
        }
         
        if (theForm.month.options.selectedIndex == 0 || theForm.day.options.selectedIndex == 0 || theForm.year.options.selectedIndex == 0)
        {
            alert("Please make a valid selection from each date menu: \n\nMonth\nDay\nYear");
            theForm.month.options.focus();
            return false;
        }

        
       else
       {
            return true;
       }
    }    

}




function validatePress()
{
    var theForm = document.press;

    for (var i = 0; i < theForm.elements.length; i++)
    {
        if (theForm.headline.value == '')
        {
            alert("please add a Link Headline");
            theForm.headline.focus();
            theForm.headline.select();
            return false;
        }
        if (theForm.byline.value == '')
        {
            alert("please add a Heading")
            theForm.byline.focus();
            theForm.byline.select();
            return false;
        }
         
        if (theForm.month.options.selectedIndex == 0 || theForm.day.options.selectedIndex == 0 || theForm.year.options.selectedIndex == 0)
        {
            alert("Please make a valid selection from each date menu: \n\nMonth\nDay\nYear");
            theForm.month.options.focus();
            return false;
        }

        
       else
       {
            return true;
       }
    }    

}




//-->