/********************* SMALL USEFULL FUNCTIONS ********************************/
function confirmLink(labelText, link)
{
	question = confirm(labelText);
	if(question){window.location.href = link;}
    //if(question){parent.bodyFrame.location = link;}
}

function divReplace(divIDfrom, divIDto)
{
    x = document.getElementById(divIDfrom);
    y = document.getElementById(divIDto);

    y.innerHTML = x.innerHTML;
}

function imgReplace(elementID,imgPath)
{document.getElementById(elementID).src = imgPath;}

function switchClass(elementID, className)
{document.getElementById(elementID).className = className;}

function showDiv(divID)
{
    document.getElementById(divID).style.visibility = 'visible';
    /*document.getElementById(divID).style.position = 'absolute';*/
    document.getElementById(divID).style.display = 'inline';
}

function hideDiv(divID)
{
    document.getElementById(divID).style.visibility = 'hidden';
    document.getElementById(divID).style.display = 'none';
}

function strstr(haystack,needle)
{
    strLen = needle.length;
    haystack = haystack.substr(0,strLen);
    haystack = haystack.toLowerCase();

    if(haystack.match(needle.toLowerCase()) != null)
    {return true;}
    else{return false;}
}

function sortByFirstElement(a, b)
{
    var x = a[0].toLowerCase();
    var y = b[0].toLowerCase();
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

function customWindow(Wlink, Wname, Wwidth, Wheight)
{
    Swidth = screen.width;
    Sheight =  screen.height;

    Wtop = ((Sheight - Wheight)/2);
    Wleft = ((Swidth - Wwidth)/2);

    window.open(Wlink,Wname,'width=' + Wwidth + ',height=' + Wheight + ',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=yes,menubar=no,top=' + Wtop + ',left=' + Wleft);
}

function ietruebody()
{return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;}

/******************************************************************************/
