function scriptEval(responseText){
	var re = /(?:<script.*(?:src=[\"\'](.*)[\"\']).*>.*<\/script>)|(?:<script.*>([\S\s]*?)<\/script>)/ig;
	var match;
	
	while (match = re.exec(responseText)){
		var s0 = document.createElement("script");
		if (match[1]){
			s0.src = match[1];
		}else if (match[2]){
			s0.text = match[2];
		}else{
			continue;
		}

		s0.type = 'text/javascript';
		document.getElementsByTagName("head")[0].appendChild(s0);
	 }
}

var objLoader = {

	handleSuccess:function(o){
		this.processResult(o);
	},

	handleFailure:function(o){
		alert("Anfrage fehlerhaft...");
	},

	processResult:function(o){
		this.pTarget.innerHTML = o.responseText;
		scriptEval(o.responseText);
	},

	startRequest:function(url, target) {
		this.pTarget = document.getElementById(target);
		var cObj = YAHOO.util.Connect.asyncRequest('GET', url, callback);
	},

	requestGeneral:function(form, target, upload) {
		this.pTarget = document.getElementById(target);
		var pForm = document.getElementById(form);
		var pURL = pForm.action;

		YAHOO.util.Connect.setForm(pForm, upload);
		var cObj = YAHOO.util.Connect.asyncRequest('POST', pURL, callback);
	},

	startRequestForm:function(form, target) {
		this.requestGeneral(form, target, false);
	},
	
	startRequestUpload:function(form, target) {
		this.requestGeneral(form, target, true);
	}
};

var callback =
{
	success:objLoader.handleSuccess,
	failure:objLoader.handleFailure,
	scope: objLoader
};
