/**
 * @author basti
 */
var req = null;
var READY_STATE_UNINITIALIZED = 0;
var READY_STATE_LOADING = 1;
var READY_STATE_LOADED = 2;
var READY_STATE_INTERACTIVE = 3;
var READY_STATE_COMPLETE = 4;

var PlugooLoaded = false;

function getFile(xmlFile){
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    }
    else 
        if (window.ActiveXObject) {
            req = new ActiveXObject("Microsoft.XMLHTTP");
        }
    if (req) {
        req.open("GET", xmlFile, false);
        req.send(null);
        if (req.readyState == 4) {
            fillContent(req);
        }
    }
    else {
        alert("Error with AJAX");
    }
    return false;
}

function fillContent(req){
    if (req) {
        document.getElementById("center-col").innerHTML = req.responseText;
    }
    else {
        alert("Something's gone wrong - JavaScript deactivated? JavaScript is required to see content.");
    }
    return false;
}

function innerload(geturl,addSth,newHref) {
	refContent = document.getElementById("center-col");
	refContent.innerHTML = "<div id=\"ajax-loading\" align=\"center\"><br/><b>Loading</b><br/><img src=\"http://img.iwoolf.de/loading.gif\" alt=\"loading\"/></div>"; //+ refContent.innerHTML
	getFile(geturl);
	if(addSth=="plugoo") plugooToRight();
	if (newHref) window.location.href = newHref;
	return false;
}

function plugooToRight() {
	if (!PlugooLoaded) {
		refRightbar = document.getElementById("right-col");
		refRightbar.innerHTML = '<div id="chatbox"><object type="application/x-shockwave-flash" id="plugoo" data= "http://www.plugoo.com/plug.swf?go=1Q4UFQPAX1LL9RK" width="210" height="250"> <param name="movie" value= "http://www.plugoo.com/plug.swf?go=1Q4UFQPAX1LL9RK" /> <param name="allowScriptAccess" value="always" /> <param name="wmode" value="transparent" /> </object></div>' + refRightbar.innerHTML;
		PlugooLoaded = true;
	}
	return false;
}

/**
 * @broken!
 * @param {Object} Ref
 */
function killRef(Ref) {
	Ref.parentNode.removeChild(Ref);
	return false;
}
function killNotify(id) {
	ref = document.getElementById(id)
	ref.parentNode.removeChild(ref);
}

//TODO: implemeent, js calls like mail address (& tel. numbers) protection after innerload by JS.
// because js will not be exectured...)
