$(document).ready(function() {
/*	$('input[@type=text]').focus(function(){
		var currentVal = $(this).val();										// Read initial field value
		$(this).val('');														// Clear initial value

		$(this).blur(function(){
			var getNewVal = $(this).val();										// Read new input value
			if ( getNewVal == '' || getNewVal == ' ' ) {
				$(this).val(currentVal);										// Switch to initial value
			}
		});
	});
*/
	/* hover for top navigation
	$('ul#principal li.c1').not('.on').hover(function(){$(this).css('background-color','#B7C545');},function(){$(this).css('background-color','#838382');});
	$('ul#principal li.c2').not('.on').hover(function(){$(this).css('background-color','#93C1D2');},function(){$(this).css('background-color','#838382');});
	$('ul#principal li.c3').not('.on').hover(function(){$(this).css('background-color','#E99E84');},function(){$(this).css('background-color','#838382');});
	$('ul#principal li.c4').not('.on').hover(function(){$(this).css('background-color','#92C7B1');},function(){$(this).css('background-color','#838382');});
	$('ul#principal li.c5').not('.on').hover(function(){$(this).css('background-color','#A6A5CA');},function(){$(this).css('background-color','#838382');});
	$('ul#principal li.c6').not('.on').hover(function(){$(this).css('background-color','#E4A2B2');},function(){$(this).css('background-color','#838382');});*/

	/* hover for top navigation */
	$('ul#principal li').not('.on, .c8').hover(
		function(){
			var getClass = $(this).attr('class');
			$(this).css('background-color','#706f6e');
			$('ul#secundar li#'+getClass).addClass(getClass);
		},
		function(){
			var getClass = $(this).attr('class');
			$(this).css('background-color','#838382');
			$('ul#secundar li#'+getClass).removeClass(getClass);
		}
	);

	if($("#art_fund_tracker_container").length) {
		start("art_fund_tracker_container", $("#art_fund_tracker_container .pagination a.on").attr("title"));
	}
});

var detect = navigator.userAgent.toLowerCase();
var os_ = navigator.platform.toLowerCase();
var browser,thestring;

if (checkIt('safari')) browser = "Safari"
else browser = "not Safari"

if ( os_ == 'macppc' || os_ == 'macintel' ) os = "Mac"
else os = "not Mac"

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function start(id, uri) {

	$("#"+id).load(uri+" #"+id+" .inner", false, function() {
		next = $(".next", this).attr("title");
		timeout = setTimeout("start('"+id+"', '"+next+"')",4000);
		$(".paging").click(function(){
			clearTimeout(timeout);
			start(id,$(this).attr('title'));
		});
	});
}

function stop() {
	clearTimeout(timeout);
}
