	//check for the swz namespace
	if(Object.isUndefined(SWZ)){
		var SWZ = {};
	}
	
	
	SWZ.Clock = Class.create({
	
		//function performed when created
		initialize:function(options){
		
			this.options = {	
				id			: '',			//the id of the element creating the clock	
				time 	: '00:00:00',	//the time should be given in 24hr time, with hours, minutes and seconds all 2 chars long
				format		: 'H:i:s'		//basic format is 12hour time, no leading zero and lowercase am/pm
			};
			
			//extend the object
			Object.extend(this.options,options || '');
		
			//setup the clock
			this.setup();
		},
		
		
		setup:function(){
		
			arrStartTime = String(this.options.time).split(':');
			
			this.currentTime = new Date()
			this.currentTime.setHours(arrStartTime[0],arrStartTime[1],arrStartTime[2],0);			
		
			$(this.options.id).innerHTML = this.format(this.currentTime,this.options.format);
		
			//create the obj for this
			var obj = this;
			
			//create the timeout to update the clock
			setTimeout(function(){
				obj.updateClock();
			},1000);
		},
		
		updateClock:function(){
			this.currentTime.setSeconds(this.currentTime.getSeconds() + 1);
			$(this.options.id).innerHTML = this.format(this.currentTime,this.options.format);		
			
			//create the obj for this
			var obj = this;
			
			//create the timeout to update the clock
			setTimeout(function(){
				obj.updateClock();
			},1000);
		},
		
	
		format:function(datetime,format){
			
			//	'FORMAT TYPES
			var ft = {};
			ft.a = (datetime.getHours() < 12) ? String('am') : String('pm');																//am or pm
			ft.A = (datetime.getHours() < 12) ? String('AM') : String('PM');																//AM or PM
			ft.g = (Number(datetime.getHours()) > 12) ? String(datetime.getHours() - 12) : (Number(datetime.getHours()) == 0) ? String(12) : String(datetime.getHours());						//The hour in 12-hour format without a leading zero (1-12)
			ft.G = String(datetime.getHours());																								//The hour in 24-hour format without a leading zero (0-23)
			ft.h = (String(ft.g).length < 2) ? '0' + String(ft.g) : String(ft.g);															//The hour in 12-hour format with a leading zero (01-12)
			ft.H = (String(ft.G).length < 2) ? '0' + String(ft.G) : String(ft.G);															//The hour in 24-hour format with a leading zero (00-23)
			ft.i = (String(datetime.getMinutes()).length < 2) ? '0' + String(datetime.getMinutes()) : String(datetime.getMinutes());		//The minutes with a leading zero (00-59)
			ft.s = (String(datetime.getSeconds()).length < 2) ? '0' + String(datetime.getSeconds()) : String(datetime.getSeconds());		//The seconds with a leading zero (00-59)
																												
			output = '';
			arr = format.toArray();
			arr.each(function(item){
				if(!Object.isUndefined($H(ft).get(item))){
					output += $H(ft).get(item)
				} else {
					output += item;
				}
			});

			return output			
		}
	
	
	});
