<!--

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
/**
*
*  Javascript trim, ltrim, rtrim
*  http://www.webtoolkit.info/
*
**/
 
function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

// -----------------------------------------------------------------------------------
//
//	Lightbox v2.04
//	by Lokesh Dhakar - http://www.lokeshdhakar.com
//	Last Modification: 2/9/08
function getPageSize() {
var xScroll, yScroll;

if (window.innerHeight && window.scrollMaxY) {	
	xScroll = window.innerWidth + window.scrollMaxX;
	yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
	xScroll = document.body.scrollWidth;
	yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
	xScroll = document.body.offsetWidth;
	yScroll = document.body.offsetHeight;
}

var windowWidth, windowHeight;

if (self.innerHeight) {	// all except Explorer
	if(document.documentElement.clientWidth){
		windowWidth = document.documentElement.clientWidth; 
	} else {
		windowWidth = self.innerWidth;
	}
	windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
	windowWidth = document.documentElement.clientWidth;
	windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
	windowWidth = document.body.clientWidth;
	windowHeight = document.body.clientHeight;
}	

var pageWidth,pageHeight;

// for small pages with total height less then height of the viewport
if(yScroll < windowHeight){
	pageHeight = windowHeight;
} else { 
	pageHeight = yScroll;
}

// for small pages with total width less then width of the viewport
if(xScroll < windowWidth){	
	pageWidth = xScroll;		
} else {
	pageWidth = windowWidth;
}

return [pageWidth,pageHeight];
	}

/**
 * Functions
 * @package CoMa
 * @subpackage inc
 * @author Birgit Kohl <bk@pixelwings.com>, Stefan Lingler <sl@pixelwings.com>
 * @copyright Pixelwings Medien GmbH
 */
/*
* Gallery START
*/
var gallery=function(c) {
	
	var g=this;
	this.c=c;
	this.t=document.getElementById(this.c.t);
	this.p=[];
	
	this.init=function() {
		if (this.t==undefined || this.c.i.length==0) return false;
		var a,b,c,d,e,z;
		
		this.i=document.createElement('img');
		this.i.setAttribute('id',this.t.id+'_i');
		
		z=document.createElement('div');
		if (this.c.c.images) z.className=this.c.c.images;
		z.appendChild(this.i);
		
		b=['next','prev'];
		d=document.createElement('div');
		for (a=0;a<b.length;a++) {
			c=document.createElement('div');
			if (this.c.c[b[a]]) c.className=this.c.c[b[a]];
			/*
			e=document.createElement('a');
			e.setAttribute('href','javascript:void(0);');
			e.onclick=g[b[a]];
			e.innerHTML=this.c.a[b[a]]?this.c.a[b[a]]:b[a];
			c.appendChild(e);
			*/
			c.innerHTML=this.c.a[b[a]]!=undefined?this.c.a[b[a]]:b[a];
			c.g=this;
			c.onclick=this[b[a]];
			d.appendChild(c);
		}
		this.t.appendChild(z);
		this.t.appendChild(d);
		
		this.load('first');
	};
	this.prev=function() {
		this.g.load('prev');
	};
	this.next=function() {
		this.g.load('next');
	};
	this.load=function(e) {
		this.k=this.getK(e);
		document.getElementById(this.t.id+'_i').setAttribute('src',this.c.i[this.k]);
		if (e=='first' || e=='last') {
			this.preload(this.c.i[this.getK('next')]);
			this.preload(this.c.i[this.getK('prev')]);
		}
		else this.preload(this.c.i[this.getK(e)]);
	};
	this.getK=function(e) {
		var a=this.k;
		a=a!=undefined?a:0;
		switch (e) {
			case 'first':
				a=0;
			break;
			case 'last':
				a=(this.c.i.length-1);
			break;
			case 'prev':
				a=(a-1)<0?(this.c.i.length-1):(a-1);
			break;
			case 'next':
				a=(a+1)==this.c.i.length?0:(a+1);
			break;
		}
		return a;
	}
	this.preload=function(e) {
		if (!this.preloaded(e)) {
			MM_preloadImages(e);
			this.p.push(e);
		}
	}
	this.preloaded=function(e) {
		for (var a=0;a<this.p.length;a++) {
			if (e==this.p[a]) return true;
		}
		return false;
	}
	this.init();
	return this;
};
/*
* Gallery STOP
*/
function cc(e,c,s,t) {
	/*
	* e the document element or name of the document element or array of document element names
	* c new class name or suffix (see s) for example
	* s set s to true if c is a suffix to the existing class name.
	* t toggle previous and new class names
	*/
	if (!e) return false;
	var a;
	if (typeof(e)=='object') {
		for (a=0;a<e.length;a++) {
			cc(e[a],typeof(c)=='object'?c[a]:c,s,t);
		}
	}
	if (typeof(e)=='string') e=document.getElementById(e);
	if (e==undefined || (!c && e.cc_prev==undefined)) return false;
	//if (window.globals.debug) alert(e.id+' '+e.className);
	e.className=e.className!=undefined?e.className:'';
	a=e.className;
	if (t) e.className=e.cc_prev!=undefined?e.cc_prev:c;
	else e.className=(s?e.className:'')+(c?c:e.cc_prev);
	e.cc_prev=a;
	return true;
}



function updateDate_archive_on(o,d,f)	{ return updateDate('archive_on',o,d,f); }
function updateDate_date_from(o,d,f)	{ return updateDate('date_from',o,d,f); }
function updateDate_date_to(o,d,f)	{ return updateDate('date_to',o,d,f); }
function updateDate_date(o,d,f)	{ return updateDate('date',o,d,f); }
function updateDate(i,o,d,f) {
	if (!document.getElementById(i+'_out')) return false;
	f=f?f:(window.globals.layout=='site'?'form':'content');
	var a=o || d?' <a href="javascript:void(0);" onclick="javascript:updateDate_'+i+'(null,null,\''+f+'\');return false;">'+window.globals.dict.remove+'</a>':'';
	document.getElementById(i+'_out').innerHTML=o?o.getPHPDate(window.globals.date_format)+a:(d?d+a:window.globals.dict.please_choose);
	if (!o && !d) document.forms[f][i].value='';
	return true;
}
function initDateChooser(f,d) {
	var sDate,date,uf;
	for (var i=0;i<f.length;i++) {
		if (!document.getElementById(f[i]+'_out')) continue;
		date=d[i];
		date=date.split('-');
		sDate=date.length==3?new Date(date[0],(date[1]-1),date[2]):false;
		date=document.getElementById(f[i]+'_out');
		date.DateChooser=new DateChooser();
		date.DateChooser.setWeekStartDay(1);
		uf={};
		uf[f[i]]='Y-m-d';
		date.DateChooser.setUpdateField(uf);
		date.DateChooser.setUpdateFunction(eval("updateDate_"+f[i]));
		if (sDate) date.DateChooser.setStartDate(sDate);
		date.DateChooser.setIcon('/_inc/datechooser/datechooser.gif',f[i]+'_out');
	}
	return true;
}




/*
* HttpRequest START
*/
var sp_stack=0;
var sp_to=null;
function HttpRequest(c) {
	if (window.XMLHttpRequest) var req=new XMLHttpRequest();
	else if (window.ActiveXObject) var req=new ActiveXObject("Microsoft.XMLHTTP");

	var res=null;
	
	var parameter='';
	
	if (c.parameter!=undefined) {
		for (var i in c.parameter) {
			var e=c.parameter[i];
			if (e!=null) {
				parameter+=i+'='+encodeURIComponent(e)+'&';
			}
		}
	}
	
	sp_stack++;
	req.open((c.method?c.method:'GET'),c.url,true);
	req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	req.onreadystatechange=function () {
		if (req.readyState==4) {
			if (req.status==200) {
				res=eval("("+(req.responseText?req.responseText:"{status:'"+(c.parameter.sp?c.parameter.sp+': ':'')+"no data'}")+")");
			}
			sp_hide_overlay();
		}
		else {
			sp_show_overlay();
			if (req.readyState!=0) res=eval("({status:'"+(c.parameter.sp?c.parameter.sp+': ':'')+"loading...'})");
		}
		
		if (typeof(window[c.callback])=='function') {
			window[c.callback](res,(c.args?c.args:false));
		}
	};
	req.send(parameter);
}
function showHttpRequestStatus(a,b,c,d,e) {
	hideHttpRequestStatus();
	var s;
  s=document.getElementById('http_request_'+(e?e+'_':'')+(c?c:'status'));
  if (s!=undefined) {
		if (a) {
			cc(s,(s.className?s.className+' ':'')+'visible');
			s.innerHTML=a+(d?'<div class="line"></div>':'');
			if (!isNaN(b)) {
				setTimeout('hideHttpRequestStatus(\''+c+'\''+(e?',\''+e+'\'':'')+')',b*1000);
			}
		}
	}
}
function hideHttpRequestStatus(a,e) {
	var s;
  s=document.getElementById('http_request_'+(e?e+'_':'')+(a?a:'status'));
  if (s!=undefined) {
		cc(s,'hidden');
	}
}
function executeSp(r,args) {
	var a,b,c,p;
	if (!r) {
		HttpRequest({url:(args.url?args.url:globals.url)+(!args.no_param?'?'+(window.globals._g.style?'style='+window.globals._g.style+'&':'')+'mode=js_sp':''),method:'POST',parameter:args,callback:'executeSp',args:args});
	}
	else {
		var m,t;
		if (r.error) {
			m=r.error;
			t=undefined;
			cc('http_request_'+(r.id_message?r.id_message+'_':'')+'message','error');
		}
		else if (r.success) {
			m=r.success;
			t=3;
			cc('http_request_'+(r.id_message?r.id_message+'_':'')+'message','success');
		}
		if (m) showHttpRequestStatus(m,t,'message',r.id_message?false:true,r.id_message?r.id_message:false);
		else hideHttpRequestStatus('message');
		if (r.status) showHttpRequestStatus(r.status,1,'status');
		
		
		if (r.html!=undefined) r.html=trim(r.html);
		if (r.t) {
			c=document.getElementById(r.t);
			if (c) {
    		if (r.html!=undefined)	c.innerHTML=r.html;
    		else if (r.value) c.value=r.value;
  		}
		}
		if (r.cb && typeof(window[r.cb])=='function') {
			window[r.cb](r);
		}
	}
	return true;
}
function sp_resize_overlay() {
	var ps,o,l,w,h;
	o=document.getElementById('sp_overlay');
	l=document.getElementById('sp_overlay_loading');
	if (!o) return false;
	ps=getPageSize();
	o.style.width=ps[0]+'px';
	o.style.height=ps[1]+'px';
	if (l) {
		w=window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;
		h=window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;
		l.style.left=Math.round(w/2)+'px';
		l.style.top=Math.round(h/2)+'px';
	}
	return true;
}
function sp_show_overlay() {
	if (window.globals.template=='newsletter' && window.globals._g.mode=='emit') return false;
	if (sp_to==null) {
		sp_to=window.setTimeout("cc('sp_overlay','visible');",2000);
	}
}
function sp_hide_overlay() {
	sp_stack--;
	if (sp_stack==0) {
		if (sp_to) clearTimeout(sp_to);
		sp_to=null;
		cc('sp_overlay','hidden');
	}
}
function sp_overlay_setmessage(m,a) {
	i=document.getElementById('sp_overlay_message');
	if (i) {
		if (a) i.innerHTML+=m+'<br />';
		else i.innerHTML=m;
	}
}
/*
* HttpRequest STOP
*/

function getValue(e) {
	var a,b;
	if (e.length) {
  	for (a=0;a<e.length;a++) {
  		if (e[a].checked) {
  			b=e[a].value;
  			break;
  		}
  	}
	}
	return b?b:false;
}
function printDebug(i) {
	if (i && (window.globals.debug || globals.debug)) {
		alert(i);
	}
}


function number_format( number, decimals, dec_point, thousands_sep ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     bugfix by: Michael White (http://getsprink.com)
    // +     bugfix by: Benjamin Lupton
    // +     bugfix by: Allan Jensen (http://www.winternet.no)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +     bugfix by: Howard Yeend
    // +    revised by: Luke Smith (http://lucassmith.name)
    // +     bugfix by: Diogo Resende
    // *     example 1: number_format(1234.56);
    // *     returns 1: '1,235'
    // *     example 2: number_format(1234.56, 2, ',', ' ');
    // *     returns 2: '1 234,56'
    // *     example 3: number_format(1234.5678, 2, '.', '');
    // *     returns 3: '1234.57'
    // *     example 4: number_format(67, 2, ',', '.');
    // *     returns 4: '67,00'
 
    var n = number, prec = decimals, dec = dec_point, sep = thousands_sep;
    n = !isFinite(+n) ? 0 : +n;
    prec = !isFinite(+prec) ? 0 : Math.abs(prec);
    sep = sep == undefined ? ',' : sep;
 
    var s = n.toFixed(prec),
        abs = Math.abs(n).toFixed(prec),
        _, i;
 
    if (abs > 1000) {
        _ = abs.split(/\D/);
        i = _[0].length % 3 || 3;
 
        _[0] = s.slice(0,i + (n < 0)) +
              _[0].slice(i).replace(/(\d{3})/g, sep+'$1');
 
        s = _.join(dec || '.');
    } else {
        s = abs.replace('.', dec_point);
    }
 
    return s;
}
-->