	function MM_openBrWindow(sess,mId){
		if(isReg==0){
			alert('You must be logged in to use this feature. \r\nPlease register if you have not done so all ready, and log in.');
			return false;
		}
		URL = 'amm.lightbox.p.php?PHPSESSID='+sess+'&mId='+mId;
		ADDlightbox = window.open(URL,'ADDlightbox','top=200, left=300, width=300,height=425');//,'width=300,height=400'
		ADDlightbox.focus();
	}
	
	function selListItem(listObj, val)
	{
        for(i = 0; i < listObj.length; i++)
        {
                if(listObj.options[i].value == val)
                {
                        listObj.options[i].selected = true;

                        return true;
                }
        }

        return false;
	}
	
	function trim(strField)
	{

        while(strField.value.match(/^(\s+)(.*)$/))
        {
                strField.value = strField.value.substr(1);
        }

        while(strField.value.match(/^(.*)(\s+)$/))
        {
                strField.value = strField.value.substr(0, strField.value.length -1);
        }

        return strField.value;
	}
	
	function checkEmail(emailField, empty)
	{
        var EmailCharacters = /^[0-9A-Za-z_\-\.]+@[0-9A-Za-z_\-\.]+$/;
        trim(emailField);
        
        if(emailField.value == '')
        {
                if(empty)
                {
                        return true;
                }
                else
                {
                        return false;
                }
        }

        if(!emailField.value.match(EmailCharacters))
        {
                return false;
        }

        return true;
	}

	function MM_openPDFWindow(sess,mId){
        if(isReg==0){
                alert('You must be logged in to use this feature. \nPlease register if you have not done so all ready, and log in.');
                return false;
        }
        URL = 'amm.main.php?PHPSESSID='+sess+'&mId='+mId+'&Int_MI=9';        
        pdfbox = window.open(URL,'PrintCard','top=50, left=50, width=800,height=580');
        pdfbox.focus();
	}
	
