
	var $currheight;

	function scaleomatic(e) {
	
		/* *********************************************************
		********************* FONT SCALING *************************
		************************************************************ */
		
		if (!e) var e = window.event;

		/* GET NEW WIDTH AND HEIGHT, UPDATE COOKIE */		
		if (window.innerWidth) {
			$cwidth = window.innerWidth;
			$cheight = window.innerHeight;
		} else {
			/* fix to prevent "bad" IE onresize events
			from executing any code - thanks to -
			http://snook.ca/archives/javascript/ie6_fires_onresize/ */
			if($currheight == document.documentElement.clientHeight) {
				return false;
			}
			$currheight = document.documentElement.clientHeight;
			$cwidth = document.documentElement.clientWidth;
			$cheight = document.documentElement.clientHeight;
		}

		setCookie('clientvars', $cwidth+","+$cheight);
		
		doFontScaling();
		doColumnScaling();
		
		if ($("takeover")) {		
			doTakeoverScaling($cwidth, $cheight);
		}
		
	}
	
	function transNumToScale($src, $srcmin, $srcmax, $dstmin, $dstmax) {
		$factor = ($src - $srcmin) / ($srcmax - $srcmin) * ($dstmax - $dstmin) + $dstmin;
		return $factor;
	}

	function doTakeoverScaling($winwidth, $winheight) {
	
		var $minw = 800;
		var $maxw = 1600;
		var $imgpct = .3;
		var $headpct = .35;
		var $promopct = .22;
				
		var $headmin = 1.1;
		var $headmax = 1.5;
		
		var $copymin = .7;
		var $copymax = 1.2;
		
		/* translate to percentage of max size */		
		$headsize = transNumToScale($winwidth, $minw, $maxw, $headmin, $headmax);
		$copysize = transNumToScale($winwidth, $minw, $maxw, $copymin, $copymax);
		
		/* set percentages here */
		var $imgwidth = Math.round($winwidth*$imgpct);
		var $headwidth = Math.round($winwidth*$headpct);
		var $promowidth = Math.round($winwidth*$promopct);
	
		var $to = $("takeover");
		var $img = $("bannerimg1");
		var $head = $("bannerhead");
		var $promo = $("bannerright");
				
		$img.setStyle({"width":$imgwidth+"px"});
		$head.setStyle({"width":$headwidth+"px"});
		$head.setStyle({"fontSize":$headsize+"em"});
		$promo.setStyle({"width":$promowidth+"px"});
		$promo.setStyle({"fontSize":$copysize+"em"});

	}

	function doFontScaling() {
		
		/* CALCULATE NEW FACTORS FOR FONT SIZE */		
		$minsize = 90;
		$maxsize = 120;
		$minrez = 800;
		$maxrez = 1600;
		
		$rezfactor = Math.round(($cwidth-$minrez)/($maxrez-$minrez)*100);
		$fontfactor = $minsize + Math.round((($maxsize-$minsize)*$rezfactor)/100);
		$searchfactor = $fontfactor-10;
		$crbfactor = $fontfactor-10;
		$fontfactor += "%";
		$searchfactor += "%";
		$crbfactor += "%";

		$centercontent = $("centercolumncontent");		
		$centercontent.setStyle("font-size: "+$fontfactor);

		$rightcontent = $("rightcolumncontent");		
		$rightcontent.setStyle("font-size: "+$fontfactor);
		
		$searchdiv = $("searchdiv");
		$searchdiv.setStyle("font-size: "+$searchfactor);

		$searchinput = $("searchinput");
		$searchinput.setStyle("font-size: "+$fontfactor);

		$searchsubmit = $("searchsubmit");
		$searchsubmit.setStyle("font-size: "+$fontfactor);
		
		$crb = $("crb_center");
		$crb.setStyle("font-size: "+$crbfactor);
		
	}
	
	
	function doColumnScaling() {


		/* *********************************************************
		**** ADJUST COLUMN HEIGHTS AND POSITION ROUNDED CORNERS ****
		************************************************************ */

		/* get references */		
		$container = $("container");
		$header = $("headercontainer");
		$leftcol = $("leftcolumncontainer");
		$centercol = $("centercolumncontainer");
		$rightcol = $("rightcolumncontainer");
		
		/* reset all to auto height */
		$container.setStyle({"height":'auto'});
		$leftcol.setStyle({"height":'auto'});
		$centercol.setStyle({"height":'auto'});
		$rightcol.setStyle({"height":'auto'});
		
		/* get container height */
		$height = $container.getHeight() - 200;
		$height += "px";
		
		/* apply container height to all 3 columns */
		$leftcol.setStyle({"height":$height});
		$centercol.setStyle({"height":$height});
		$rightcol.setStyle({"height":$height});
		
		/* get references to corners */
		$tl = $("topleftcorner");
		$tr = $("toprightcorner");
		$bl = $("bottomleftcorner");
		$br = $("bottomrightcorner");
		
		/* calculate offsets for corners */
		$containerOffsets = $container.cumulativeOffset();
		$containerTop = $containerOffsets['top'];
		$containerWidth = $container.getWidth();
		$containerHeight = $container.getHeight();
		$bottomCornerTop = $containerTop + $containerHeight - 18;
		$leftCornerLeft = $containerOffsets['left'];		
		$rightCornerLeft = $leftCornerLeft + $containerWidth -18;
		
		/* set all corner positions */
		$tl.setStyle({"left":$leftCornerLeft+"px"});
		$tl.setStyle({"top":$containerTop+"px"});		

		$tr.setStyle({"left":$rightCornerLeft+"px"});
		$tr.setStyle({"top":$containerTop+"px"});

		$bl.setStyle({"left":$leftCornerLeft+"px"});
		$bl.setStyle({"top":$bottomCornerTop+"px"});

		$br.setStyle({"left":$rightCornerLeft+"px"});
		$br.setStyle({"top":$bottomCornerTop+"px"});
		
		/* *********************************************************
		******************* SET STYLES FOR ROTATOR *****************
		************************************************************ */
				
	}
	