var myrules = {
		'#footer' : function(element){
			if (element.rel == 'external') {
				element.target = "_blank";
			}
		},
		'#top a' : function(element){
			if (element.rel == 'external') {
				element.target = "_blank";
			}
		}
		/*'#banner img' : function(element){
			CreateSlideShow(element,6000,2,"/fileadmin/images/trade2.jpg","/fileadmin/images/trade3.jpg","/fileadmin/images/trade4.jpg","/fileadmin/images/trade1.jpg")

		}*/
		
	};
	
	Behaviour.register(myrules);
	
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 var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

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;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
	
function fontS(n) {
	var s = '75%';
	switch (n) {
		case 0: var nou=true;
		case 1: s = '70%'; break
		case 2: s = '75%'; break
		case 3: s = '90%'; break
		default: s = '75%';
	}
	
	var x = readCookie('fontS');
	if (!x||!nou) createCookie('fontS',s,365); 
	else s = x;
	
	document.body.style.fontSize = s;
}



function RunSlideShow(id){
	if( document.SlideShowArray[id] )
	{
		if( document.SlideShowArray[id].preLoad[document.SlideShowArray[id].j].complete )
		{
			if (document.all){
				document.SlideShowArray[id].object.style.filter="blendTrans(duration=" + document.SlideShowArray[id].crossFadeDuration + ")"
				document.SlideShowArray[id].object.filters.blendTrans.Apply()      
			}
			document.SlideShowArray[id].object.src = document.SlideShowArray[id].preLoad[document.SlideShowArray[id].j].src
			if (document.all){
				document.SlideShowArray[id].object.filters.blendTrans.Play()
			}
			document.SlideShowArray[id].j = document.SlideShowArray[id].j + 1
			if (document.SlideShowArray[id].j > (document.SlideShowArray[id].p-1)) document.SlideShowArray[id].j=0
		}
		setTimeout('RunSlideShow(\"' + id + '\")', document.SlideShowArray[id].slideShowSpeed)
	}
}

function SlideShowObject(imgObject, arguments)
{
	this.object = imgObject
	this.slideShowSpeed = arguments[1]
	this.crossFadeDuration = arguments[2]
	this.Pic = new Array()
	
	for (i=3; i < (arguments.length); i++) {
		this.Pic[i-3] = arguments[i]
	}
	
	this.j = 0
	this.p = this.Pic.length
	
	this.preLoad = new Array()
	for (i = 0; i < this.p; i++){
	   this.preLoad[i] = new Image()
	   this.preLoad[i].src = this.Pic[i]
	}
}

// Params: imgObject, slideShowSpeed, crossFadeDuration, slideShowImages
// eg: <img src="slideshow1.jpg" onload="CreateSlideShow(this,4000,2,'slideshow2.jpg','slideshow3.jpg','slideshow1.jpg')">
function CreateSlideShow(imgObject, slideShowSpeed, crossFadeDuration)
{
	if( !document.SlideShowArray ) document.SlideShowArray = new Array()
	if( !document.SlideShowCounter ) document.SlideShowCounter = 0;
	
	if( imgObject.name == "" )
	{
		imgObject.name = "slide" + document.SlideShowCounter++;
	}
	
	if( document.SlideShowArray[imgObject.name] == null)
	{
		document.SlideShowArray[imgObject.name] = new SlideShowObject(imgObject, CreateSlideShow.arguments)
		setTimeout('RunSlideShow(\"' + imgObject.name + '\")', ( slideShowSpeed > (crossFadeDuration*1000) ? slideShowSpeed - (crossFadeDuration*1000) : 0))
	}
}