
function SymError() {
	return true;
}
window.onerror = SymError;

function findObj(theObj,theDoc) {
	var p, i, foundObj;

	if(!theDoc) theDoc = document;
	if((p = theObj.indexOf("?")) > 0 && parent.frames.length) {
		theDoc = parent.frames[theObj.substring(p+1)].document;
		theObj = theObj.substring(0,p);
	}
	if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
	for(i=0; !foundObj && i < theDoc.forms.length; i++)
	 foundObj = theDoc.forms[i][theObj];
	for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
	 foundObj = findObj(theObj,theDoc.layers[i].document);
	if(!foundObj && document.getElementById)
	 foundObj = document.getElementById(theObj);
	
	return foundObj;
}

function popup(URLStr, left, top, width, height) {
	if(left==-1) left = (screen.availWidth - width) / 2;
	if(top==-1) top = (screen.availHeight - height) / 2;
	if(screen.availHeight<screen.height && screen.availWidth<screen.width) {
		if(width>screen.availWidth) {
			width = screen.availWidth;
			left = 0;
		}
		if(height>screen.availHeight) {
			height = screen.availHeight;
			top = 0;
		}
	} else {
		if(width>screen.availWidth-20) {
			width = screen.availWidth-20;
			left = 0;
		}
		if(height>screen.availHeight-40) {
			height = screen.availHeight-40;
			top = 0;
		}
	}
	window.open('http://ibas.co.at/'+URLStr, 'ibasPopUpWin', 'dependent=yes,hotkeys=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=yes,scrollbars=no,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'');
}

function form_submit(nam, act, tar) {
	document.forms[nam].action = act;
	if(tar) document.forms[nam].target = tar;
	document.forms[nam].submit();
}

var Ajax = {
	asyncRequest: function(url,get) {
		if(window.XMLHttpRequest) var req = new XMLHttpRequest();
		else var req = new ActiveXObject("Microsoft.XMLHTTP");
		if(get) {
			var query = "";
			for(var i in get) {
				query+= "&"+encodeURIComponent(i)+"="+encodeURIComponent(get[i]);
			}
			url+= "?"+(query.substr(1,query.length-1));
		}
		req.open("GET",url,false);
		req.send(null);
		return req.responseText;
	},
	syncRequest: function(url,get,callback,evaluate) {
		if(window.XMLHttpRequest) var req = new XMLHttpRequest();
		else var req = new ActiveXObject("Microsoft.XMLHTTP");
		req.onreadystatechange = function() {
			if(req.readyState != 4) return;
			if(req.status != 200) return;
			var response = req.responseText;
			if(evaluate) {
				try {
					eval("var response="+response);
				} catch(e) {return;}
			}
			callback(response);
		};
		if(get) {
			var query = "";
			for(var i in get) {
				query+= "&"+encodeURIComponent(i)+"="+encodeURIComponent(get[i]);
			}
			url+= "?"+(query.substr(1,query.length-1));
		}
		req.open("GET",url,true);
		req.send(null);
	}
};

