/*
*
* Grupa funkcj sprawdzajaca typy danych
*
*/
function isArray(obj) {
    return obj && obj.constructor === Array;
}

function isString(obj) {
    return typeof obj == "string";
}

function isElement(obj) {
    return obj && obj.nodeType == 1;
}
/* end IS */

/*
*
* Funkcja dziala podbnie do getElementById  tylko jest krutsza i mozna zamiast nazwy identyfikatora wporwadzic referencje do obiektu
*
*/
var $ = function(sID)
{
    if ( e = document.getElementById(sID) )
        return document.getElementById(sID);
    else if( isElement(sID) )
        return sID;
    else
        return null;
}

function echo( sMessage )
{
    if ( dev )
    {
        alert( sMessage );
    }
}

/*
*
* Odkrywanie elementu
*
*/
function show(obj, sDisplayMod){
    if (obj.style.display == 'none')
    {
        var sDisplayMod = sDisplayMod || obj.oldDisplayMod || 'block';
        obj.style.display = sDisplayMod;
    }
}

/*
*
* Ukrywanie elementu
*
*/
function hide(e){
    if (e.style.display != 'none')
    {
        e.oldDisplayMod = e.style.display;
        e.style.display = 'none';
    }
}

/*
*
* funkcja dodaje zdarzenie do obiektu/nodu/elementu
*
*/
function addEventListener(obj, type, handle)
{
    if (obj.addEventListener)
        obj.addEventListener(type, handle, false);
    else if (elem.attachEvent)
        obj.attachEvent("on" + type, handle);
}

function removeEventListener (obj, type, handle)
{
    if (obj.removeEventListener)
        obj.removeEventListener(type, jQuery.data(obj, "handle"), false);
    else if (obj.detachEvent)
        obj.detachEvent("on" + type, jQuery.data(obj, "handle"));
}

/*
*
* Pobieranie wartosci z adresu URI i zapisywanie ich do zmiennej _GET
*
*/
function getVariablesFromURI()
    {
    sURI = window.location.toString();
    var aVariables = sURI.split(/\?+|&+/);
    _GET = { URL : aVariables.shift() };
    for ( var i = 0; i < aVariables.length ; i++ )
    {
        var aTmp = aVariables[i].split('=');
        _GET[aTmp[0]] = ( aTmp[1] ? aTmp[1] : undefined );
    }
    return _GET;
}

/*
*
* Fukcja blokuje propagacje zdarzeń
*
*/
function cancelEventPropagation(e) {
    if (e.stopPropagation)
        e.stopPropagation();
    else
    if (window.event)
        window.event.cancelBubble = true;
}
