/* ---------------- */
/* GLOBAL FUNCTIONS */
/* ---------------- */

function jumpScroll() {
	window.scroll(0,0); // Jump to top of the page
}
function clearText(theText) {
	if (theText.value == theText.defaultValue) {
		theText.value = ""
	}
}
function showText(theText) {
	if (theText.value == "") {
		theText.value = theText.defaultValue;
	}
}

String.prototype.Trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, "");
} 





$(document).ready(function(){
	
	window.Deck = $('.slidedeck').css({
		width: '906px',
		height: '545px'
	}).slidedeck({
		start: 1,
		scroll: false,
		index: ['1','2','3','4','5','6','7']
	});
	$(".slide_menu li").click(function(event)
	{
		var target = $(this).attr("id");
		var targetID = "#" + target.substring(0,6);
		var x_pos = target.substring(13,16);
		var y_pos = target.substring(17,target.length);
		$(targetID).find('.img').scrollTo({ top:y_pos, left:x_pos}, 400);
		$(targetID).find('.slide_menu li').each(function(i) {
		    //alert(index + ': ' + $(this).text());
		    $(this).removeClass();
		});
		$(this).addClass("active");
		return false;
	});
	
	pageCount = $(".pages").find("a").size();
	pageButtonWidth = $(".pages").find("a").width() + 2;
	$(".pages_numbers").css('width',pageCount*pageButtonWidth);

	$('.comment_block').click(function(event)
	{
		window.location.href=$(this).find('a.comment_links').attr('href');
	});
	
	$('.about_us_button').click(function(event)
	{
		window.location.href=$(this).find('a').attr('href');
	});
	
	
	$("#search-frm").submit(function() { 
		search_term = $("#search-term").val(); 
		if(search_term.length > 0) {
			window.location.href= site_dir + "/search/" + search_term;
		}
		return false;
	});


});



