$(document).ready(function() {

	// Handle "search" hint in search field.
	var emptySearchText;
	$("#search-field").focus(function() {
		var t = $(this);
		if (t.attr("class").indexOf("empty") >= 0) {
			emptySearchText = t.val();
			t.removeClass("empty");
			t.val("");
		}
	});
	$("#search-field").blur(function() {
		var t = $(this);
		if (t.val() == "") {
			t.val(emptySearchText);
			t.addClass("empty");
		}
	});
	// Submit form w/o hint
	$("#search-do").click(function() {
		$("#search-form").submit();
	});
	$("#search-field").keypress(function(e) {
		if (e.which == 13)
			$("#search-form").submit();
	});
	$("#search-form").submit(function() {
		var sf = $("#search-field");
		if (sf.attr("class").indexOf("empty") >= 0) {
			sf.val("");
		}
		return true;
	});

	//working around for compensate bug with right gradient shadow	
	$(window).scroll(function(event) {
		$('.side-right').css({ right: -$(document)[0].documentElement.scrollLeft });
	});

	//image
	/*var Screen = $(screen)[0];

	if (Screen.height <= 768) {
		$('#page-title').css({
			'background-position': 'left bottom',
			'width': '830px',
			'height': '204px'
		});

		$('#team-title').css({
			'background-position': 'left bottom',
			'width': '830px',
			'height': '204px'
		});

		$('.header').css({
			'padding-top': '10px'
		});
	}*/

	// Bind to click on title
	$('#page-title').click(pageTitleClick);
	$('#team-title').click(pageTitleClick);

	function pageTitleClick() {
		if (window.location.href != "/")
			window.location.href = "/"+lang + "/index.sdf";
	};

});