/* IS */
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 */

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 );
    }
}

function show(obj, sDisplayMod){
    if (obj.style.display == 'none')
    {
        var sDisplayMod = sDisplayMod || obj.oldDisplayMod || 'block';
        obj.style.display = sDisplayMod;
    }
}

function hide(e){
    if (e.style.display != 'none')
    {
        e.oldDisplayMod = e.style.display;
        e.style.display = 'none';
    }
}
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;
}

function cancelEventPropagation(e) {
    if (e.stopPropagation)
        e.stopPropagation();
    else
    if (window.event)
        window.event.cancelBubble = true;
}

function createXMLHttpRequest()
{
	var xmlHttp;
	try
	{
		xmlHttp = new XMLHttpRequest();
	}
	catch(e)
	{
		var XmlHttpVersions = new Array(
		"MSXML2.XMLHTTP.5.0",
		"MSXML2.XMLHTTP.4.0",
		"MSXML2.XMLHTTP.3.0",
		"MSXML2.XMLHTTP",
		"Microsoft.XMLHTTP");
		for (var i=0; i<XmlHttpVersions.length && !xmlHttp; i++)
		{
			try
			{
				xmlHttp = new ActiveXObject(XmlHttpVersions[i]);
			}
			catch(e) {}
		}
	}
	if (!xmlHttp)
	{
		alert("Błąd podczas tworzenia obiektu XMLHttpRequest");
		return false;
	}
	else
		return xmlHttp;
}
function handlerXMLHttpRequest()
{
	/*if (HttpRequest.readyState == 1) 
	{
		//alert('1');
	}else
	if (HttpRequest.readyState == 2) 
	{
		//alert('2');
	}else
	if (HttpRequest.readyState == 3) 
	{
		//alert('3');
	}else*/
	if (HttpRequest.readyState == 4) 
	{
//try{
	  HttpRequest.responseXML.getElementsByTagName
//}catch(e){alert('CheckDirState'+e)}
	}
}

/*function ()
{
	HttpRequest.onreadystatechange = SD_DirectoryShow;
	HttpRequest.open('GET', 'ajax_dshow.php5?dir='+Dir);
	HttpRequest.send(null);
}*/
