var XBrowserAddHandler = function (target,eventName,handlerName){		if ( target.addEventListener )		target.addEventListener(eventName, handlerName, false);	else if ( target.attachEvent )		 target.attachEvent("on" + eventName, handlerName);	else		 target["on" + eventName] = handlerName;};function image_rotation(display,preload,effect){	this.display=display;	this.preload=preload;	this.effect=effect;	var me=this;	XBrowserAddHandler(preload,"load",function()	{		if(me.preloadingId>=0)		{			me.preloaded[me.preloadingId]=true; 		}		me.preloading=false;		me.preloader();		if(me.waitingForPreload==true)		{			me.next();		}	});}image_rotation.prototype.display = null;image_rotation.prototype.preload = null;image_rotation.prototype.effect  = null;image_rotation.prototype.img  = new Array();image_rotation.prototype.preloaded = new Array();image_rotation.prototype.text = new Array();image_rotation.prototype.rotationId=-1;image_rotation.prototype.preloadingId=-1;image_rotation.prototype.preloading=false;image_rotation.prototype.waitingForPreload=false;image_rotation.prototype.clear = function (){	this.img = new Array();	this.text = new Array();	this.preloaded = new Array();}image_rotation.prototype.add = function (img,text){	this.img.push(img);	this.text.push(text);	this.preloaded.push(false);	this.preloader();}image_rotation.prototype.preloader = function(){	if(this.preloading==false && (this.preloadingId+1)<this.img.length)	{		this.preloadingId++;		this.preloading=true;		this.preload.src = this.img[this.preloadingId];	}}image_rotation.prototype.start = function(){	this.next();}image_rotation.prototype.next = function(){	var me=this;	var nextRotationId = this.rotationId+1;	if (nextRotationId>=this.img.length)	{		nextRotationId = 0;	}	if (this.preloaded[nextRotationId]==true)	{		this.waitingForPreload=false;		this.rotationId=nextRotationId;		//display picture:		this.effect.src=this.img[nextRotationId];		$(this.effect).css({opacity: 0,display:"block"});		$(this.effect).animate({opacity:1},4000,function(){			me.display.src=me.img[me.rotationId];			window.setTimeout(function(){me.next()},7000);		});	}	else	{		this.waitingForPreload=true;	}}var medarwinRotation;function rotation_init(){	if(document.getElementById('img_rotation_display')==null)return;	medarwinRotation=new image_rotation(		document.getElementById('img_rotation_display'),		document.getElementById('img_rotation_preload'),		document.getElementById('img_rotation_effect')	);	medarwinRotation.clear();	medarwinRotation.add("img/rotation/Club 1_SMALL.jpg","base");	medarwinRotation.add("img/rotation/Club 2_SMALL.jpg","designer");	medarwinRotation.add("img/rotation/Club 3_SMALL.jpg","manager");	medarwinRotation.start();}XBrowserAddHandler(window,"load",rotation_init);