function defaultUriCombine(uri1, uri2){
	var r1 = uri2;
	if(r1.length>0 && (r1.charAt(0)=='?' || r1.charAt(0)=='&')){
		r1 = r1.substring(1);
	}
	r1 = (uri1 + (uri1.indexOf('?')!=-1 ? '&' : '?') + r1);
	return(r1);
}

function urlDominio(){
	var _url = '/';
	if(location.host == 'localhost'){//Debug
		_url = '/w2u/';
	}
	_url = 'http://' + location.host + _url;
	return _url;
}

var xmlhttp;
var _resp;
var _aSync = true;
function loadObj(_url,_procRisp){
	xmlhttp=null;
	resp=null;
	if(window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest();
	}else if(window.ActiveXObject){
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	if(xmlhttp!=null){
		if(_aSync&&_procRisp){
			xmlhttp.onreadystatechange = function(){
				if(xmlhttp.readyState==4){
					if(xmlhttp.status==200){
						_resp = eval( "(" + xmlhttp.responseText + ")");
					}else{
						alert("Problem retrieving XML data");
					}
				}
			}
		}
		xmlhttp.open("GET", defaultUriCombine(_url, encodeURIComponent("trk=" + new Date().getMilliseconds().toString())), _aSync);
		xmlhttp.send(null);
		if((!_aSync)&&_procRisp){
			_resp = eval( "(" + xmlhttp.responseText + ")");
		}
	}else{
		alert("Your browser does not support XMLHTTP.");
	}
	return _resp
}

function wStat(_id){
	var _url = urlDominio() + "wStats/w2u-stat.asp?Id=" + _id;
	loadObj(_url,false);
}



function showHideElement(element)
{  
  if (element != null)
  {
    if (document.getElementById(element).style.display == "none")
    {  
      document.getElementById(element).style.display = "";
    }
    else
    {
      document.getElementById(element).style.display = "none";
    }
  }
  
} 