function _get(a){ return document.getElementById?document.getElementById(a):null}

if (!String.prototype.trim)
    String.prototype.trim = function() {
        var r = /^\s*((?:.|\n)+?)\s*$/.exec(this);
        return r ? r[1]: this.toString();
    }

function onLoad(id, e) {

    if ((element = _get(id)) != null) {
        e(element);
        return;
    }

    if (typeof(window.loading) == 'undefined')
        window.loading = { all: [], process: null };

    window.loading.all.push({ id: id, e: e });

    if (!window.loading.process)
        window.loading.process = window.setInterval(
            function() {

                if (!window.loading.all.length) {
                    window.clearInterval(window.loading.process);
                    window.loading.process = null;
                    return;
                }

                var k = [];
                for (var i = 0; i < window.loading.all.length; i++) {

                    if ((element = _get(window.loading.all[i].id)) != null)
                        e(element);
                    else
                        k.push(window.loading.all[i]);
                }

                window.loading.all = k;

            }, 1
        );
}


function getElementPos(element) {

    var x = 0;
    var y = 0;

    if (element.offsetParent)
        do {
            x += element.offsetLeft;
            y += element.offsetTop;
        } while (element = element.offsetParent);

    return { x: x, y: y }
}



function Setcookie( name, value ) {
var expire = "";
var domain = "";
var path   = "/";
var expire = "; expires=Wed, 1 Jan 2020 00:00:00 GMT";
  document.cookie = name + "=" + value + "; path=" + path + expire + domain + ';';
}
function Getcookie(name)
{
 	cname = name + '=';
 	cpos  = document.cookie.indexOf( cname );
	if ( cpos != -1 )
	{
		cstart = cpos + cname.length;
		cend   = document.cookie.indexOf(";", cstart);

		if (cend == -1)
		{
			cend = document.cookie.length;
		}

		return unescape( document.cookie.substring(cstart, cend) );
	}

	return null;
}


function History_look(id) {

        smrAJAX.query(
                    "categ",
                    "./ajax.php",
                    "",
                    { id_dog:id},
                    "if(AJAXOutput) { eval(AJAXOutput); }"
                    );


}

