


var tGpx, tGpy;

var portfolio = 1;

////////////////////////////////////////////
// BROWSER DETECTION
////////////////////////////////////////////
var detect = navigator.userAgent.toLowerCase();

var OS,browser,version,total,thestring;
if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('firefox')) browser = "Firefox"
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
////////////////////////////////////////////
////////////////////////////////////////////

////////////////////////////////////////////
// AJAX
///////////////////////////////////////////
function createRequestObject() {
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				xmlhttp = false;
			}
		}
		@else
			xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}
	}
	return xmlhttp;
}
function loadURL(url, callback, params) {

	var http = createRequestObject();
	var userFunc;
	loadingOn();
	http.onreadystatechange = function () {
		if (http.readyState == 4) {
			if (callback) {
				userFunc = eval(callback);
				userFunc(http.responseText, params);				
			}
			loadingOff();
		}
	}
	http.open('get', url, true);
	http.send(null);
}
function loadingOn() {
	var loaddiv = document.createElement("div");
	loaddiv.id = "loading";
	loaddiv.innerHTML = "<img src=img/loading.gif>";
	document.body.insertBefore(loaddiv, document.body.childNodes[0]);
	loaddiv.style.position = "absolute";
	xMoveTo("loading", (screen.width/2)+xScrollLeft()-10, (screen.height/2)+xScrollTop()-150);
	xShow("loading");
}
function loadingOff() {
	xHide("loading");
}
function escreveNoHtml(texto, div) {
	xGetElementById(div).innerHTML = texto;
}
function showonehideothers(divescondida) {
	var divativa = document.getElementById("divativa").value;
	if (divativa != "") {
		document.getElementById(divativa).style.display = "none";
	}
	document.getElementById(divescondida).style.display = "block";
	document.getElementById("divativa").value = divescondida;
}