var dom_timer;

 /*
 * init()
 * initialise JS when DOM loaded (quicker than window.onload for Moz/Webkit/IE/Opera9+)
 * ref: http://dean.edwards.name/weblog/2006/06/again/#comment5338/
 * 30/07/2010 [andy]
 **/
function init() {
	if (arguments.callee.done) {
		return;
	}
	
	arguments.callee.done = true;
	
	if (dom_timer) {
		clearInterval(dom_timer);
	}
	
	$('site2go_cart').hide();
	$('site2go_dd_link').observe('click',function(e) {
		var popup = $('site2go_cart');
		
		if (popup.visible()) {
			popup.hide();
			if (this.hasClassName('site2go_open')) {
				this.removeClassName('site2go_open');
			}
		} else {
			popup.show();
			if (!this.hasClassName('site2go_open')) {
				this.addClassName('site2go_open');
			}
		}
		
		Event.stop(e);
	});
	
	Cufon.replace('h2.phone .purple');
	Cufon.replace('h2.phone .blue');
	Cufon.replace('h2:not(.phone)');
}

if (document.addEventListener) {
	document.addEventListener("DOMContentLoaded", init, false);
}

/*@cc_on @*/
/*@if (@_win32)
	document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
	var script = document.getElementById("__ie_onload");
	script.onreadystatechange = function() {
		if (this.readyState === 'complete') {
			init();
		}
	};
/*@end @*/

if (/WebKit/i.test(navigator.userAgent)) {
	dom_timer = setInterval(function() {
		if (/loaded|complete/.test(document.readyState)) {
			init();
		}
	}, 10);
}

window.onload = init;
