/*@cc_on @*/

function getById(el) {
	return document.getElementById(el);
}

function getByTag(par,el) {
	var par = (par == '') ? document.body : par;
	if (!par) return new Array();
	return par.getElementsByTagName(el);
}

function addClass(obj,newClass) {
	if(!obj.className.match(new RegExp(newClass)))
		obj.className+=(obj.className.length>0? " ": "") + newClass;
}
	
function removeClass(obj,oldClass) {
	obj.className=obj.className.replace(new RegExp("( ?|^)"+oldClass+"\\b"), "");
}

function getByClass(cla,par,el) {
	var getEls;
	if (/.*native code.*/.test(document.getElementsByClassName)) {
		getEls = function(cla,par,el) { 
			return par.getElementsByClassName(cla);
		}
	}
	else { 
		getEls = function(cla,par,el) { 
			var tagColl = par.getElementsByTagName(el);
			trimedColl = new Array;
			for (var i = 0; tagColl[i]; i++) {
				if(tagColl[i].className.match(new RegExp("( ?|^)"+cla+"\\b")))
					trimedColl[trimedColl.length]=tagColl[i];
			}
			return trimedColl;
		} 
	} 
	getByClass = function(cla,par,el) {
		var par = (!par||(par == '')) ? document.body : par;
		var el = (el == '') ? '*' : el;
		return getEls(cla,par,el); 
	}
	return getByClass(cla,par,el);
}

function getStyle(obj,cssRule) {
	if (document.defaultView && document.defaultView.getComputedStyle) {
		getStyle = function(obj,cssRule) {
			return document.defaultView.getComputedStyle(obj, "").getPropertyValue(cssRule);
		};
	}
	else {
		getStyle = function(obj,cssRule) {
			if (obj.currentStyle) {
				cssRule = cssRule.replace(/\-(\w)/g, function (match, p1) {
					return p1.toUpperCase();
				});
				return obj.currentStyle[cssRule];
			}
		};
	}
	return getStyle(obj,cssRule);
}

function hasBorderRadius() {
	if((document.body.style.BorderRadius !== undefined) || (document.body.style.MozBorderRadius !== undefined) || (document.body.style.WebkitBorderRadius !== undefined))
		hasBorderRadius = function() {return true;};
	else
		hasBorderRadius = function() {return false;};
	return hasBorderRadius();
}

function findPosition( oElement ) {
  if( typeof( oElement.offsetParent ) != 'undefined' ) {
    for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
      posX += oElement.offsetLeft;
      posY += oElement.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oElement.x, oElement.y ];
  }
}

function getPageY() {
	var docHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
	// Order maters here as for IE 6 documentElement.clientHeight != body.clientHeight
	var docScrollY = document.documentElement.scrollTop || document.body.scrollTop;
	return [docHeight,docScrollY];
}

var addEvent = function() {
  if (window.addEventListener) {
    return function(el, type, fn) {
      el.addEventListener(type, fn, false);
    };
  } else if (window.attachEvent) {
    return function(el, type, fn) {
      var f = function() {
        fn.call(el, window.event);
      };
      el.attachEvent('on' + type, f);
    };
  }
}();

function GET_XMLHTTPRequest() {
	var request;
	try{
		request = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch(ex1){
		try{
			request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(ex2){
			try{
				request = new ActiveXObject("Msxml3.XMLHTTP");
			}
			catch(ex3){
				request = null;
			}
		}
	}
	if(!request && typeof XMLHttpRequest != "undefined"){
		request = new XMLHttpRequest();
	}
	return request;
}


/* Fancy field stuff
---------------------- */
function setFancyFields(){
	var labelColl = getByClass('fancyField',getById('page'),'label');
	for(var i = 0; i < labelColl.length; i++) {
		var spansA = getByTag(labelColl[i],'span');
		var spanI = spansA[spansA.length-1];
		var fieldI = getByTag(labelColl[i],'input')[0];
		if( spanI && fieldI ){
			if(fieldI.type == 'password') {
				var fieldN = document.createElement('input');
				fieldN.type= "text";
				fieldN.value = fieldI.title = spanI.childNodes[0].nodeValue;
				fieldN.id = fieldI.id;
				fieldN.name = fieldI.name;
				fieldI.parentNode.replaceChild(fieldN,fieldI);
				addClass(fieldN,"password");
				addEvent(fieldN, 'focus', function(e) {
					if(this.value==getByTag(this.parentNode,'span')[0].childNodes[0].nodeValue)
						this.value='';
						addClass(this,'straight');
						if(/password/.test(this.className)) {
							var fieldP = document.createElement('input');
							fieldP.type= "password";
							fieldP.setAttribute("value","");
							fieldP.id = this.id;
							fieldP.name = this.name;
							fieldP.className='straight';
							this.parentNode.replaceChild(fieldP,this);
							setTimeout("document.getElementById('"+fieldP.id+"').focus()",1);
						}
				});
			}
			else {
				if (spanI.childNodes.length) {
					fieldI.value = fieldI.title = spanI.childNodes[0].nodeValue;
					addEvent(fieldI, 'focus', function(e) {
						if(this.value==getByTag(this.parentNode,'span')[0].childNodes[0].nodeValue)
							this.value='';
						addClass(this,'straight');
					});
				}
			}
		}
	}
}


function fnOpenWindow(url,parameters)
{
	parameters=parameters.replace(/\s+/g,'');

	var aParameters=parameters.split(',');
	var data=new Array();
	for (var i=0;i<aParameters.length;i++) {
		var pr=aParameters[i];
		var key = pr.substr(0,pr.indexOf('='));
		var value=pr.substr(pr.indexOf('=')+1);
		data[key]=value;
	}

	if ( (data['hposition'])&&(data['width'])&&(data['hposition']!='system') )
	{
		var posX=null;
		if (data['hposition']=='left')
		{
			posX=0;
		}
		if ( (window.screen)&&(window.screen.availWidth) )
		{
			if (data['hposition']=='center')
				posX=(window.screen.availWidth-data['width'])/2;
			if (data['hposition']=='right')
				posX=window.screen.availWidth-data['width'];
		}

		if (posX!=null)
			parameters+=",left="+parseInt(posX);
	}

	if ( (data['vposition'])&&(data['height'])&&(data['vposition']!='system') )
	{
		var posY=null;
		if (data['vposition']=='top')
		{
			posY=0;
		}
		if ( (window.screen)&&(window.screen.availHeight) )
		{
			if (data['vposition']=='center')
				posY=(window.screen.availHeight-data['height'])/2;
			if (data['vposition']=='bottom')
				posY=window.screen.availHeight-data['height'];
		}

		if (posY!=null)
			parameters+=",top="+parseInt(posY);
	}


	var oWnd=window.open(url,'',parameters);
	oWnd.focus();
}

function fnLoadIEFlvPlayer(elid, version, width, height, url)
{
	if (!document.getElementById) return;
	
	var flvStr="";
	flvStr+="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+version+"' width='"+width+"' height='"+height+"'>\n";
	flvStr+="<param name='movie' value='"+url+"' />\n";
	flvStr+="<param name='quality' value='high' />\n";
	flvStr+="<param name='wmode' value='transparent' />\n";
	flvStr+="<param name='scale' value='exactfit' />\n";
	flvStr+="<param name='bgcolor' value='#f7f7f7' />\n";
	flvStr+="</object>\n";
	
	var d = document.getElementById(elid);
	d.innerHTML = flvStr;
}


function setLinks(linkTags,prt){
	var linkCollection = [];
	for (var j = 0; linkTags[j]; j++) {
		linkCollection[j] = getByTag(prt,linkTags[j]);
		for (var i = 0; linkCollection[j][i]; i++) {
			if(/zoom/.test(linkCollection[j][i].getAttribute('rel'))) {
				new Zoom(linkCollection[j][i]);
			}
			else if(/bookmark|external|corporate|sponsor/.test(linkCollection[j][i].getAttribute('rel'))) {
				linkCollection[j][i].onclick = function(e) {
					if (!e) var e = window.event;
					if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey)
						return true;
					window.open(this.href);
					return false;
				}
			}
		}
	}
}

/* 
----- */
function displayFormField(id,disp)
{
	if (!document.getElementById) return;
	var oField=document.getElementById(id);
	if (!oField) return;
	oField.style.display= (disp) ? "":"none";
}

function toggleDepartements()
{
	if(!document.getElementById) return;

	var oCountry=document.getElementById("co");
	if (!oCountry) return;

	var oDep=document.getElementById("dptLabel");
	if (!oDep) return;
	
	if (oCountry.options[oCountry.selectedIndex].value=="fr")
		oDep.style.display="block";
	else
		oDep.style.display="none";
}

/* 
----- */
function fixIE() {
	var ju = getById('jumpers');
	if(ju) {
		var l = getByClass('lang',ju,'li');
		if(l&&l[0])
			l[0].innerHTML = ' | ' + l[0].innerHTML;
	}
	
	var ful = getByTag(getById('footer'),'ul');
	if(ful && ful[0]) {
		for (var i = 0; ful[i]; ++i) {
			var fli = getByTag(ful[i],'li');
			if(fli&&fli[1]) {
				for(var j = 1; fli[j]; ++j) {
					fli[j].innerHTML = ' | ' + fli[j].innerHTML;
				}
			}
		}
	}
}

function fixLowIE() {

}

function roundCorners() {
	if(hasBorderRadius()==true) return;
	var rnds = getByClass('rounded','','');
	if(rnds&&rnds[0]) {
		for(var i = 0; rnds[i]; ++i) {
			addClass(rnds[i],'roundFix');
			var r1 = document.createElement('span');
			r1.className = 'r r1';
			rnds[i].appendChild(r1);
			var r2 = document.createElement('span');
			r2.className = 'r r2';
			rnds[i].appendChild(r2)
			var r3 = document.createElement('span');
			r3.className = 'r r3';
			rnds[i].appendChild(r3)
			var r4 = document.createElement('span');
			r4.className = 'r r4';
			rnds[i].appendChild(r4)
		}
	}
}

function roundProjects() {
	if(hasBorderRadius()==true) return;
	var h = getById('head');
	if(h) {
		var ps = getByClass('projects',h,'div');
		if(ps&&ps[0]) {
			for(var i = 0; ps[i]; ++i) {
				var cs = (ps[i].className.split('projects-cs')[1]) ? ps[i].className.split('projects-cs')[1] : 0;
				addClass(ps[i],'projects-r-cs'+cs);
			}
		}
	}
}

/* Home projects
----- */
function setProjects() {
	var h = getById('head');
	if(h) {
		var prjs = getByClass('project',h,'div');
		if(prjs&&prjs[0]) {
			if(prjs[1])
				new ProjectRotator(h,prjs);
			else
				addClass(prjs[0],'current');
		}
	}
}

function ProjectRotator(h,prjs) {

	this.container = h;
	this.projects = [];
	this.rotationOrder = [];
	this.cId = 0;
	for (var i = 0; prjs[i]; ++i) {
		
		var prt = prjs[i].parentNode.parentNode;
		prjs[i].cs = 0;
		if(prt) {
			prjs[i].cs = (prt.className.split('projects-cs')[1]) ? prt.className.split('projects-cs')[1] : 0;
		}
		prjs[i].rId = prjs[i].id.split('project-')[1];
		prjs[i].cId = i;
		this.projects[prjs[i].rId] = prjs[i];
		this.rotationOrder[i] = prjs[i].rId;

	}


	this.rotationOrder.sort(function(a,b){return a - b});
	for(var i = 0; this.rotationOrder[i]; ++i) {
		if(/current/.test(this.projects[this.rotationOrder[i]].className))
			this.cId = i;
	}

	var prjContainers = getByClass('projects',this.container,'div');
	var cats = getByClass('cat',this.container,'div');
	if(prjContainers&&prjContainers[0]&&cats&&cats[0]){
		for(var i = 0; prjContainers[i]; ++i) {
			
			var s = document.createElement('span');
			s.className='cat-deco';
			var sHTML = '';
			for(var j = 0; prjContainers[j]; ++j) {
				if(j!=i) {
					var h2 = getByTag(cats[j],'h2')[0];
					var as=getByTag(h2,'a');
					if (as&&as[0]) {
						var a = as[0];
						sHTML+='<a href="'+a.href+'" class="deco-'+(j+1)+'"></a>';
					}
				}
			}
			s.innerHTML = sHTML;
			var c = getByClass('cat-cs'+(i+1),prjContainers[i].parentNode,'div');
			if(c&&c[0])
				c[0].appendChild(s);
			
			prjContainers[i].onmouseover = function(that) {
				return function() {
					clearTimeout(that.rTimeout);
				}
			}(this);
			prjContainers[i].onmouseout = function(that) {
				return function() {
					that.rotate('next');
				}
			}(this);
		}
	}
	this.max = this.rotationOrder.length-1;
	this.setNav();
	this.preload('next');
	this.preload('prv');
	this.rotate('next');
}

ProjectRotator.prototype = {
	shift: function(dir) {
		clearTimeout(this.rTimeout);
		var nId = this.getNext(dir);
		removeClass(this.projects[this.rotationOrder[this.cId]],'current');
		addClass(this.projects[this.rotationOrder[nId]],'current');
		var cs = this.container.className.split('head-cs')[1];
		var nCs = this.projects[this.rotationOrder[nId]].cs;
		if(cs!=nCs) {
			addClass(this.container,'head-cs'+nCs);
			removeClass(this.container,'head-cs'+cs);
		}
		this.cId = nId;
		this.preload(dir);
	},
	rotate: function(dir) {
		this.rTimeout = setTimeout(function (that) {
			return function () {
				that.shift('next');
				that.rotate('next');
			}
		}(this), 7500);
	},
	getNext: function(dir) {
		var nId = (dir == 'next') ? (((this.cId+1)>this.max) ? 0 : this.cId + 1) : (((this.cId-1)<0) ? this.max : this.cId - 1);
		return nId;
	},
	preload: function(dir) {
		var nId = this.getNext(dir);
		var nCs = this.projects[this.rotationOrder[nId]].cs;
		var c = 'head-cs'+nCs;
		var sp = getByClass(c,this.container,'span');
		if(sp&&sp[0]) return;
		var s = document.createElement('span');
		s.className = 'midget ' + c;
		this.container.appendChild(s);
	},
	setNav: function() {
		var prC = getByClass('projects',this.container,'div');
		if(!prC) return;
		for (var i = 0; prC[i]; ++i) {
			var nxt = document.createElement('a');
			nxt.href="#";
			nxt.className = 'next';
			nxt.innerHTML = ' » ';
			prC[i].appendChild(nxt);
			nxt.onclick = function(that) {
				return function() {
					that.shift('next');
					return false;
				}
			}(this);
			var prv = document.createElement('a');
			prv.href="#";
			prv.className = 'prev';
			prv.innerHTML = ' « ';
			prC[i].appendChild(prv);
			prv.onclick = function(that) {
				return function() {
					that.shift('prv');
					return false;
				}
			}(this);
		}
	}
}

/* Country dependency
---------------------- */
function initCountryDependencies() {
	var deps=getByClass("countryDependency",document,"fieldset");
	
	for (var i=0;i<deps.length;i++) {
		var countries=getByClass("countries",deps[i],"label");
		if (countries.length!=1) continue;
		
		var regions=getByClass("regions",deps[i],"label");
		if (regions.length!=1) continue;
		
		new CountryDependency(deps[i],countries[0],regions[0]);
	}
	
	
}
function CountryDependency(oHolder,oCountries,oRegions) {
	this.holder=oHolder;
	this.countries=oCountries;
	this.regions=oRegions;

	var sels=getByTag(oCountries,"select");
	sels[0].onchange = function (that) {
	        return function () {
			that.set(this.options[this.selectedIndex].value);
	        }
	}(this);
	
	this.repaint();
}

CountryDependency.prototype = {
	set: function(country) {
		var sels=getByTag(this.regions,"select");
		var selreg=sels[0];
		
		var req = GET_XMLHTTPRequest();
		if (req) {
			req.open("GET", "/api/regions.aspx?country="+country, true);
			req.setRequestHeader('User-Agent','XMLHTTP/1.0');
			req.onreadystatechange = function (that) {
		        return function (aEvt) {
					if (req.readyState != 4) return;
					if (req.status != 200 && req.status != 304) {
						return;
					}
		            if(req.readyState == 4){
						that.handleRequest(req);
				}
		        }
		    }(this);
			req.send(null);
		}
		


	},
	handleRequest: function(req) {
		var sels=getByTag(this.regions,"select");
		var selreg=sels[0];

		while ( selreg.hasChildNodes() )
			selreg.removeChild(selreg.firstChild);

		selreg.appendChild(document.createElement('option'))
		var regs=req.responseXML.getElementsByTagName("region");
		for (i=0;i<regs.length;i++) {
			option = selreg.appendChild(document.createElement('option'));
			option.value=regs[i].getAttribute("id");
			txt = document.createTextNode(regs[i].firstChild.nodeValue);
			option.appendChild(txt);
		}
		this.repaint();
	},
	repaint : function() {
		var sels=getByTag(this.regions,"select");
		var selreg=sels[0];
		
		if (selreg.options.length>1) {
			addClass(this.holder,"countryDependencyFilled");
		} else {
			removeClass(this.holder,"countryDependencyFilled");
		}
	}
}

/* Overlay
---------------------- */
function Zoom(a) {
	initOverlay();
	this.a = a;
	this.overlay = getById('overlay');
	this.container = getById('overlayContainer');
	this.w = 400;
	this.h = 250;
	this.t = 0;
	this.l = 0;
	this.a.onclick = function (that) {
        return function () {
            that.click(this.href);
			return false;
        }
    }(this);
}

Zoom.prototype = {
	click: function (file) {
		this.file = file + '&js=true';
		this.overlay.innerHTML = '<span id="loading"></span>';
		getById('loading').style.top = ((getPageY()[0] - 36) / 2) + getPageY()[1] + 'px';
		if(getById('ie6overlay'))
			removeClass(getById('ie6overlay'),'hidden');
		this.overlay.style.height = getById('page').offsetHeight + 'px';
		removeClass(this.overlay,'hidden');
		removeClass(this.container,'hidden');
		var req = GET_XMLHTTPRequest();
		if (req) {
			req.open("GET", this.file, true);
			req.setRequestHeader('User-Agent','XMLHTTP/1.0');
			req.onreadystatechange = function (that) {
		        return function (aEvt) {
					if (req.readyState != 4) return;
					if (req.status != 200 && req.status != 304) {
						that.handleError(req);
						return;
					}
		            if(req.readyState == 4){
						that.handleRequest(req);
					}
		        }
		    }(this);
			req.send(null);
		}
		else {
			getById('overlayContainer').innerHTML = 'Unable to load content';
			this.createNav();
			this.changePosition();
		}
	},
	changePosition: function () {
		this.container.style.width = this.w + 'px';
		this.container.style.height = this.h + 'px';
		this.container.style.marginLeft = -(this.w)/2 + 'px';
		var t = ((getPageY()[0] - this.h) / 2) + getPageY()[1];
		if(t < 0 ) {t = 0;}
		this.container.style.top = t + 'px';
		this.overlay.innerHTML = '';
	},
	handleRequest: function(req) {
		this.container.innerHTML = req.responseText;
		var innerContent = getById('overlayInnerContent');
		if(innerContent) {
			this.createNav();
			this.w = innerContent.offsetWidth;
			this.h = innerContent.offsetHeight;
			this.changePosition();
			var c = getByClass('content',this.container,'div');
			if(c&&c[0])
				setLinks(['a','area'],c[0]);
		}
	},
	handleError: function(req) {
		this.container.innerHTML = '<strong>Data error :</strong> HTTP error' + req.status + '';
		this.w = 400;
		this.h = 250;
		this.createNav();
		this.changePosition();
	},
	createNav: function () {
		if(!getById('overlayNav')){
			var div = document.createElement('div');
			div.id = 'overlayNav';
			this.container.appendChild(div);
		}
		this.nav = getById('overlayNav');
		this.nav.items = getByTag(this.nav,'a');
		for(var i = 0; this.nav.items[i]; i++) {
			new Zoom(this.nav.items[i]);
		}
		var c = document.createElement('a');
		c.href= "#";
		c.className = "closer";
		c.onclick = function (that) {
	        return function () {
				that.close();
				return false;
			}
		}(this);
		this.closer = this.nav.appendChild(c);
	},
	close: function () {
		addClass(this.container,'hidden');
		addClass(this.overlay,'hidden');
		if(getById('ie6overlay'))
			addClass(getById('ie6overlay'),'hidden');
		this.container.innerHTML = '';
		return false;
	}
}

function initOverlay () {
	if(!getById('overlay')) {
		var ov = document.createElement('div');
		ov.id = "overlay";
		ov.className = 'hidden';
		ov.style.height = getById('page').offsetHeight + 'px';
		document.getElementsByTagName('body')[0].appendChild(ov);
		/*@if (@_win32)
			if(ie_rv < 7) {
				var f = document.createElement('iframe');
				f.id= 'ie6overlay';
				f.className = 'hidden';
				document.getElementsByTagName('body')[0].appendChild(f);
			}
		/*@end @*/
	}

	if(!getById('overlayContainer')) {
		var ovCt = document.createElement('div');
		ovCt.id = "overlayContainer";
		ovCt.className = 'hidden';
		document.getElementsByTagName('body')[0].appendChild(ovCt); 
	}
}

function testTextSheet() {
	var s = document.styleSheets;
	for(var i = 0; i < s.length; ++i) {
		if(s[i].disabled==false) {
			var h = s[i].href;
			if(h&&/css\/text/.test(h))
				return true;
		}
	}
	return false;
}


/* Search form trigger
----- */
function setSFTrigger () {
	var t = getById('sfTrigger');
	if(!t) return;
	var tgts = getByClass('sfTarget','','');
	if(!tgts||!tgts[0]) return;
	if(hasBorderRadius()==false){
		addClass(t,'roundFix');
		addClass(t,'rounded');
		var s1 = document.createElement('span');
		s1.className = 'r r1';
		t.appendChild(s1);
		var s2 = document.createElement('span');
		s2.className = 'r r2';
		t.appendChild(s2);
	}
	txt = (/i18n-en/.test(getByTag('','body')[0])) ? ['Search','Close']: ['Recherche','Fermer'];
	
	if (typeof(sfTriggerOpen)!='undefined') txt[0]=sfTriggerOpen;
	if (typeof(sfTriggerClose)!='undefined') txt[1]=sfTriggerClose;
	
	new SFTrig(t,tgts,txt);
}


function SFTrig(t,tgts,txt) {
	this.t = t;
	this.tgts = tgts;
	this.txt = txt;
	var a = document.createElement('a');
	a.innerHTML = /close/.test(t.className) ? txt[0] : txt[1];
	a.href= '#';
	t.appendChild(a);
	this.a = a;
	this.a.onclick = function (that) {
        return function () {
			that.toggle();
			return false;
		}
	}(this);
	
	if(/close/.test(t.className)) {
		for(var i = 0; this.tgts[i]; ++i) {
			addClass(this.tgts[i],'closed');
		}
	}

}

SFTrig.prototype = {
	toggle: function (file) {
		if(/close/.test(this.t.className)) {
			removeClass(this.t,'close');
			for(var i = 0; this.tgts[i]; ++i) {
				removeClass(this.tgts[i],'closed');
			}
			this.a.innerHTML = this.txt[1];
		}
		else {
			addClass(this.t,'close');
			for(var i = 0; this.tgts[i]; ++i) {
				addClass(this.tgts[i],'closed');
			}
			this.a.innerHTML = this.txt[0];
		}
	}
}

/* Google Analytics
----- */
function addGoogleAnalytics() {
	if(typeof(gaJsTrackerId)!='string') return;
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	var ga = document.createElement('script');
	document.getElementsByTagName('head')[0].appendChild(ga);
	ga.onload = function() {
		try {
		var pageTracker = _gat._getTracker(gaJsTrackerId);
		pageTracker._trackPageview();
		} catch(err) {}
	}
	ga.src = gaJsHost + 'google-analytics.com/ga.js';
}

/* Weborama
----- */
function addWeboramaStats() {
	if( (typeof(WRP_SECTION) == 'undefined') || (typeof(WRP_CONTENT) == 'undefined') || (typeof(WRP_ID) == 'undefined') ) return;

	var wreport_ok=0;
	var w = document.createElement('script');
	document.getElementsByTagName('head')[0].appendChild(w);
	w.onload = function() {
		if(wreport_ok==1){ var w_counter = new wreport_counter(WRP_SECTION, WRP_SUBSECTION, WRP_ID, WRP_ACC, WRP_CHANNEL, WRP_SECTION_GRP, WRP_SUBSECTION_GRP);
		w_counter.add_content(WRP_CONTENT);
		w_counter.count();}
	}
	w.src = '/elements/js/wreport.js';
}


/* Init
-------------------- */
var init = function() {
	if (arguments.callee.done) return;
	arguments.callee.done = true;
	if(!document.getElementsByTagName)
		return;
	
	addClass(getById('page'),'scripted');
	setLinks(['a','area'],'');
	setFancyFields();
	roundCorners();
	roundProjects();
	setProjects();
	setSFTrigger();
	initCountryDependencies();

	var oCountry=document.getElementById("co");
	if (oCountry) {
		oCountry.onchange=toggleDepartements;
		toggleDepartements();
	}

	/*@if (@_win32)
		if(ie_rv < 7) fixLowIE();
		if(ie_rv < 8) fixIE();
	/*@end @*/
	
	addGoogleAnalytics();
	addWeboramaStats();

}


if (/WebKit/i.test(navigator.userAgent)) {
	var _timer = setInterval(function() {
		if (/loaded|complete/.test(document.readyState)) {
			clearInterval(_timer);
			init();
		}
	}, 10);
}

else if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", init, null);
}

else {
	/*@if (@_win32)
		var ie_ua = navigator.userAgent;
		var ie_re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
		if (ie_re.exec(ie_ua) != null) ie_rv = parseFloat( RegExp.$1 );
		if(ie_rv < 6) {var init = function() {}};
		document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() {
			if (this.readyState == "complete")
				init();
				
		};
	/*@end @*/
	window.onload = init;
}
