function MM_openBrWindow_(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function openDisclaimer(url) {
    MM_openBrWindow_( 'popups/leave.htm?url=' + url,'winDisclaimer','width=390,height=350');
}

var Site = {
	init: function() {
		Site.textSize.init({'id':'utility', 'cookieName':'textSize', 'target': 'siteContent'});
		Site.about.init('whyInject');
		Site.boxes.init();
	},
	textSize: {
		cName: null,
		opts: { duration: 60 },
		scale: ['100%','110%','120%'],
		myScale: null,
		els: null,
		curr: 0,
		init: function(obj) {
			if (!$(obj.id)) return
			
			this.targetEl = $(obj.target) || $(document.body)
			this.cName = obj.cookieName
			//if doesnt exist, set to 0
			if (!$chk(Cookie.read(this.cName))) Cookie.write(this.cName, 0, this.opts)
			
			this.myScale = parseInt(Cookie.read(this.cName))
			
			this.els = $(obj.id).getElements('a.txtSize')
						
			this.els.each(function(el, i) {
				el.set('href', 'javascript:void(0);')
				el.store('size', i)
				el.addEvent('click', function() {
					this.processScale(el)
				}.bind(this))
			}, this)
			
			this.targetEl.setStyle('font-size', this.scale[this.myScale])			
		},
		setCookie: function() {
			Cookie.write(this.cName, this.myScale, this.opts)
		},
		processScale: function(el) {
			this.myScale = el.retrieve('size')						
			this.setCookie()
			this.targetEl.setStyle('font-size', this.scale[this.myScale])	
		}		
	},
	about: {
		init: function(target) {
			this.el = $(target) || $('whyInject') || false
			if (!this.el) return
			
			this.lists = $$('.injectList')
			this.lists.each(function(el, i) {
				el.hide()
			}, this)
			
			this.source = $$('.sources')
			this.source.each(function(el, i) {
				el.hide()
			}, this)
			
			this.shows = $$('.showMe')
			this.shows.each(function(el, i) {
				el.show()
			}, this)
			
			this.togs = $$('.arrowLink')
			this.togs.each(function(el, i) {
				el.addEvent('click', function() {
					var list = this.lists[i]
					var vis = list.isDisplayed()
					var src = this.source[i]
					
					if (vis) {
						el.set('html', 'read more')
						list.hide()
						src.hide()
					}
					else {
						el.set('html', 'hide')
						list.show()
						src.show()
					}
					
				}.bind(this))	
			}, this)
			
		}	
	},
	boxes: {
		init: function() {
			SqueezeBox.initialize({
				staticTopOffset: 30,
				openFn: function() {
					new Fx.Scroll($(document.body)).toTop();
				}
			});
			SqueezeBox.assign($$('a.squeezeBox'), {
				parse: 'rel'
			});
			
		}
	}		
}

function closeBox() {
	try {
		SqueezeBox.close();
	} catch(e) {}	
}


window.addEvent('domready', function() {
	Site.init();
})