function NavTo(url){
	window.location = url
}

function handleStyleSheet(theme) {
	
	var isTextOnly = false;
		
	$("link[rel='stylesheet']").each(function (i) {	
		
		this.disabled = (this.id == theme) ? false : true;
		
		if (this.disabled == false && this.id == theme && this.media == "all") {			
			isTextOnly = true;
		}
	});
	
	$("link[media='print']").each(function (i) {
		this.disabled = isTextOnly;
	});
}

//	resizing fonts-->
// 	Copyright 2003 Eddie Traversa
// 	http://www.dhtmlnirvana.com/
// 	free to use as long as this copyright notice stays intact
var pixelArray =  new Array('10','11','12','13','14','15','16');
var tags = new Array( 'em', 'a', 'div', 'span', 'i', 'b', 'strong', 'td', 'h1', 'h2' , 'h3', 'h4', 'h5' );
var emArray =  new Array('0.7','0.9','1.0','1.5','2.0','2.5','3');
var initSize = 2;

function fontSizer(inc,unit) {
	var size = initSize;
	
	size += inc;

	if (size < 0 ) {
		size = 0;
	}
	if (size > 6 ) {
		size = 6;
	} 
	
	initSize = size;
	
	getBody = $("div.region-main");

	for (i = 0 ; i < tags.length ; i++ ) {
		for (j = 0 ; j < getBody.length ; j++ ) {
			getallTags = getBody[j].getElementsByTagName(tags[i]);
			
			for (k = 0 ; k < getallTags.length ; k++) {
				getallTags[k].style.fontSize = (unit=='px') ? pixelArray[size]+unit: emArray[size]+unit;
			}
		}
	}
}
	
function pageInititalize() {
	//	handle article galleries
	$(".ShortArticle").each(function (i) {
		handleShortArticleImage(this);
	});
	
	$(".FullArticle").each(function (i) {
		buildGalleries(this);
	});
	
	//	handle text resizing
	$(".smaller-letters").click(function(event){
		event.preventDefault();
		fontSizer(-1,"px");
	});
	$(".larger-letters").click(function(event){
		event.preventDefault();
		fontSizer(1,"px");	
	});

	//	first we must disable text only css
	$("#styleText").each(function (i) {							   
		this.disabled = true;
	});
	
	$(".article-carousel").jcarousel({
		scroll: 1,
		initCallback: mycarousel_initCallback,
		// This tells jCarousel NOT to autobuild prev/next buttons
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
	
	// handle banner rotator to header images
	$("#header-images img").simpleRotator({
		delay: 8000,
		transformationSpeed: 2000,
		enablePause: true
	});

	//	Setup photo gallery
	$(".photo img").each(function(){
		var $img = $(this),
			imgSrc = $img.attr("src");
			
		$img.parent("a")
			.attr("href", imgSrc.substring(0, imgSrc.indexOf("tms=")) + "tms=800")
			.attr("rel", "photo");	
	});
	
	$(".thickbox").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	300, 
		'speedOut'		:	200, 
		'overlayShow'	:	false,
		'titlePosition'	: 'over'	
	});	
}
