
// -- IPv6 monitoring test script This script is used to scientifically measure IPv4 and IPv6 capabilities of 
// -- visitors to statistically determine IPv6 deployment in Europe. 
var __ipv6_test_objects=new Array();

function IPv6Test(site, code){
  this.site=site;
  this.code=code;
  this.timeoutMsec=10000;
  this.hostSuffix=".test.ipv6monitoring.eu";
  this.timeout=false;
  var now=new Date();
  this.test_time=now.getTime()+(now.getTimezoneOffset()*60000);
  this.test_id=Math.floor(Math.random()*Math.pow(2,31));
  __ipv6_test_objects[this.test_id]=this;
}

IPv6Test.prototype.setCookie=function(){
  var now=new Date();
  var expire=new Date(now.getTime()+86400000);
  document.cookie='ipv6test_last_run='+now.getTime()+';expires='+expire.toGMTString()+';path=/';
}

IPv6Test.prototype.checkCookie=function(){
  var a_all_cookies=document.cookie.split(';');
  for(i=0;i<a_all_cookies.length;i++){
    var a_temp_cookie=a_all_cookies[i].split('=');
    var cookie_name=a_temp_cookie[0].replace(/^\s+|\s+$/g,'');
    if(cookie_name=='ipv6test_last_run'){
      var cookie_value=unescape(a_temp_cookie[1].replace(/^\s+|\s+$/g,''));
      var last_run=parseInt(cookie_value);
      if(isNaN(last_run)) return true;
      var now=new Date();
      return(last_run<(now.getTime()-86400000));
    }
  }
  return true;
}

IPv6Test.prototype.run=function(forced){
  if(!forced&&!this.checkCookie()) return;
  this.writeHtml();
  var oldonload=window.onload;
  var myself=this;
  window.onload=function(){
    if(typeof oldonload=='function') oldonload();
    myself.startTest();
  }
}

IPv6Test.prototype.writeHtml=function(){
  document.writeln('<div style="visibility: hidden;">');
  document.writeln('<img height="1" width="1" src="" id="__ipv6wwwtest_'+this.test_id+'_ipv4Img" />');
  document.writeln('<img height="1" width="1" src="" id="__ipv6wwwtest_'+this.test_id+'_ipv6Img" />');
  document.writeln('<img height="1" width="1" src="" id="__ipv6wwwtest_'+this.test_id+'_ipv4v6Img" />');
  document.writeln('</div>');
}

IPv6Test.prototype.startTest=function(){
  

document.getElementById("__ipv6wwwtest_"+this.test_id+"_ipv4Img").src="http://ipv4"+this.hostSuffix+"/ipv6mon/testimg.php?site="+this.site+"&code="+this.code+"&time="+this.test_time+"&id="+this.test_id;
document.getElementById("__ipv6wwwtest_"+this.test_id+"_ipv6Img").src="http://ipv6"+this.hostSuffix+"/ipv6mon/testimg.php?site="+this.site+"&code="+this.code+"&time="+this.test_time+"&id="+this.test_id;
document.getElementById("__ipv6wwwtest_"+this.test_id+"_ipv4v6Img").src="http://v4v6"+this.hostSuffix+"/ipv6mon/testimg.php?site="+this.site+"&code="+this.code+"&time="+this.test_time+"&id="+this.test_id;
  this.timeout=window.setTimeout('__ipv6_test_objects['+this.test_id+'].cleanUp()',this.timeoutMsec);
}

IPv6Test.prototype.cleanUp=function(){
  if(this.timeout){
    window.clearTimeout(this.timeout);
  }
  document.getElementById("__ipv6wwwtest_"+this.test_id+"_ipv4Img").src="";
  document.getElementById("__ipv6wwwtest_"+this.test_id+"_ipv6Img").src="";
  document.getElementById("__ipv6wwwtest_"+this.test_id+"_ipv4v6Img").src="";
  this.setCookie();
}
// -- end of IPv6 monitoring test script 


// - - - - - - - - - - - - - - - Firebug in browsers other than Firefox - avoid the errors with console.<methodname>()

if (!window.console || !console.firebug)
{
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

    window.console = {};
    for (var i = 0; i < names.length; ++i)
        window.console[names[i]] = function() {}
}

console.info('this page is using the standard script');

// - - - - - - - - - - - - - - - Hyphenator
// Ugly workaround for FireFox's lack of spft hyphen support

function noHyphens() {return true}

function splitter() {
  if (noHyphens()) {
    textSplitter('de','menupol','Politik','bereiche');
    textSplitter('de','stupId','Lebens','qualit\u00e4t');
  }	
}

function unsplitter() {
  if (noHyphens()) {
    textJoiner('de','menupol');
    textJoiner('de','stupId');
  }	
}

function textSplitter(lang, elementId) {
	var wbr, newText;
	if (lang == document.getElementsByTagName("HTML")[0].lang) {
		var elem = document.getElementById(elementId);
		if (elem) {
			// remove all exisiting text children, go backwards to be sure they all go...
			for (var i = (elem.childNodes.length-1); i>=0; i--)
					elem.removeChild(elem.childNodes[i]);
			// replace them with a broken list
			for (i=2;i<arguments.length;i++) {
				newText = document.createTextNode(arguments[i]);
				elem.appendChild(newText);
				if (i+1<arguments.length) {
					wbr = document.createElement("br");
					elem.appendChild(wbr);
				}
			}
		}
	}
}

function textJoiner(lang, elementId) {
	if (lang == document.getElementsByTagName("HTML")[0].lang) {
		var elem = document.getElementById(elementId);
		if (elem) {
			for (var i = (elem.getElementsByTagName("BR").length - 1); i>=0; i--)
				removeNode(elem.getElementsByTagName("BR")[i]);
		}
	}
}

// - - - - - - - - - - - - - - - - - - - - - - - Don't link to the current page
// Thanks to Jonathan Snook: http://www.snook.ca/archives/000291.html
function clearCurrentLink() {
		for (var i=0;i<arguments.length;i++) {
			if (document.getElementById(arguments[i])) 
				clearCurrentLinkFromElement(document.getElementById(arguments[i]))
		}
}

function clearCurrentLinkFromElement(e) {
    var a = e.getElementsByTagName("A");
    for(var i=0;i<a.length;i++) {
        if(a[i].href == window.location.href.split("#")[0])
            removeNode(a[i]);
    }
}

function removeNode(n){
    if(n.hasChildNodes())
        for(var i=0;i<n.childNodes.length;i++)
            n.parentNode.insertBefore(n.childNodes[i].cloneNode(true),n);
    n.parentNode.removeChild(n);
}

// - - - - - - - - - - - - - - - Global navigation switch (for printer-friendly, liquid version only)
function navigationControls() {
	var as;
	var gnText, lnText;
	var navcon = document.getElementById("navcontrols");
	if (!navcon) return;
	var lg = document.getElementsByTagName("HTML")[0].lang;
	if (lg == "fr") {
		gnText = "Navigation\u00A0globale"
		lnText = "Navigation\u00A0locale"
	}
	else if (lg == "it") {
		gnText = "Navigazione\u00A0globale"
		lnText = "Navigazione\u00A0locale"
	}
	else if (lg == "de") {
		gnText = "Hauptmen\u00FC"
		lnText = "Lokales\u00A0Men\u00FC"
	}
	else if (lg == "es") {
		gnText = "Men\u00FA\u00A0principal"
		lnText = "Men\u00FA\u00A0local"
	}
	else if (lg == "pl") {
		gnText = "Nawigacja\u00A0globalna"
		lnText = "Nawigacja\u00A0lokalna"
	}
	else {
		gnText = "Global\u00A0navigation"
		lnText = "Local\u00A0navigation"
	}
	if (document.getElementById("nav")) {	
		addControl(navcon,"gnavcontrol",gnText);
	}
	navcon.appendChild(document.createTextNode(" "));
	if (as = document.getElementById("localnav")) {
		addControl(navcon,"lnavcontrol",lnText);
	}
	if (as = document.getElementById("gnavcontrol")) {
		as.onclick = function(e) {
			var nv=document.getElementById("nav"), ln;
			if (nv.className=="ghide") {
				nv.className="gshow";
				if (ln=document.getElementById("lnavcontrol")) {ln.className = "cclosed"}
				if (ln=document.getElementById("localnav")) {ln.className = "ghide"}
			}
			else nv.className="ghide";
			this.className=(this.className=="cclosed"?"copen":"cclosed");
		}
	}
	if (as = document.getElementById("lnavcontrol")) {
		as.onclick = function(e) {
			var nv=document.getElementById("localnav"), gn;
			if (nv.className=="ghide") {
				nv.className="gshow";
				if (gn=document.getElementById("gnavcontrol")) {gn.className = "cclosed"}
				if (gn=document.getElementById("nav")) {gn.className = "ghide"}
			}
			else nv.className="ghide";
			this.className=(this.className=="cclosed"?"copen":"cclosed");
		}
	}
}

function addControl(toElement,controlId,controlText) {
	var myControl=document.createElement("SPAN");
	myControl.id=controlId;
	myControl.className="cclosed";
	myControl.appendChild(document.createTextNode(controlText));
	toElement.appendChild(myControl);
}

// - - - - - - - - - - - - - - - - - - - - - - - checkAll, uncheckAll, allLike
// move into a form handling library
function checkAll(field) {
	for (i = 0; i < field.length; i++) field[i].checked = true;
}

function uncheckAll(field) {
	for (i = 0; i < field.length; i++) field[i].checked = false;
}

function allLike(fieldar,field) {
	for (i = 0; i < fieldar.length; i++) fieldar[i].checked = field.checked ;
}

function checkIfAny(fieldar,field) {
	var anyChecked = false;
	for (i = 0; i < fieldar.length; i++) {
		if (fieldar[i].checked) {
			anyChecked = true;
		}
	}
	field.checked = anyChecked;
}

// - - - - - - - - - - - - - - - - - - - - - - - Alternate Style Sheets
// Thanks to Paul Sowden: http://www.alistapart.com/articles/alternate/
// Usage: <a href="#" onclick="setActiveStyleSheet('default'); return false;">change style to default</a>
// 3/6/2005 Ca'Zorzi: modified script to ensure that the default style sheet is loaded whenever the information
// written in the cookie is not compatible with the actually defined stylessheets (otherwise page is loaded without styles)
function activateStleSheet(title) {
   var i, a, main, anyenabled;
   anyenabled=false;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) {
       	a.disabled = false;
       	anyenabled = true;
       }
     }
   }
   if (title == "default") {splitter()} else {unsplitter()};
   return anyenabled;
}

function setActiveStyleSheet(styleName) {
	// Don't remember the style as it confuses users when they come back.
	// We need to build the alternate style sheet feature in some other way.
	// See also the setActiveStyleSheet function, where I removed the readCookie call for the same reason
	//if (styleName == undefined) styleName = readCookie("style");
	var title = styleName || getPreferredStyleSheet();
	var isSet = activateStleSheet(title);
	if (!isSet && styleName) {
		title = getPreferredStyleSheet();
		isSet = activateStleSheet(title);
	}
}

function getActiveStyleSheet() {
var i, a;
 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
  if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled)
    return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title"))
       return a.getAttribute("title");
	}
  return null;
}

// - - - - - - - - - - - - - - - - - - - - - - - - Cookies
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/information_society";
}

function createShortCookie(name,value,minutes) {
  if (minutes) {
    var date = new Date();
    date.setTime(date.getTime()+(minutes*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/information_society";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

// - - - - - - - - - - - - - - - - - - - - - - - Menu activation for dumb browsers
// Sons of Suckerfish. Thanks to Dan Webb & HTMLDog (find reference)

sfHover = function() {
	if (! document.getElementById("nav")) return;
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
		var subAs = sfEls[i].getElementsByTagName("A");
			
	}
	var sfEls = document.getElementById("nav").getElementsByTagName("SPAN");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" spanhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" spanhover\\b"), "");
		}
	}
}
/*
sfHover = function() {
	//$('#nav li').hover(function() {$(this).addClass('sfhover')},function() {$(this).removeClass('sfhover')});
	//$('#nav span').hover(function() {$(this).addClass('spanhover')},function() {$(this).removeClass('spanhover')});
	$('#nav li').bind('mouseover',function() {$(this).toggleClass("sfhover")});
	$('#nav li').bind('mouseout',function() {$(this).toggleClass("sfhover")});
	$('#nav span').bind('mouseover',function() {$(this).toggleClass("spanhover")});
	$('#nav span').bind('mouseout',function() {$(this).toggleClass("spanhover")});
};
*/
/*
sfHover = function() {
	$('#nav li').hover(
		function() {$(this).addClass('sfhover')},
		function() {$(this).removeClass('sfhover')}
	);
	$('#nav span').hover(function() {$(this).addClass('spanhover')},function() {$(this).removeClass('spanhover')});
};
*/
// Make suckerfish keyboard accessible (tabbing)
// http://carroll.org.uk/sandbox/suckerfish/bones2.html
mcAccessible = function() {
	if (! document.getElementById("nav")) return;
	var mcEls = document.getElementById("nav").getElementsByTagName("A");
	for (var i=0; i<mcEls.length; i++) {
		mcEls[i].onfocus=function() {
			this.className+=(this.className.length>0? " ": "") + "sffocus"; //a:focus
			this.parentNode.className+=(this.parentNode.className.length>0? " ": "") + "sfhover"; //li < a:focus
			if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
				this.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < a:focus
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className+=(this.parentNode.parentNode.parentNode.parentNode.parentNode.className.length>0? " ": "") + "sfhover"; //li < ul < li < ul < li < a:focus
				}
			}
		}
		mcEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sffocus\\b"), "");
			this.parentNode.className=this.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
			if(this.parentNode.parentNode.parentNode.nodeName == "LI") {
				this.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				if(this.parentNode.parentNode.parentNode.parentNode.parentNode.nodeName == "LI") {
					this.parentNode.parentNode.parentNode.parentNode.parentNode.className=this.parentNode.parentNode.parentNode.parentNode.parentNode.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
				}
			}
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", sfHover);


function breakout() {
	if (window.top != window.self) 
	{
		if (document.images) 
			window.top.location.replace(window.self.location.href);
		else
			window.top.location.href = window.self.location.href;
	}
}

// - - - - Live RHS
function findDynamicSection(){
	var fBodyClass,cid,newsBox,type,addParam,geturl,containerSearch;
	fBodyClass = document.body.className; 
	
	console.log("Fc findDynamicSection version 1.60");
	// console.log('body class = '+fBodyClass);
	cid=0;
	newsBox = '';
	containerSearch = '';	
	if (fBodyClass){
		if (fBodyClass.search(/\bnews\d+\b/) > -1) {
			var cid = fBodyClass.match(/\bnews(\d+)\b/)[1];
		}
	}
	// console.log('cid = '+cid);
	containerSearch = document.getElementById("cbgen"); //$("#cbgen");
	if(containerSearch) {
		newsBox = "cbgen";// "#cbgen"
		type = 'central';
		geturl = 'http://ec.europa.eu/information_society/newsroom/cf/textrhsrefresh.cfm?format=central2009&tpa=' + cid;

	}
	else {
		containerSearch = document.getElementById("rbgen"); //$("#context");
		if(containerSearch){
			newsBox = "rbgen"; // "#context"
			type = 'rhc';
			geturl = 'http://ec.europa.eu/information_society/newsroom/cf/textrhsrefresh.cfm?format=right2009&tpa=' + cid;
		}
	}
	// console.log('containerSearch.length = '+containerSearch.length); 
	// console.log('url = '+geturl);
	// console.log('type = '+type);
	// console.log('newsBox = '+newsBox);
	//console.log(document.getElementById(newsBox));
	if (containerSearch) {
		nb = document.getElementById(newsBox);
		addParam = getAddParam2(nb);		
		if (!cid){
			addParam = addParam+"&fromURL="+document.location.href;			
		}
		geturl = geturl + addParam;
		var dummy = new Ajax({
			url: geturl,
			onSuccess:function(text) {
				nb.innerHTML = text;
				if (bindDocTracker) bindDocTracker();
			}
		});
	}	
}

function getAddParam2(aContainer){
	var addParam,aContainerClass;
	addParam = "";
	//console.log(aContainer);
	//aContainerClass = aContainer.attr("class");
	aContainerClass = aContainer.className;

	//console.log("class container = "+aContainerClass);
	if (aContainerClass) {
		if (aContainerClass.search('nolibrary') > -1) {
			addParam = addParam+"&nolibrary=1";
		}
		if (aContainerClass.search('nonews') > -1) {
			addParam = addParam+"&nonews=1";
		}
		if (aContainerClass.search('nofunding') > -1) {
			addParam = addParam+"&nofunding=1";
		}
		if (aContainerClass.search('nocalendar') > -1) {
			addParam = addParam+"&nocalendar=1";
		}
	}
	return addParam;
}




// - - - - addLoadEvent: add instructions to the windows onload event without replacing possible existing code
// thanks to Simon Willison for this one
// http://simon.incutio.com/archive/2004/05/26/addLoadEvent

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

// - - - - All we want to do when something happens to the window object
addLoadEvent(function(e) {
	//breakout();
	setActiveStyleSheet();	
	findDynamicSection(); // rhsRefresh();
  clearCurrentLink("langmenu"); // removing link only from language navigation, not from local menu
  // clearCurrentLink("langmenu","localnav"); // No link to current page - why was this removed?
  navigationControls();
  if (document.getElementById("presicons")) {document.getElementById("presicons").className = "gshow"};
  if (document.getElementById("navcontrols")) {document.getElementById("navcontrols").className = "lshow"};
  //if (document.getElementById("navcontainer")) {document.getElementById("navcontainer").style.display = "block"};
  mcAccessible(); // sons of suckerfish keyboard accessible (the suckerfish script itself is loaded via attachEvent, since it is only needed for IE

  var lang = document.getElementsByTagName("HTML")[0].lang || 'en';
  //new Ajax({url:"/information_society/globnav_" + $('html').attr('lang') + ".txt",onSuccess:function(text) {$("#nav").html(text);}});
  if (document.getElementById("navcontainer")) {
    new Ajax({
    	url:"/information_society/globnav_" + lang + ".html",
    	//url:"/information_society/globnav_es_new_encode.html",
    	onSuccess:function(text) {
    		document.getElementById("nav").innerHTML = unescape(text);
    		//$("#nav").html(unescape(text));
          	if (window.attachEvent) {
          		sfHover();
          	}
          	mcAccessible();
  			splitter();
    	}
    });
  }

});

/*
// Stop saving the style information as it confuses users. We need to build the alternate style sheet in some other way.
// See also the setActiveStyleSheet function, where I removed the readCookie call for the same reason
window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 20);
}
*/

// - - - - addEvent
function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    return false;
  }
}

/* Ajax library
 * This a very raw Ajax library, only supporting for the time being
 * the GET method.
 * Things to do:
 * - Better Error handling using the javascript error object
(properties: message (description in IE5), number))
 *   Possibly create own error object to return, say as second
argument which should merge javascript error and
 *   XMLHttpRequest status (properties statusText and status).
 *   Probably, openHttpRequest should return (or set) my own status
property object, allowing sendHttp to
 *   return something more informative
 * - Make sure there are no memory leaks
 * - Add POST method handling.
 * - Create a simple Updater object sending retrieved info to an
indetified target
 * - Create a simple PeriodicalUpdater object repeating a call every X seconds
 * 
 * UPDATE 4/1/2007: added a stripWddx boolean (default is false) property to the parameter object.
 * If set to true, the returned text will be stripped of the wddx tags before it is passed to the Success callback function
 * Use with remote calls to cf components.
 * 
 * UPDATE 22/2/2007: added a onEnd function (default is a function that does nothing) property to the paramater object.
 * The function will be invoked always, whatever the result is (success or failure), after the onSuccess/onError function
 * the onSuccess parameter becomes optional: both because you can simply use onEnd to respond to ANY call result
 * and because this enables you to issue a 'send-and-forget' call.
 * 
**/

function Ajax(ob) {
	this.method = (ob.method || "GET");
	this.allowCache = (ob.allowCache || false);
	this.url = ob.url;
	if ((typeof this.allowCache) == 'number') {
		this.url = this.url + (this.url.indexOf("?")==-1 ? "?" : "&") + "ajaxtime=" + Math.round((new Date()).getTime()/(1000*this.allowCache));
	} else if (!this.allowCache) {
		this.url = this.url + (this.url.indexOf("?")==-1 ? "?" : "&") + "ajaxtime=" + (new Date()).getTime();
	}
	this.onSuccess = (ob.onSuccess ? ob.onSuccess : function() {});
	this.mode = (ob.mode ? ob.mode : "text");
	this.onError = (ob.onError ? ob.onError : function() {});
	this.onEnd = (ob.onEnd ? ob.onEnd : function() {});
	this.onBegin = (ob.onBegin ? ob.onBegin : function() {});
	this.httpRequest = null;
	this.errorNumber = 0;
	this.errorMessage = "";
	this.stripWddx = ob.stripWddx || false;
	this.treat = function(text) {return this.stripWddx ? this.wddxStripper(text) : text};
	this.sendHttp();
}

Ajax.prototype.wddxStripper = function (text) {
	return text.replace(/<.*?>/gi,'').replace(/[\t\r\n]/g,'').trim();
}

Ajax.prototype.sendHttp = function() {
	this.openHttpRequest();
	if (this.httpRequest) {
			//have the 'wait' here?
			try {
				this.httpRequest.open(this.method, this.url, true);
				this.httpRequest.send(null);
			}
			catch(er) {
				this.httpRequest = null;
				this.errorNumber = er.number;
				this.errorMessage = er.message || er.description || "Undescribed error";
				this.onError(this.errorMessage + " (" + this.errorNumber + ")");
				this.onEnd(this);
			}
	}
	else {
		this.onError(this.errorMessage + " (" + this.errorNumber + ")");
		this.onEnd(this);
	}
}

Ajax.prototype.openHttpRequest = function() {
	var me=this;
	this.httpRequest = this.createXMLHttpRequest();
	if (this.httpRequest) {
		this.httpRequest.onreadystatechange = function() {me.receiveHttp();};
	}
	return;
}

Ajax.prototype.createXMLHttpRequest = function() {
	try { return new XMLHttpRequest( ); } catch(e) {}
	try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
	try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
	this.errorNumber = -1;
	this.errorMessage = "XMLHttpRequest is not supported";
	return null;
}

Ajax.prototype.receiveHttp = function() {
	if ( this.httpRequest.readyState != 4 ) return ;
	if ( this.httpRequest.status != 200 )
		this.onError(this.httpRequest.statusText + " (" + this.httpRequest.status + ")");
	else if (this.mode == "xml")
		this.onSuccess(this.httpRequest.responseXML);
	else
		this.onSuccess(this.treat(this.httpRequest.responseText));
	this.onEnd(this);
	delete this.httpRequest;
}


document.write(unescape("%3Cscript src='http://www.google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

function runTracker() {
 	if (_gat !== undefined) {
		var pageTracker = _gat._getTracker("UA-3076907-3");
		pageTracker._initData();
		pageTracker._trackPageview();
	} else {
		setTimeout(runTracker,100);
	}
}

setTimeout(runTracker,100);