/* Copyright Bridgeline Digital, An unpublished work created in 2011. All rights reserved. This software contains the confidential and trade secret information of Bridgeline Software, Inc. ("Bridgeline").  Copying, distribution or disclosure without Bridgeline's express written permission is prohibited. */

// Clear Text Field
function clearTextField(ElemID){
	var tempElem = document.getElementById(ElemID);
	if (tempElem){
		tempElem.value="";
	}
}

function checkSearchField(ElemID){
  var tempElem = document.getElementById(ElemID);
  if(tempElem && tempElem.value==""){
    tempElem.value="Enter Search Terms " ;
    }
}
/* JQuery Plugin: jShowOff - Version: 0.1.2 - Author: Erik Kallevig - Web Link: http://ekallevig.com/jshowoff */
(function($){$.fn.jshowoff=function(settings){var config={animatePause:true,autoPlay:true,changeSpeed:600,controls:true,controlText:{play:'Play',pause:'Pause',next:'Next',previous:'Previous'},effect:'fade',hoverPause:true,links:true,speed:3000};if(settings)$.extend(true,config,settings);if(config.speed<(config.changeSpeed+20)){alert('jShowOff: Make speed at least 20ms longer than changeSpeed; the fades aren\'t always right on time.');return this;};this.each(function(i){var $cont=$(this);var gallery=$(this).children().remove();var timer='';var counter=0;var preloadedImg=[];var howManyInstances=$('.jshowoff').length+1;var uniqueClass='jshowoff-'+howManyInstances;var cssClass=config.cssClass!=undefined?config.cssClass:'';$cont.css('position','relative').wrap('<div class="jshowoff '+uniqueClass+'" />');var $wrap=$('.'+uniqueClass);$wrap.css('position','relative').addClass(cssClass);$(gallery[0]).clone().appendTo($cont);preloadImg();if(config.controls){addControls();if(config.autoPlay==false){$('.'+uniqueClass+'-play').addClass(uniqueClass+'-paused jshowoff-paused').text(config.controlText.play);};};if(config.links){addSlideLinks();$('.'+uniqueClass+'-slidelinks a').eq(0).addClass(uniqueClass+'-active jshowoff-active');};if(config.hoverPause){$cont.hover(function(){if(isPlaying())pause('hover');},function(){if(isPlaying())play('hover');});};if(config.autoPlay&&gallery.length>1){timer=setInterval(function(){play();},config.speed);};if(gallery.length<1){$('.'+uniqueClass).append('<p>For jShowOff to work, the container element must have child elements.</p>');};function transitionTo(gallery,index){var oldCounter=counter;if((counter>=gallery.length)||(index>=gallery.length)){counter=0;var e2b=true;}
else if((counter<0)||(index<0)){counter=gallery.length-1;var b2e=true;}
else{counter=index;}
if(config.effect=='slideLeft'){var newSlideDir,oldSlideDir;function slideDir(dir){newSlideDir=dir=='right'?'left':'right';oldSlideDir=dir=='left'?'left':'right';};counter>=oldCounter?slideDir('left'):slideDir('right');$(gallery[counter]).clone().appendTo($cont).slideIt({direction:newSlideDir,changeSpeed:config.changeSpeed});if($cont.children().length>1){$cont.children().eq(0).css('position','absolute').slideIt({direction:oldSlideDir,showHide:'hide',changeSpeed:config.changeSpeed},function(){$(this).remove();});};}else if(config.effect=='fade'){$(gallery[counter]).clone().appendTo($cont).hide().fadeIn(config.changeSpeed,function(){if($.browser.msie)this.style.removeAttribute('filter');});if($cont.children().length>1){$cont.children().eq(0).css('position','absolute').fadeOut(config.changeSpeed,function(){$(this).remove();});};}else if(config.effect=='none'){$(gallery[counter]).clone().appendTo($cont);if($cont.children().length>1){$cont.children().eq(0).css('position','absolute').remove();};};if(config.links){$('.'+uniqueClass+'-active').removeClass(uniqueClass+'-active jshowoff-active');$('.'+uniqueClass+'-slidelinks a').eq(counter).addClass(uniqueClass+'-active jshowoff-active');};};function isPlaying(){return $('.'+uniqueClass+'-play').hasClass('jshowoff-paused')?false:true;};function play(src){if(!isBusy()){counter++;transitionTo(gallery,counter);if(src=='hover'||!isPlaying()){timer=setInterval(function(){play();},config.speed);}
if(!isPlaying()){$('.'+uniqueClass+'-play').text(config.controlText.pause).removeClass('jshowoff-paused '+uniqueClass+'-paused');}};};function pause(src){clearInterval(timer);if(!src||src=='playBtn')$('.'+uniqueClass+'-play').text(config.controlText.play).addClass('jshowoff-paused '+uniqueClass+'-paused');if(config.animatePause&&src=='playBtn'){$('<p class="'+uniqueClass+'-pausetext jshowoff-pausetext">'+config.controlText.pause+'</p>').css({fontSize:'62%',textAlign:'center',position:'absolute',top:'40%',lineHeight:'100%',width:'100%'}).appendTo($wrap).addClass(uniqueClass+'pauseText').animate({fontSize:'600%',top:'30%',opacity:0},{duration:500,complete:function(){$(this).remove();}});}};function next(){goToAndPause(counter+1);};function previous(){goToAndPause(counter-1);};function isBusy(){return $cont.children().length>1?true:false;};function goToAndPause(index){$cont.children().stop(true,true);if((counter!=index)||((counter==index)&&isBusy())){if(isBusy())$cont.children().eq(0).remove();transitionTo(gallery,index);pause();};};function preloadImg(){$(gallery).each(function(i){$(this).find('img').each(function(i){preloadedImg[i]=$('<img>').attr('src',$(this).attr('src'));});});};function addControls(){$wrap.append('<p class="jshowoff-controls '+uniqueClass+'-controls"><a class="jshowoff-prev '+uniqueClass+'-prev" href="#null">'+config.controlText.previous + '<a class="jshowoff-play '+uniqueClass+'-play" href="#null">'+config.controlText.pause +'</a> <a class="jshowoff-next '+uniqueClass+'-next" href="#null">'+config.controlText.next+'</a></p>');$('.'+uniqueClass+'-controls a').each(function(){if($(this).hasClass('jshowoff-play'))$(this).click(function(){isPlaying()?pause('playBtn'):play();return false;});if($(this).hasClass('jshowoff-prev'))$(this).click(function(){previous();return false;});if($(this).hasClass('jshowoff-next'))$(this).click(function(){next();return false;});});};function addSlideLinks(){$wrap.append('<p class="jshowoff-slidelinks '+uniqueClass+'-slidelinks"></p>');$.each(gallery,function(i,val){var linktext=$(this).attr('title')!=''?$(this).attr('title'):i+1;$('<a class="jshowoff-slidelink-'+i+' '+uniqueClass+'-slidelink-'+i+'" href="#null">'+linktext+'</a>').bind('click',{index:i},function(e){goToAndPause(e.data.index);return false;}).appendTo('.'+uniqueClass+'-slidelinks');});};});return this;};})(jQuery);(function($){$.fn.slideIt=function(settings,callback){var config={direction:'left',showHide:'show',changeSpeed:600};if(settings)$.extend(config,settings);this.each(function(i){$(this).css({left:'auto',right:'auto',top:'auto',bottom:'auto'});var measurement=(config.direction=='left')||(config.direction=='right')?$(this).outerWidth():$(this).outerHeight();var startStyle={};startStyle['position']=$(this).css('position')=='static'?'relative':$(this).css('position');startStyle[config.direction]=(config.showHide=='show')?'-'+measurement+'px':0;var endStyle={};endStyle[config.direction]=config.showHide=='show'?0:'-'+measurement+'px';$(this).css(startStyle).animate(endStyle,config.changeSpeed,callback);});return this;};})(jQuery);

/* Plungin: Text changer - Version: 0.2 - Author: Marco Rosella - WebLink: http://lab.centralscrutinizer.it/the-text-changer/ */
function getCookie(c_name){
if (document.cookie.length>0){
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1){
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

/* Plugin: Pajinate */
(function($) { $.fn.pajinate = function(options) { var current_page = "current_page"; var items_per_page = "items_per_page"; var meta; var defaults = { item_container_id: ".content", items_per_page: 10, nav_panel_id: ".page_navigation", num_page_links_to_display: 20, start_page: 0, nav_label_first: "First", nav_label_prev: "Prev", nav_label_next: "Next", nav_label_last: "Last" }; var options = $.extend(defaults, options); var $item_container; var $page_container; var $items; var $nav_panels; return this.each(function() { $page_container = $(this); $item_container = $(this).find(options.item_container_id); $items = $page_container.find(options.item_container_id).children(); meta = $page_container; meta.data(current_page, 0); meta.data(items_per_page, options.items_per_page); var total_items = $item_container.children().size(); var number_of_pages = Math.ceil(total_items / options.items_per_page); var more = '<span class="ellipse more">...</span>'; var less = '<span class="ellipse less">...</span>'; var navigation_html = '<a class="first_link" href="">' + options.nav_label_first + "</a>"; navigation_html += '<a class="previous_link" href="">' + options.nav_label_prev + "</a>" + less; var current_link = 0; while (number_of_pages > current_link) { navigation_html += '<a class="page_link" href="" longdesc="' + current_link + '">' + (current_link + 1) + "</a>"; current_link++ } navigation_html += more + '<a class="next_link" href="">' + options.nav_label_next + "</a>"; navigation_html += '<a class="last_link" href="">' + options.nav_label_last + "</a>"; $nav_panels = $page_container.find(options.nav_panel_id); $nav_panels.html(navigation_html).each(function() { $(this).find(".page_link:first").addClass("first"); $(this).find(".page_link:last").addClass("last") }); $nav_panels.children(".ellipse").hide(); $nav_panels.find(".previous_link").next().next().addClass("active_page"); $items.hide(); $items.slice(0, meta.data(items_per_page)).show(); var total_page_no_links = $page_container.children(options.nav_panel_id + ":first").children(".page_link").size(); options.num_page_links_to_display = Math.min(options.num_page_links_to_display, total_page_no_links); $nav_panels.children(".page_link").hide(); $nav_panels.each(function() { $(this).children(".page_link").slice(0, options.num_page_links_to_display).show() }); $page_container.find(".first_link").click(function(e) { e.preventDefault(); movePageNumbersRight($(this), 0); gotoPage(0) }); $page_container.find(".last_link").click(function(e) { e.preventDefault(); var lastPage = total_page_no_links - 1; movePageNumbersLeft($(this), lastPage); gotoPage(lastPage) }); $page_container.find(".previous_link").click(function(e) { e.preventDefault(); showPrevPage($(this)) }); $page_container.find(".next_link").click(function(e) { e.preventDefault(); showNextPage($(this)) }); $page_container.find(".page_link").click(function(e) { e.preventDefault(); gotoPage($(this).attr("longdesc")) }); gotoPage(parseInt(options.start_page)); toggleMoreLess() }); function showPrevPage(e) { new_page = parseInt(meta.data(current_page)) - 1; if ($(e).siblings(".active_page").prev(".page_link").length == true) { movePageNumbersRight(e, new_page); gotoPage(new_page) } } function showNextPage(e) { new_page = parseInt(meta.data(current_page)) + 1; if ($(e).siblings(".active_page").next(".page_link").length == true) { movePageNumbersLeft(e, new_page); gotoPage(new_page) } } function gotoPage(page_num) { var ipp = meta.data(items_per_page); var isLastPage = false; start_from = page_num * ipp; end_on = start_from + ipp; $items.hide().slice(start_from, end_on).show(); $page_container.find(options.nav_panel_id).children(".page_link[longdesc=" + page_num + "]").addClass("active_page").siblings(".active_page").removeClass("active_page"); meta.data(current_page, page_num); toggleMoreLess() } function movePageNumbersLeft(e, new_p) { var new_page = new_p; var $current_active_link = $(e).siblings(".active_page"); if ($current_active_link.siblings(".page_link[longdesc=" + new_page + "]").css("display") == "none") { $nav_panels.each(function() { $(this).children(".page_link").hide().slice(parseInt(new_page - options.num_page_links_to_display + 1), new_page + 1).show() }) } } function movePageNumbersRight(e, new_p) { var new_page = new_p; var $current_active_link = $(e).siblings(".active_page"); if ($current_active_link.siblings(".page_link[longdesc=" + new_page + "]").css("display") == "none") { $nav_panels.each(function() { $(this).children(".page_link").hide().slice(new_page, new_page + parseInt(options.num_page_links_to_display)).show() }) } } function toggleMoreLess() { if (!$nav_panels.children(".page_link:visible").hasClass("last")) { $nav_panels.children(".more").show() } else { $nav_panels.children(".more").hide() } if (!$nav_panels.children(".page_link:visible").hasClass("first")) { $nav_panels.children(".less").show() } else { $nav_panels.children(".less").hide() } } } })(jQuery);

function checkCookie(){
thesize=getCookie('size');
if ((thesize == 0.8666666666666667) || (thesize == 0.87)){
	$("#textchanger ul li#decrease").addClass("off");} else {
	$("#textchanger ul li#decrease").removeClass();}
if (thesize == 1.9500000000000002){
	$("#textchanger ul li#increase").addClass("off");
  } else {
	$("#textchanger ul li#increase").removeClass(); 
  }
}
function initFontResize() {
	textChanger.init();
	checkCookie();
}
var textChanger = {
	defaultFS : 0.75,
	init: function() {
		var el = document.getElementsByTagName("body")[0];
		var sz = textChanger.getCookie();
		el.style.fontSize = sz ? sz + 'em' : textChanger.defaultFS + 'em';
		var incr = document.getElementById('increase');
		if(incr)
			incr.onclick = function(){textChanger.changeSize(1); return false;};
		var decr = document.getElementById('decrease');
		if(decr)
			decr.onclick = function(){textChanger.changeSize(-1); return false;};
		var reset = document.getElementById('reset');
		if(reset)
			reset.onclick = function(){textChanger.changeSize(0); return false;};
	},
	changeSize: function(val) {
		var el = document.getElementsByTagName("body")[0];
		var size = el.style.fontSize.substring(0, 4);
		var fSize = parseFloat(size, 10);
		if (val == 1)	{
			fSize += 0.1;
			if (fSize > textChanger.defaultFS*1.5) fSize = textChanger.defaultFS*1.5;
		} 
		if (val == -1) {
			fSize -= 0.1;
			if (fSize < textChanger.defaultFS/1.5) fSize = textChanger.defaultFS/1.5;
		}
		if (val == 0) fSize = textChanger.defaultFS;
		el.style.fontSize = fSize.toFixed(2) + 'em';
		textChanger.updateCookie(fSize);
		checkCookie();		
	},
	updateCookie: function(vl)	{
		var today = new Date();
		var exp = new Date(today.getTime() + (365*24*60*60*1000));
		document.cookie = 'textChangerL=size=' + vl + ';' +'expires=' + exp.toGMTString() + ';' +'path=/';
	},
	getCookie: function()	{ 
		var cname = 'textChangerL=size=';   
		var start = document.cookie.indexOf(cname);
		var len = start + cname.length;
		if ((!start) && (cname != document.cookie.substring(0,cname.length))) {return null;}
		if (start == -1) return null;
		var end = document.cookie.indexOf(";",len);
		if (end == -1) end = document.cookie.length;
		return unescape(document.cookie.substring(len, end));
	}
}
if (window.addEventListener)
	window.addEventListener("load", initFontResize, false);
else if (window.attachEvent && !window.opera)
	window.attachEvent("onload", initFontResize);

$(function() {
    // Show Text Changer
    $('#textchanger').css("visibility", "visible");

    // Home Page - Intitiate Introduction Banner
    $('#hmeIntro').jshowoff({ speed:6000, cssClass: 'hmeIntro', links: false, hoverPause: false, animatePause: false });
    
    //SubNavigation show/hide
    $('#oneColSubNav .contentNav').show();
});


