function ts(s){
	var ourText = $('#content');
	setCookie('ccftextsize',s,365);
	var currFontSize = ourText.css('fontSize');
//	var finalNum = parseFloat(currFontSize, 10);
	var finalNum = 11;
	var stringEnding = currFontSize.slice(-2);
	finalNum *= s;
	ourText.css('fontSize', finalNum + stringEnding);
}

function goTo(id){
     	$('html,body').animate({scrollTop: $("#"+id).offset().top-40},'slow');
}

function slide(){
	$('#slider').nivoSlider({
		effect:'fade',
		pauseTime:6000,
		pauseOnHover:false,
		controlNav: false,
		afterChange: function(){
			var cs = $('#slider').data('nivo:vars').currentSlide;
			var tsl='.cuslimg'+cs;
			var tite=$(tsl).attr("alt");
			var titeU=tite;
			$('#overlaycopy p').text(titeU);
		},
  	    afterLoad: function(){
			var tite=$('.cuslimg0').attr("alt");
			var titeU=tite;
			$('#overlaycopy p').text(titeU);
		},
		directionNav:false}
	);
}

function setCookie(c_name,value,exdays){
	var exdate=new Date();
	exdate.setDate(exdate.getDate() + exdays);
	var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
	document.cookie=c_name + "=" + c_value;
}

function getCookie(c_name){
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}

$(function() {
	$(function() {
		var zIndexNumber = 10000;
		$('div').each(function() {
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});
	}); 
	if($('#slider').length){
		setTimeout('slide()', 100);
	}
//	if ($('form').length ) {
//		goTo('tf');
//	}
	if($('#mapslider').length){
		$('#mapslider').nivoSlider();
	}
	if($('.scrollable').length){
		$(".scrollable").scrollable({circular: true, mousewheel: true}).navigator().autoscroll({																				   
	interval: 10000		
	});
	}
	if ($('#column2-home').length ) {
		$(".scrollhome").scrollable({circular: true, vertical: true, mousewheel: true}).navigator().autoscroll({ interval: 10000 });
	}
	var txs=getCookie("ccftextsize");
	  if (txs!=null && txs!=""){
		  	ts(txs);
	  }

});
