var http_request = false;

function changeCSS(nr)
{
	if (document.getElementsByTagName)
		x = document.getElementsByTagName('link');
	else if (document.all)
		x = document.all.tags('link');
	else
	{
		alert('This script does not work in your browser');
		return;
	}
	nr--;
	for (var i=0;i<x.length;i++)
	{
		dis = !(i == nr);
		x[i].disabled = dis;
	}

   if (window.ActiveXObject) {

      window.location.reload( false );

   }

}

function makeRequest(url) {

    http_request = false;

    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
            // See note below about this line
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }

    if (!http_request) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    //http_request.onreadystatechange = alertContents;
    http_request.open('GET', url, true);
    http_request.send(null);

}

function alertContents() {

    if (http_request.readyState == 4) {
        if (http_request.status == 200) {
            alert(http_request.responseText);
        } else {
            alert('There was a problem with the request.');
        }
    }

}

function style_init () {

   if (document.getElementsByTagName) document.getElementsByTagName('link')[0].disabled = true;

}

function fixPNG(myImage) {
/* http://homepage.ntlworld.com/bobosola/ */
	var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	var imgTitle = (myImage.title) ? "title='" + myImage.title + "' " : "title='" + myImage.alt + "' "
	var imgStyle = "display:inline-block;" + myImage.style.cssText
	var strNewHTML = "<span " + imgID + imgClass + imgTitle
	strNewHTML += " style=\"" + "width:" + myImage.width + "px; height:" + myImage.height + "px;" + imgStyle + ";"
	strNewHTML += "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	strNewHTML += "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	myImage.outerHTML = strNewHTML
}

function sleep(gap){ /* gap is in millisecs */
var then,now; then=new Date().getTime();
now=then;
while((now-then)<gap)
{now=new Date().getTime();}
}
