
// Определяем браузер пользователя
isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;


    function getelementbyid(myid) {
        if (isNS4){
            objElement = document.layers[myid];
        }else if (isIE4) {
            objElement = document.all[myid];
        }else if (isIE5 || isNS6) {
            objElement = document.getElementById(myid);
        };
        return(objElement);
    };

    function getAbsolutePos( el )
    {
        var r = { x: el.offsetLeft, y: el.offsetTop };
        if (el.offsetParent)
                {
                var tmp = getAbsolutePos(el.offsetParent);
                r.x += tmp.x;
                r.y += tmp.y;
                }
        return r;
    }

    function checkall( p_formname, p_state )
    {
        var t_elements = (eval("document." + p_formname + ".elements"));

        for (var i = 0; i < t_elements.length; i++) {
            if(t_elements[i].type == "checkbox") {
            if( t_elements[i].checked == p_state )
                t_elements[i].checked = !p_state;
            else
                t_elements[i].checked = p_state;
                   }
          }
    }

function notification(id){
    var notification = 'Данное поле не должно содержать: названия сайтов и ссылок на сайты!';
    var comments = document.getElementById("ams_in_comments");
    var contacts = document.getElementById("ams_in_contacts");

    if(comments == id){

        if(comments.value == '') comments.value = notification;
        else if(comments.value == notification) comments.value = '';

    } else if(contacts == id){
        if(contacts.value == '') contacts.value = notification;
        else if(contacts.value == notification) contacts.value = '';
    } else if(id == 'no') {
        if(comments && comments.value == '')comments.value = notification;
        if(contacts && contacts.value == '')contacts.value = notification;
    } else if(id == 'clear'){
        if(comments.value == notification) comments.value = '';
        if(contacts.value == notification) contacts.value = '';
    }
}

window.onload = function() {
    notification('no');
}

