
$(document).ready( function(){

	var adjust_size = 43 * 2 + $("#sponsor_container").width();									// 43 px right margin = left margin
	adjust_size += subString_( $("#content").css("padding-left"), 0, -2 ) * 2;					// asumes that padding is same left and right
	adjust_size += subString_( $("#content").css("border-left-width"), 0, -2 ) * 2;				// asumes that border is same left and right
	adjust_size += subString_( $("#sponsor_container").css("padding-left"), 0, -2 ) * 2;		// asumes that padding is same left and right
	adjust_size += subString_( $("#sponsor_container").css("border-left-width"), 0, -2 ) * 2;	// asumes that border is same left and right
	adjust_size += subString_( $("#sponsor_container").css("margin-left"), 0, -2 ) * 1;			// asumes that padding is same left and right

	function subString_( string, start, end ) {
		str_len = string.length;
		if ( arguments.length == 2 ) { end = str_len; }
		if ( start < 0 ) { start += str_len; }
		if ( end < 0 ) { end += ( str_len - start ); }
		else if ( start != 0 ) { end = start - 1; }
		if ( start + end > str_len ) { end = str_len - start; }

		return string.substr( start, end );
	}

	function changeContentWidth() {
		window_width = $("#body").width();
		if ( $.browser.safari ) {
			window_width -= 1;
		}

		if ( window_width > 1020 ) {
			$("#page_container").css( "width", window_width );
			$("#content").css( "width", ( window_width - adjust_size ) );
		} else {
			$("#page_container").css( "width", 1020 );
			$("#content").css( "width", 750 );
		}
	}

	changeContentWidth();

	$(window).resize(function(){
		changeContentWidth();
	});

});


function scrollUp() {
	scroller = true;
	scrolltimer = null;
	
	layer = document.getElementById('sponsors');
	var y_pos = parseInt(layer.scrollTop);
	
	if (scroller == true) {
		layer.scrollTop = (y_pos + (2));
		}
	scrolltimer = setTimeout("scrollUp()", 1);
	}

function scrollDown() {
	scroller = true;
	scrolltimer = null;
	
	layer = document.getElementById('sponsors');
	var y_pos = parseInt(layer.scrollTop);
	
	if (scroller == true) {
		layer.scrollTop = (y_pos - (2));
		}
	scrolltimer = setTimeout("scrollDown()", 2);
	}

function scrollROut() {
	scroller = false;
	clearTimeout(scrolltimer);
	}
