/**
* Checks for presence of an attribute
* 
* @param class ctrl control (input or other) for which checking is done
* @param string att attribute to be checked
* @param bool throwError throws a warning if attribute does not exist
* @param string val check attribute for presence and for a given value
* @return bool true if attribute is present
*/
function checkAttribute(ctrl, att, val, throwError)
{   
    if (!ctrl.attributes[att])
    {
        if (throwError)
        {
            alert("Control '" + ctrl.name + "' must define '" + att + "' attribute");
        }
        return false;
    }
    else if (val 
        && val != ctrl.attributes[att].value)
    {
        if (throwError)
        {
            alert("Control's '" + ctrl.name + "' attribute value differs from required. Attribute: '" + att + 
                "' required value: '" + val + "', actual value: '" 
                + ctrl.attributes[att].value+ "'");
        }        
        return false;
    }
    
    
    return true;
}

/**
* Opens a window without toolbars, status bars...
*
* @param string url link to the page
* @param string name name of the window
* @param int width width of the new window
* @param int height height of the new window
*/
function openRawWindow(url, name, width, height)
{
    if (!width)
    {
        width=800;    
    }

    if (!height)
    {
        height=600;    
    }    
    window.open(url,name,'directories=no,hotkeys=no,location=no,menubar=no,personalbar=no,resizable=yes,scrollbars=yes,toolbar=no,width=' + width + 'px,height=' + height + 'px');    
}