function resizeText(){
// Reset Font Size
  var originalFontSize = 12;
  var currentFontSize = 12;
 
  // Increase Font Size
  $(".increaseFont").click(function(){
  	if (currentFontSize<=16){
		currentFontSize = currentFontSize+1.25;
	}
  	$('p').css('font-size', currentFontSize);
	return false;
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
	if (currentFontSize >= 10){
		currentFontSize = currentFontSize-1;
	}
  	$('p').css('font-size', currentFontSize);
	return false;
  });
}

function createNav(){
	var printList = "";

	var createHref = function(x){
		var _this = x,
		url = _this.attr('url'),
		title = _this.attr('title'),
		htmlLink = '<a href="'+url+'">' + title +'</a>';
		return(htmlLink);
  	}
	
	var checkKids = function(z){
		z.children().each(function(){
			checkForMore($(this));
		});
	}
	
	var checkForMore = function(y){
		var _this = y;
		if(_this.attr('id')){
			var id = _this.attr('id');
			printList += '<ul>';
			checkKids(_this);
			printList += '</ul>';		
		} else if(_this.attr('title')){
			printList += '<li>';
			var href = createHref(_this);
			printList += href;
			checkKids(_this);
			printList += '</li>';
		} else if (_this.children()){
			printList += '<ul>';
			checkKids(_this);
			printList += '</ul>';
		} 
	}
	
	$.ajax({
		type: "GET",
		url: "/xml/mainMenu.xml",
		dataType: "xml",
		success: function(xml) {
			var id;
			var list = "";
			$(xml).find('items').each(function(){
				var listXML = $(this);
				$(this).children().each(function(){
					printList = "";
					var htmlId = $(this).attr('id');
					checkForMore($(this));
					$(printList).appendTo('#' + htmlId);
				});
			});
			jqueryslidemenu.buildmenu("nav-main2", arrowimages);
		}
	});
}


function createNICList(){
	$('<div id="nic-loading" class="loading"><img src="/images/loader.gif" alt="loading" /></div>').appendTo('#new-in-corrections');
			$.ajax({
				type: "GET",
				url: "/xml/NewInCorrections.xml",
				dataType: "xml",
				success: function(xml) {
					var mainAppLink = "/NewInCorrections.html";
					var mainAppTxt = "View All";
					var listArray = new Array();
					var listItems = 0;
					var numLists = 0;
					//show the loading animation		
					$(xml).find('item').each(function(){
					
						if(listItems==6 || listItems==0){
							listItems=1;
							numLists++;
							$('<div id="nic-'+numLists+'"></div>').appendTo('#new-in-corrections');
							$('<ul id="ul-nic-'+numLists+'"></ul>').appendTo('#nic-'+numLists);
				
						}
						var title = $(this).find('title').text();
						var url = $(this).find('link').text();
						
						$('<li></li>').html('<a href="'+url+'">'+title+'</a>').appendTo('#ul-nic-'+numLists);
						listItems++;
					});
					$('<ul id="ul-nic-nav"></ul>').appendTo('#new-in-corrections');
					for (x=0;x<numLists;x++){
						$('<li></li>').html('<a href="#nic-'+(x+1)+'">'+(x+1)+'</a>').appendTo('#ul-nic-nav');
					}
					$("#new-in-corrections").tabs();
				}	
			});
	$("#nic-loading").remove();
}

function createBreakingList(){
	$('<div id="bn-loading" class="loading"><img src="/images/loader.gif" alt="loading" /></div>').appendTo('#breaking-news');				
	$.ajax({
				type: "GET",
				url: "/xml/PressReleases.xml",
				dataType: "xml",
				success: function(xml) {
					var mainAppLink = "/NewsRoom/PressReleases/PressReleases.html";
					var mainAppTxt = "View All";
					var listArray = new Array();
					var listItems = 0;
					var numLists = 0;
					$(xml).find('item').each(function(){
					
						if(listItems==4 || listItems==0){
							listItems=1;
							numLists++;
							$('<div id="bn-'+numLists+'"></div>').appendTo('#breaking-news');
							$('<ul id="ul-bn-'+numLists+'"></ul>').appendTo('#bn-'+numLists);
				
						}
						var date = $(this).find('pubDate').text();
						var title = $(this).find('title').text();
						var url = $(this).find('link').text();
						
						$('<li></li>').html('<a href="'+url+'"><span class="date">'+date+'</span><span class="title">'+title+'</span></a>').appendTo('#ul-bn-'+numLists);
						listItems++;
					});
					$('<ul id="ul-bn-nav"></ul>').appendTo('#breaking-news');
					$('<a href="'+ mainAppLink +'" class="viewall">'+ mainAppTxt +'</a>').appendTo('#ul-bn-nav');
					for (x=0;x<numLists;x++){
						$('<li></li>').html('<a href="#bn-'+(x+1)+'">'+(x+1)+'</a>').appendTo('#ul-bn-nav');
					}
					$("#breaking-news").tabs();
					
				}
					
			});	
	$("#bn-loading").remove();
}

function createVideoList(){
	$('<div id="vl-loading" class="loading"><img src="/images/loader.gif" /></div>').appendTo('#featured-videos');
	$.ajax({
				type: "GET",
				url: "/xml/FeaturedVideos.xml",
				dataType: "xml",
				success: function(xml) {
					$(xml).find('item').each(function(){
						var title = $(this).find('title').text();
						var url = $(this).find('link').text();
						var img = $(this).find('thumb').text();
						$('<li></li>').html('<a href="'+url+'"><img src="'+img+'" alt="'+title+'" title="'+title+'" /><span>'+title+'</span></a>').appendTo('#featured-videos ul');
					});
				}
					
	});	
	$("#vl-loading").remove();
}

function createPublicationList(){
	$('<div id="pl-loading" class="loading"><img src="/images/loader.gif" /></div>').appendTo('#featured-publication');
	$.ajax({
				type: "GET",
				url: "/xml/FeaturedPublications.xml",
				dataType: "xml",
				success: function(xml) {
					$(xml).find('item').each(function(){
						var title = $(this).find('title').text();
						var url = $(this).find('link').text();
						var img = $(this).find('thumb').text();
						$('<li></li>').html('<a href="'+url+'"><img src="'+img+'" alt="'+title+'" title="'+title+'" /><span>'+title+'</span></a>').appendTo('#featured-publication ul');
					});
				}	
	});	
	$("#pl-loading").remove();
}


//this opens a pop up window
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

