function set_woe_progress(current_step, completed_step) {
	var crumbs = $('oh_woe_crumbs').getElementsByTagName('li');
	for(i=1;i<(crumbs.length + 1);i++)
	{
		var el = $('step'+i);
		if(el == null)
			continue;
		if(current_step == (i + 1))
		{
			$('step'+i).addClassName('inactive_active');
		}
		else if(current_step == i && completed_step > i)
		{
			$('step'+i).addClassName('active_inactive');
		}
		else if(current_step == i)
		{
			$('step'+i).addClassName('active_ginactive');
		}
		else if(completed_step == i)
		{
			$('step'+i).addClassName('inactive_ginactive');
		}
		else if(completed_step > i)
		{
			$('step'+i).addClassName('inactive_inactive');
		}
		else
		{
			$('step'+i).addClassName('ginactive_ginactive');
		}
	}
}

/**
 * Javascript code to store data as JSON strings in cookies. 
 * It uses prototype.js 1.5.1 (http://www.prototypejs.org)
 * 
 * Author : Lalit Patel
 * Website: http://www.lalit.org/lab/jsoncookies
 * License: Creative Commons Attribution-ShareAlike 2.5
 *          http://creativecommons.org/licenses/by-sa/2.5/
 * Version: 0.4
 * Updated: Aug 11, 2007 10:09am
 * 
 * Chnage Log:
 *   v 0.4
 *   -  Removed a extra comma in options (was breaking in IE and Opera). (Thanks Jason)
 *   -  Removed the parameter name from the initialize function
 *   -  Changed the way expires date was being calculated. (Thanks David)
 *   v 0.3
 *   -  Removed dependancy on json.js (http://www.json.org/json.js)
 *   -  empty() function only deletes the cookies set by CookieJar
 */

var CookieJar = Class.create({

	/**
	 * Append before all cookie names to differntiate them.
	 */
	appendString: "__CJ_",

	/**
	 * Initializes the cookie jar with the options.
	 */
	initialize: function(options) {
		this.options = {
			expires: 3600,		// seconds (1 hr)
			path: '',			// cookie path
			domain: '',			// cookie domain
			secure: ''			// secure ?
		};
		Object.extend(this.options, options || {});

		if (this.options.expires != '') {
			var date = new Date();
			date = new Date(date.getTime() + (this.options.expires * 1000));
			this.options.expires = '; expires=' + date.toGMTString();
		}
		if (this.options.path != '') {
			this.options.path = '; path=' + escape(this.options.path);
		}
		if (this.options.domain != '') {
			this.options.domain = '; domain=' + escape(this.options.domain);
		}
		if (this.options.secure == 'secure') {
			this.options.secure = '; secure';
		} else {
			this.options.secure = '';
		}
	},

	/**
	 * Adds a name values pair.
	 */
	put: function(name, value) {
		name = this.appendString + name;
		cookie = this.options;
		var type = typeof value;
		switch(type) {
		  case 'undefined':
		  case 'function' :
		  case 'unknown'  : return false;
		  case 'boolean'  : 
		  case 'string'   : 
		  case 'number'   : value = String(value.toString());
		}
		var cookie_str = name + "=" + escape(Object.toJSON(value));
		try {
			document.cookie = cookie_str + cookie.expires + cookie.path + cookie.domain + cookie.secure;
		} catch (e) {
			return false;
		}
		return true;
	},

	/**
	 * Removes a particular cookie (name value pair) form the Cookie Jar.
	 */
	remove: function(name) {
		name = this.appendString + name;
		cookie = this.options;
		try {
			var date = new Date();
			date.setTime(date.getTime() - (3600 * 1000));
			var expires = '; expires=' + date.toGMTString();
			document.cookie = name + "=" + expires + cookie.path + cookie.domain + cookie.secure;
		} catch (e) {
			return false;
		}
		return true;
	},

	/**
	 * Return a particular cookie by name;
	 */
	get: function(name) {
		name = this.appendString + name;
		var cookies = document.cookie.match(name + '=(.*?)(;|$)');
		if (cookies) {
			return (unescape(cookies[1])).evalJSON();
		} else {
			return null;
		}
	},

	/**
	 * Empties the Cookie Jar. Deletes all the cookies.
	 */
	empty: function() {
		keys = this.getKeys();
		size = keys.size();
		for(i=0; i<size; i++) {
			this.remove(keys[i]);
		}
	},

	/**
	 * Returns all cookies as a single object
	 */
	getPack: function() {
		pack = {};
		keys = this.getKeys();

		size = keys.size();
		for(i=0; i<size; i++) {
			pack[keys[i]] = this.get(keys[i]);
		}
		return pack;
	},

	/**
	 * Returns all keys.
	 */
	getKeys: function() {
		keys = $A();
		keyRe= /[^=; ]+(?=\=)/g;
		str  = document.cookie;
		CJRe = new RegExp("^" + this.appendString);
		while((match = keyRe.exec(str)) != undefined) {
			if (CJRe.test(match[0].strip())) {
				keys.push(match[0].strip().gsub("^" + this.appendString,""));
			}
		}
		return keys;
	}
});

/**
 * Javascript code to present exiting users with option
 * to complete survey before leaving.
 *
 * Author : Zack McGhee
 * Review : Ian Good
 *
 */

var WOE_Intercept = Class.create({
	initialize: function (pages) {
		this.boundTriggers = [];
		this.boundClickTrackers = [];
		this.windowEvent = 'beforeunload';
		if(navigator.userAgent.match("Firefox|MSIE 7|MSIE 6") && location.href.match(pages.join("|")))
		{
			this.enable();
		}
	},
	css: {
		styles: [
					['#myTint', "background:#ccc;width:100%;height:100%;position:absolute;top:0;left:0;"],
					['#myIntercept', "position: absolute;top:50%;left:50%;z-index:9999;width:500px;margin:-220px 0 0 -250px;border:1px solid #333;background:#ffe;padding:1em;text-align:left;font-family:arial;"]
				],
		write: function (intercept) {
			var css = '<style type="text/css">';
			for(var i=0;i<intercept.css.styles.length;i++)
			{
				css+= intercept.css.styles[i][0];
				css+= '{'+intercept.css.styles[i][1]+'}';
			}
				css+= '<\/style>';
			document.write(css);
		}
	},
	survey: {
		actionURL: "http://mhe.daytondailynews.com/woe/intercept.php",
		formMethod: "POST",
		heading: "Thank you for visiting us.",
		summary: "It looks like you've decided not to place an ad with us online. Can you please tell us why?",
		options: [
					['curious', 'I was just curious about placing an ad.'],
					['confused', 'I am confused by the Place an Ad process.'], 
					['rate', 'Placing an ad is too expensive.']
				 ],
		comments: "Please let us know why you are leaving or feel free to tell us more about your above selection. If you're having trouble, please include your email address or phone number so a customer service representative can help you.",
		submit: "Submit survey and leave",
		cancel: "Go back to Place an Ad"
	},
	enable: function () {
		this.enableTrigger();
		this.enableClickTracking();
	},
	disable: function() {
		this.disableTrigger();
		this.disableClickTracking();
		jar.put('userIntercept', {triggered: true});
	},
	enableTrigger: function () {
		var x = this.boundTriggers.length;
		this.boundTriggers[x] = this.trigger.bindAsEventListener(this);
		Event.observe(window, this.windowEvent, this.boundTriggers[x]);
	},
	disableTrigger: function () {
		for(var i in this.boundTriggers)
		{
			Event.stopObserving(window, this.windowEvent, this.boundTriggers[i]);
		}
		this.boundTriggers = [];
	},
	enableClickTracking: function () {
		var x = this.boundClickTrackers.length;
		this.boundClickTrackers[x] = this.clickTracking.bindAsEventListener(this);
		Event.observe(document, 'click', this.boundClickTrackers[x]);
	},
	disableClickTracking: function () {
		for(var i in this.boundClickTrackers)
		{
			Event.stopObserving(document, 'click', this.boundClickTrackers[i]);
		}
		this.boundClickTrackers = [];
	},
	clickTracking: function (event) {
		// get vertical position
		var posY = Event.pointerY(event);
		// if position is 155 or less,
		// the click is inside the nav or logo
		if(posY > 155)
		{
			this.disableTrigger();
			setTimeout("intercept.enableTrigger()", 9000);
		}
	},
	trigger: function (event) {
		// Disable the intercept
		this.disable();
		
		// Tint live page
		var myTint = document.createElement("div");
		myTint.setAttribute('id', 'myTint');
		if(document.all) {
			myTint.style.filter = "alpha(opacity=80)";
		} else {
			myTint.style.MozOpacity = 80/100;
		}
		myTint.innerHTML = '<br />';
		document.body.appendChild(myTint);
		
		// Add intercept box
		var myIntercept = document.createElement("div");
		myIntercept.setAttribute('id', 'myIntercept');
		var myInterceptHTML = '<form action="'+this.survey.actionURL+'" method="'+this.survey.formMethod+'">';
			myInterceptHTML+= '<h3>'+this.survey.heading+'<\/h3>';
			myInterceptHTML+= '<p>'+this.survey.summary+'<\/p>';
			for(var i=0;i<this.survey.options.length;i++)
			{
				myInterceptHTML+= '<p onclick="this.getElementsByTagName(\'input\')[0].checked=true;"><input type="radio" name="reason" value="'+this.survey.options[i][0]+'" \/> '+this.survey.options[i][1]+'<\/p>';
			}
			myInterceptHTML+= '<p style="padding-top:10px;">'+this.survey.comments+'<\/p>';
			myInterceptHTML+= '<p><textarea style="font-family:arial;font-size:12px;padding:3px;width:90%;height:50px;" name="comments"><\/textarea><\/p>';
			myInterceptHTML+= '<input type="hidden" name="hostname" value="'+location.hostname+'" \/>';
			myInterceptHTML+= '<p><input type="submit" style="font-weight:bold;" value="'+this.survey.submit+'" \/> <input type="button" value="'+this.survey.cancel+'" onclick="document.getElementById(\'myTint\').style.display=\'none\';document.getElementById(\'myIntercept\').style.display=\'none\';" \/><\/p>';
			myInterceptHTML+= '<\/form>';
		myIntercept.innerHTML = myInterceptHTML;
		document.body.appendChild(myIntercept);
		scroll(0,0);
		
		// Dialog
		if(confirm("We'd like to ask you why you're leaving. To take this brief survey, click OK now, then click cancel at the next prompt to stay on this page.\n\nTo leave without taking the survey, click Cancel now.\n\nIf you just clicked the back button and are seeing this prompt by mistake, click Cancel."))
		{
			Event.stop(event);
		}
	}
});
/*
var jar = new CookieJar({path: '/'});
if(jar.get('userIntercept'))
{
	// intercept already deployed for this user
	// during this session
}
else
{
	var intercept = new WOE_Intercept(['webentry/(url/)?$', 'c_category', 'c_package', 'c_onlinead', 'c_newspaperad']);
	intercept.css.write(intercept);	
}
*/
function showHide(divID)
{
        dElm = document.getElementById(divID);

        if (dElm.style.display == '' | dElm.style.display == 'none')
        {
                dElm.style.display = 'block';
        }
        else
        {
                dElm.style.display = 'none';
        }
}

