/* Author: 
BigNoise
*/

var adjLayout = function(){
	this.proc = function() {
		this.stageWidth = $('#outer').outerWidth();
		if(this.stageWidth > 959){
			this.contentWidth = 960;
		}else if(this.stageWidth > 639 && this.stageWidth < 960){
			this.contentWidth = 640;
		}else{
			this.contentWidth = 320;
		}
		this.gutterWidth = (this.stageWidth-this.contentWidth)/2;
		//alert(this.gutterWidth);
		var outerBgX = this.gutterWidth - 200;
		$('body').css('background-position',outerBgX + 'px ' + '0px');
	}
} ;

$(document).ready(function(){
	Cufon.replace('#main-tier-nav li, h1', { fontFamily: 'MrsEaves' });
	Cufon.replace('header p, h2', { fontFamily: 'Gotham' });
	Cufon.now();
	procAdjLayout = new adjLayout() ;
	procAdjLayout.proc() ;
		
	$(window).resize(function() {
		procAdjLayout.proc() ;
		if(typeof size == 'function'){
			size() ;
		}
	});

	$(".button-find-plants").click(function(){
		var row = $("#find-plants") ;
		if ($("#find-plants").height() == "59") {
			$("#find-plants").animate({height:'0px'},500).css('border-top','0px') ;
			$(".button-find-plants a").css('background-position','0px 0px') ;
		} else {
			$("#find-plants").animate({height:'59px'},500).css('border-top','1px solid #333A30') ;
			$(".button-find-plants a").css('background-position','0px -60px') ;
		}
	});

	$("#mdrop-dd").change(function () {
		var selectedValue = $('option:selected', this).val() ;
		if (selectedValue) {
			location.href = selectedValue ;
		}
	}) ;

	$(function() {
	    $("a[rel*=leanModal]").leanModal({ top : 0, overlay : 0.9 }) ;
	}) ;
}) ;


