//************** FONT SIZE CHANGER *********************

$(document).ready(function()
{

	if ($.cookie("fontSize") != null)
	{
		changeFontSize($.cookie("fontSize"));
	}
	
	$('#text_size a').click( function() {
		var fontSize = $(this).attr('class');
		$.cookie("fontSize", fontSize, {expires: 7, host: 'ckm.osu.edu', path: '/'});
		changeFontSize(fontSize);
		return false;
	});
	
			
	//************** PRINT FRIENDLY VIEW *********************
	var printstatus = $.jqURL.get('printview');
	if(printstatus > 0) {
		$("link").remove();

		$("head").append('<link href="http://ohiovalley.org/css/ohvalley_print.css" rel="stylesheet" type="text/css" />');
		//printPage();
	}
	
	function printPage () {
		window.print();
	}

  	/*var nums = $("#interior_phone").html().replace(";", "<br>");
  	$("#interior_phone").html(nums);*/  
  	/*var nums = $("#interior_phone").html().replace(/[&nbsp;|;|<br>]/g, "");
  	$("#interior_phone").html(nums);*/
  	
  	//for some reason these link clicks don't always get captured in IE
  	//so, this forces them to work when IE fails
  	//also, it accounts for whether or not the link has a target specified
  	$('a.rightrail_custom_subfeature').click( function() {
		var myHREF = $(this).attr('href');
		var myTarget = $(this).attr('target');
		//so, check if there's a target attribute
		if($(this).attr('target').length) {
			//if there is, we assume it's always _blank and open a new window
			window.open(myHREF);
		}else{
			//if there isn't then we just refresh the browser with the new url
			location.href(myHREF);
		}
		return false;

  	
	});

	function changeFontSize(fontSize)
	{
	
		$('link.textsize').replaceWith('<link class="textsize" href="http://ohiovalley.org/css/'+fontSize+'.css" rel="stylesheet" type="text/css" />');
	}

});
