document.write("<style type='text/css'>\n#countdown { background: url('http://www.rsaconference.com/images/sidebar/bg.jpg') no-repeat; height: 101px; width: 236px }\n#countdown .timer {	padding-top: 46px; height: 55px; width: 236px}\n#countdown .timer .dial { display: inline; float: left; height: 42px; overflow: hidden;	position: relative;	width: 59px}\n#countdown .timer .dial div { color: #fff; font-family: Arial, Helvetica, sans-serif; font-size: 42px; font-weight: bold; left: 0; height: 100%; position: absolute; text-align: center; width: 100%; margin-top: -4px}</style>\n<div id='countdown'>\n<div class='timer'>\n<div id='timer-day' class='dial'></div>\n<div id='timer-hour' class='dial'></div>\n<div id='timer-minute' class='dial'></div>\n<div id='timer-second' class='dial'></div>\n</div>\n</div>\n");

/**
 * Countdown Timer with dial effect
 * Tested in IE7, IE8, Safari 4, Opera 9, Firefox 3.5, Chrome 3.
 *
 * Usage: new countdown('January 27, 2010 11:45:00', {
 *  day: 	'timer-day',
 *  hour: 	'timer-hour',
 *  minute:	'timer-minute',
 *  second: 'timer-second',
 *  start: 38,
 *  end: -38});
 *
 * @option day node day container
 * @option minute node minute container
 * @option hour node hour container
 * @option second node second container
 * @option start int starting position of new dials
 * @option end int ending position of new dials
 * @option speed int how long it will take to toggle dials
 * @option framerate int the frame rate to move dials
 * @option onUpdateSecond function callback when the update second event occurs
 * @option onUpdateMinute function callback when the update minute event occurs
 * @option onUpdateHour function callback when the update hour event occurs
 * @option onUpdateDay function callback when the update day event occurs
 * @option onTimeUp function callback when the time up event occurs
 * @author Christian Blanquera <cblanquera@solutionset.com>
 * @version $ID$
 */
var countdown = (function() {
	/* Class Pattern
	-------------------------------*/
	var c = function(end, options) {
		this.__construct.call(this, end, options || {});
	}, p = c.prototype;
	
	/* Private Properties
	-------------------------------*/
	var _moving = 0;
	
	/* Magic
	-------------------------------*/
	p.__construct = function(end, options) {
		//this is the local computer date now
		this.lastDate = new Date();
		
		//this is the set of nodes the timer will affect
		this.nodes = {
			day:  	(typeof options.day === 'string') ? document.getElementById(options.day) : options.day,
			hour:  	(typeof options.hour === 'string') ? document.getElementById(options.hour) : options.hour,
			minute:  (typeof options.minute === 'string') ? document.getElementById(options.minute) : options.minute,
			second:  (typeof options.second === 'string') ? document.getElementById(options.second) : options.second}; 
		
		//set callbacks
		this.updateSecondCallback 	= options.onUpdateSecond;
		this.updateMinuteCallback 	= options.onUpdateMinute;
		this.updateHourCallback 	= options.onUpdateHour;
		this.updateDayCallback 		= options.onUpdateDay;
		this.timeUpCallback 		= options.onTimeUp;
		
		this.dialStart 	= typeof options.start === 'number' ? options.start 	: 38;
		this.dialEnd 	= typeof options.end === 'number' 	? options.end		: -38;
		this.speed 		= typeof options.speed === 'number' ? options.speed 	: 500;
		this.rate 		= typeof options.framerate === 'number' 	? options.framerate	: 10;
		
		//set the end date in GMT
		this.endDate = this.getDateInGMT(new Date(end));
		
		//set stop to false;
		this.stop = false;
		
		//get now date in GMT
		this.currentDate = this.getDateInGMT(new Date());
		
		this.countDown = {};
		
		//update timer
		this.updateCountDown();
		
		//setup dials
		this.setup();
		
		//activate events
		this.activateEvents();
	};
	
	/* Public Methods
	-------------------------------*/
	/**
	 * Sets up initial dials
	 *
	 * @return this
	 */
	p.setup = function() {
		this.currentSecondDial = document.createElement('div');
		
		//get the value
		value = this.countDown.second;
		
		//if value is less than ten and greater than -10
		if(value < 10 && value > -10) {
			value = '0'+value;
		}
		
		this.currentSecondDial.innerHTML = value;
		this.nodes.second.appendChild(this.currentSecondDial);
		this.currentSecondDial.style.top = this.dialStart+'px';
		this.moveDial.call(this, this.currentSecondDial, 0, 1, 1);
		
		this.currentMinuteDial = document.createElement('div');
		
		//get the value
		value = this.countDown.minute;
		
		//if value is less than ten and greater than -10
		if(value < 10 && value > -10) {
			value = '0'+value;
		}
		
		this.currentMinuteDial.innerHTML = value;
		this.nodes.minute.appendChild(this.currentMinuteDial);
		this.currentMinuteDial.style.top = this.dialStart+'px';
		this.moveDial.call(this, this.currentMinuteDial, 0, 1, 1);
		
		this.currentHourDial = document.createElement('div');
		
		//get the value
		value = this.countDown.hour;
		
		//if value is less than ten and greater than -10
		if(value < 10 && value > -10) {
			value = '0'+value;
		}
		
		this.currentHourDial.innerHTML = value;
		this.nodes.hour.appendChild(this.currentHourDial);
		this.currentHourDial.style.top = this.dialStart+'px';
		this.moveDial.call(this, this.currentHourDial, 0, 1, 1);
		
		this.currentDayDial = document.createElement('div');
		
		//get the value
		value = this.countDown.day;
		
		//if value is less than ten and greater than -10
		if(value < 10 && value > -10) {
			value = '0'+value;
		}
		
		this.currentDayDial.innerHTML = value;
		this.nodes.day.appendChild(this.currentDayDial);
		this.currentDayDial.style.top = this.dialStart+'px';
		this.moveDial.call(this, this.currentDayDial, 0, 1, 1);
		
		return this;
	};
	
	/**
	 * Activates event listening
	 *
	 * @return this
	 */
	p.activateEvents = function() {
		//if countdown is done
		if(this.difference == 0) {
			_eventTimeUp.call(this);
			return this
		}
		
		var self = this;
		
		this.timer = setInterval(function() {
			//get now date in GMT
			self.currentDate = self.getDateInGMT(new Date());
			
			//if the current date differs from the last date greater than 1000
			if(!self.isMoving() && (self.currentDate.getTime() - self.lastDate.getTime()) >= 1000) {
				//update the timer
				self.updateCountDown.call(self);
				
				_eventUpdateSecond.call(self);
				
				self.lastDate = self.currentDate;
				
				//if countdown is done
				if(self.difference === 0) {
					_eventTimeUp.call(self);
				}
			}
			
		}, 800);
		
		return this;
	};
	
	/**
	 * Updates all count down values
	 *
	 * @return interval;
	 */
	p.updateCountDown = function() {
		//calc the difference
		//this is the difference in milliseconds
		var difference = this.endDate.getTime() - this.currentDate.getTime();
		
		//if difference is less than 0
		if(difference < 0) {
			difference = 0;
		}
		
		this.difference = difference;
		
		//update node
		this.countDown.day = Math.floor(difference / (1000 * 60 * 60 * 24));
		
		//get remainder
		difference %= (1000 * 60 * 60 * 24);
		
		//update node
		this.countDown.hour = Math.floor(difference / (1000 * 60 * 60));
		
		//get remainder
		difference %= (1000 * 60 * 60);
		
		//update node
		this.countDown.minute = Math.floor(difference / (1000 * 60));
		
		//get remainder
		difference %= 1000 * 60;
		
		//update node
		this.countDown.second = Math.floor(difference / 1000);
		
		return this;
	};
	
	/**
	 * Moves a dial to a desired top poisiton
	 *
	 * @return this;
	 */
	p.moveDial = function(dial, end, speed, rate, callback) {
		//so now we calculate the distance for each tick
		var current 	= parseFloat(_getCurrentStyle(dial, 'top')) || 0,
			tick 		= (current - end) / (speed / rate),
			direction 	= tick < 0 ? 'down' : 'up';
		
		var self = this;
		
		//now do the animation
		var interval = setInterval(function() {
			current -= tick;
			
			//if current position is less than end position
			if(direction == 'up' && current < end) {
				//set current to end
				current = end;
			} else if(direction == 'down' && current > end) {
				//set current to end
				current = end;
			}
			
			//move dial up
			dial.style.top = current+'px';
			//if current position equals end position
			if(current == end) {
				//clear the interval
				clearInterval(interval);
				
				_moving --;
				
				//if callback is set and equals false
				if(typeof callback === 'function') {
					callback.call(self, dial);
				}
			}
		}, rate);
		
		_moving ++;
		
		return this;
	};
	
	/**
	 * Returns the date object equivillent in GMT
	 *
	 * @param Date
	 * @return Date
	 */
	p.getDateInGMT = function(date) {
		//this is the offset in hours from GMT in seconds
		var timeZoneOffset = date.getTimezoneOffset() * 60;
		
		//this is the local unix time in seconds
		var unixTime = parseInt(date.getTime() / 1000);
		
		//this is the GMT equivilant in seconds
		var gmt = unixTime + timeZoneOffset;
		
		//new date to return
		//we do this because modifying the original date
		//will affect the date object passed to this function
		//when referenced after this method call
		var newDate = new Date();
		
		//set the time
		//setTime() requests the time be in milliseconds
		newDate.setTime(gmt * 1000);
		
		return newDate;
	};
	
	/**
	 * Returns true if there's a dial currently moving
	 *
	 * @return bool
	 */
	p.isMoving = function() {
		return _moving !== 0;
	};
	
	/* Private Methods
	-------------------------------*/
	var _eventTimeUp = function() {
		//if timeUpCallback is set and equals false
		if(typeof this.timeUpCallback == 'function' && 
			this.timeUpCallback.call(this) === false) {
			
			//we should do the same
			return false;
		}
		
		clearInterval(this.timer);
	};
	
	var _eventUpdateSecond = function() {
		//if updateSecondCallback is set and equals false
		if(typeof this.updateSecondCallback == 'function' && 
			this.updateSecondCallback.call(this) === false) {
			
			//we should do the same
			return false;
		}
		
		//get the value
		value = this.countDown.second;
		
		//if value is less than ten and greater than -10
		if(value < 10 && value > -10) {
			value = '0'+value;
		}
		
		if(value == this.currentSecondDial.innerHTML) {
			return false;
		}
		
		var dial = document.createElement('div');
		
		//set value
		dial.innerHTML = value;
		//append dial
		this.nodes.second.appendChild(dial);
		
		//set dial to start position
		dial.style.top = this.dialStart+'px';
		
		//first move the current dial
		this.moveDial.call(this, this.currentSecondDial, this.dialEnd, this.speed, this.rate, function(dial) {
			//remove the node
			dial.parentNode.removeChild(dial);
		});
		
		//now move the new dial
		this.moveDial.call(this, dial, 0, this.speed, this.rate);
		
		//assign new dial to current dial
		this.currentSecondDial = dial;
		
		if(dial.innerHTML == 59) { 
			_eventUpdateMinute.call(this);
		}
	};
	
	var _eventUpdateMinute = function() {
		//if updateMinuteCallback is set and equals false
		if(typeof this.updateMinuteCallback == 'function' && 
			this.updateMinuteCallback.call(this) === false) {
			
			//we should do the same
			return false;
		}
		
		//get the value
		value = this.countDown.minute;
		
		//if value is less than ten and greater than -10
		if(value < 10 && value > -10) {
			value = '0'+value;
		}
		
		if(value == this.currentMinuteDial.innerHTML) {
			return false;
		}
		
		var dial = document.createElement('div');
		
		//set value
		dial.innerHTML = value;
		
		//append dial
		this.nodes.minute.appendChild(dial);
		
		//set dial to start position
		dial.style.top = this.dialStart+'px';
		
		//first move the current dial
		this.moveDial.call(this, this.currentMinuteDial, this.dialEnd, this.speed, this.rate, function(dial) {
			//remove the node
			dial.parentNode.removeChild(dial);
		});
		
		//now move the new dial
		this.moveDial.call(this, dial, 0, this.speed, this.rate);
		
		//assign new dial to current dial
		this.currentMinuteDial = dial;
		
		if(dial.innerHTML == 59) { 
			_eventUpdateHour.call(this);
		}
	};
	
	var _eventUpdateHour = function() {
		//if updateHourCallback is set and equals false
		if(typeof this.updateHourCallback == 'function' && 
			this.updateHourCallback.call(this) === false) {
			
			//we should do the same
			return false;
		}
		
		//get the value
		value = this.countDown.hour;
		
		//if value is less than ten and greater than -10
		if(value < 10 && value > -10) {
			value = '0'+value;
		}
		
		if(value == this.currentHourDial.innerHTML) {
			return false;
		}
		
		var dial = document.createElement('div');
		
		//set value
		dial.innerHTML = value;
		
		//append dial
		this.nodes.hour.appendChild(dial);
		
		//set dial to start position
		dial.style.top = this.dialStart+'px';
		
		//first move the current dial
		this.moveDial.call(this, this.currentHourDial, this.dialEnd, this.speed, this.rate, function(dial) {
			//remove the node
			dial.parentNode.removeChild(dial);
		});
		
		//now move the new dial
		this.moveDial.call(this, dial, 0, this.speed, this.rate);
		
		//assign new dial to current dial
		this.currentHourDial = dial;
		
		if(dial.innerHTML == 23) { 
			_eventUpdateDay.call(this);
		}
	};
	
	var _eventUpdateDay = function() {
		//if updateDayCallback is set and equals false
		if(typeof this.updateDayCallback == 'function' && 
			this.updateDayCallback.call(this) === false) {
			
			//we should do the same
			return false;
		}
		
		//get the value
		value = this.countDown.day;
		
		//if value is less than ten and greater than -10
		if(value < 10 && value > -10) {
			value = '0'+value;
		}
		
		if(value == this.currentSecondDial.innerHTML) {
			return false;
		}
		
		var dial = document.createElement('div');
		
		//set value
		dial.innerHTML = value;
		
		//append dial
		this.nodes.day.appendChild(dial);
		
		//set dial to start position
		dial.style.top = this.dialStart+'px';
		
		//first move the current dial
		this.moveDial.call(this, this.currentDayDial, this.dialEnd, this.speed, this.rate, function(dial) {
			//remove the dial
			dial.parentNode.removeChild(dial);
		});
		
		//now move the new dial
		this.moveDial.call(this, dial, 0, this.speed, this.rate);
		
		//assign new dial to current dial
		this.currentDayDial = dial;
	};
	
	//http://www.quirksmode.org/dom/getstyles.html
	var _getCurrentStyle = function(el, style) {
		if (el.currentStyle) {
			return el.currentStyle[style];
		} else if (window.getComputedStyle) {
			return document.defaultView.getComputedStyle(el, null).getPropertyValue(style);
		}
		
		return null;
	};
	
	/* Adapter
	-------------------------------*/
	return c;
	
	
	
})();

new countdown('March 1, 2010 09:00:00', {
			day: 	'timer-day',
			hour: 	'timer-hour',
			minute:	'timer-minute',
			second: 'timer-second',
			onTimeUp: function () {

			},
			start: 	120,
			end: 	-120});



 
var HeadlineArr1 = new Array(
 
"Time is running out!" );

var PromoArr1 = new Array(
 
"Reserve your spot at RSA Conference 2010 and take advantage of:<ul><li>Extensive agenda, exclusive content<li>Practical solutions, instant payback<li>Dedicated professionals, unparalleled connections</ul>");

var LinkTextArr1 = new Array(
 
"Register now");

var LinkArr1 = new Array(
 
"http://www.rsaconference.com/2010/usa/agenda-and-sessions.htm?utm_source=rsaconference-website&utm_medium=right-column-promo&utm_content=register-now&utm_campaign=last-chance");


//var rand = Math.floor(Math.random()*ImageArr1.length);
 
var rand = 0; 
document.write("<br><h2>" + HeadlineArr1[rand] + "</h2> ");
document.write("<p>" + PromoArr1[rand] + "</p> ");
if(LinkArr1[rand]!="#"){
	document.write("<p><b><a href='" + LinkArr1[rand] + "'>"+ LinkTextArr1[rand] +" &#x00bb;</a></b></p> ");
} 

 