
    function roll(img_name, img_src)
       {
       document[img_name].src = img_src;
       }
    
	function create_window( image, width, height )
    {
    	width = width + 30;
        height = height + 85;
        
        if ( window.popup_window && !window.popup_window.closed )
        {
        	window.popup_window.resizeTo( width, height );
        }
        
        var window_specs = "location=no, scrollbars=no, menubars=no, toolbars=no, resizeable=yes, left=0, top=0, width=" + width + ", height=" + height;
		var url = "image_window.php?image=" + image;
        
        popup_window = window.open(url, "ProgramWindow", window_specs);
        popup_window.focus();                                    
    }


    function form_submit(form_name, action)
    {
        var hiddenAction = document.createElement("input");
        hiddenAction.type = "hidden";
        hiddenAction.name = action;
        document.forms[form_name].appendChild(hiddenAction);
//        document.forms[form_name].innerHTML = document.forms[form_name].innerHTML + "<input type=hidden name='" + action + "'>";
    	document.forms[form_name].submit();
    }
    
    function form_setaction(form_name, action)
    {
	    document.forms[form_name].innerHTML = document.forms[form_name].innerHTML + "<input type=hidden name='" + action + "'>";
    	document.forms[form_name].submit();
	}
    
  function alert_confirm( message )
  {
    if (confirm(message))
    {
      return true;
    }
    else
    {
      return false;
    }
  }  
  
    function button_email(filename)
    {
    	if ( alert_confirm("Email summary?" ) )
        {
        	document.FormTicket.action = filename;
    //    	document.FormTicket.target = "_blank";	// Open in a new window
        	document.FormTicket.submit();			// Submit the page
        	return true;
        }
        else
        {
        	return false;
        }
    }
    
    function setFocus()
    {
        if (document.mail_login.imapuser.value == "") {
            document.mail_login.imapuser.focus();
        } else {
            document.mail_login.pass.focus();
        }
    }
    
    function checkmail(xx)
    {
    
    	rex=true;
    	if (window.RegExp)
    	{
    		st="a";ex=new RegExp(st);
    		if (st.match(ex))
    		{
    			r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
    			r2=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
    			b=(!r1.test(xx)&&r2.test(xx));
    		}
    		else
    		{
    			rex=false;
    		}
    	}
    	else
    	{
    		rex=false;
    	}
    	
    	if(!rex)
    		b=(xx.indexOf("@")>0&&xx.indexOf(".")>0&&xx!=""&&xx!="e-mail");
    	return (b);
    }
    
    function submit_login(e)
    {
        if (typeof e != 'undefined' && !enter_key_trap(e)) {
            return;
        }
    
    //    if (!checkmail(document.mail_login.imapuser.value) || document.mail_login.imapuser.value == "" ) 
        if (document.mail_login.imapuser.value == "" )
        {
            alert('Please provide your username.');
            document.mail_login.imapuser.focus();
            return false;
        } else if (document.mail_login.pass.value == "") {
            alert('Please provide your password.');
            document.mail_login.pass.focus();
            return false;
        } else {
    //        document.mail_login.loginButton.disabled = true;
            document.mail_login.submit();
            return true;
        }
    }
