﻿var hovering=false;$(function()
{setRightGraphicHeight();var counter=1;var max=$("#nav-slider ul li").length;$("#nav-slider ul li:first").show();$("#nav-slider a.right").click(function()
{var temp=counter;if(counter<max)
{counter++;}
else
{counter=1;}
$("#nav-slider ul li:nth-child("+temp+")").stop().animate({left:-413},"normal","easeOutCubic");$("#nav-slider ul li:nth-child("+counter+")").css("left","413px").stop().animate({left:0},"normal","easeOutCubic");return false;});$("#nav-slider a.left").click(function()
{var temp=counter;if(counter>1)
{counter--;}
else
{counter=max;}
$("#nav-slider ul li:nth-child("+temp+")").stop().animate({left:413},"normal","easeOutCubic");$("#nav-slider ul li:nth-child("+counter+")").css("left","-413px").stop().animate({left:0},"normal","easeOutCubic");return false;});var scroller=$('#social-slider');var scroller_position=scroller.offset().top;$(window).scroll(function()
{var windowPosition=$(window).scrollTop();var destination=windowPosition;if(windowPosition<scroller_position)
{destination=scroller_position;scroller.stop().animate({'top':72},"normal","easeOutCubic");}
else
{scroller.stop().animate({'top':(destination-scroller_position)+144},"normal","easeOutCubic");}
setRightGraphicHeight();return false;});$("#share-twitter").click(function()
{var bitly="http://api.bit.ly/v3/shorten?&login=cccev&apiKey=R_30802a4e8af1e1bd8b3d95dbe961ff24&uri="+escape(window.location.href)+"&format=json&callback=?";$.getJSON(bitly,function(response)
{var tweet="Check out "+document.title+" from @cccev! "+response.data.url;var twitterPath="http://twitter.com/home?status="+escape(tweet);window.open(twitterPath);});return false;});$("#connect").click(function()
{clearNav();var nav=$("#connect-nav");if(nav.is(":visible"))
{nav.fadeOut("fast");$(this).removeClass("selected").next("img").fadeOut("fast");return false;}
nav.fadeIn("fast");$(this).addClass("selected").next("img").fadeIn("fast");$("#nav-slider ul li:nth-child("+counter+")").css("left","413px").animate({left:0},"normal","easeOutCubic");return false;});$("#footer-connect").click(function()
{$("html, body").animate({scrollTop:0},1000,"easeOutCubic");if($("#connect-nav").is(":hidden"))
{setTimeout('$("#connect").click();',1000);}
return false;});$("#about").click(function()
{clearNav();var nav=$("#about-nav");if(nav.is(":visible"))
{nav.fadeOut("fast");$(this).removeClass("selected").next("img").fadeOut("fast");return false;}
nav.fadeIn("fast");$(this).addClass("selected").next("img").fadeIn("fast");return false;});$("#footer-about").click(function()
{$("html, body").animate({scrollTop:0},1000,"easeOutCubic");if($("#about-nav").is(":hidden"))
{setTimeout('$("#about").click();',1000);}
return false;});$("#go-to-top").click(function()
{$("html, body").animate({scrollTop:0},1000,"easeOutCubic");return false;});$(".search").focus(function()
{if($(this).val().toLowerCase()=="search")
{$(this).val("");}
return false;});$(".search").blur(function()
{if($(this).val().trim()=="")
{$(this).val("SEARCH");}
return false;});$(".search-button").click(function()
{var search=$("input:text[id$='tbSearch']");if(search.val().trim()===""||search.val().toLowerCase()==="search")
{return false;}
return true;});$("#campus, #about, #connect, #campus-nav, #about-nav, #connect-nav, #footer-campus-select, .children").hover(function()
{hovering=true;return false;},function()
{hovering=false;return false;});$(document).click(function()
{if(!hovering)
{clearNav();$("#footer-campus-select").slideUp(100);}
return true;});$("a[id$='lbLogout']").click(function()
{return confirm("Are you sure you want to log out?");});$("#topics li a").click(function()
{if($(this).hasClass("selected"))
{$(this).removeClass("selected");return false;}
$(this).addClass("selected");return false;});$("#customize").click(function()
{var topics=$("#topics");if(topics.is(":visible"))
{topics.fadeOut("fast");return false;}
topics.fadeIn("fast");if($("#news .jScrollPaneContainer").length==0)
{$("#topic-list").jScrollPane({scrollbarWidth:15});}
return false;});$(".node").click(function()
{clearNav();var childNav=$(this).siblings(".children");if(childNav.is(":hidden"))
{$(this).addClass("expand");childNav.fadeIn("fast");return false;}
$(this).removeClass("expand");childNav.fadeOut("fast");return false;});});function clearNav()
{$("#campus-nav").fadeOut("fast");$("#campus").removeClass("selected").next("img").fadeOut("fast");$("#about-nav").fadeOut("fast");$("#about").removeClass("selected").next("img").fadeOut("fast");$("#connect-nav").fadeOut("fast");$("#connect").removeClass("selected").next("img").fadeOut("fast");$(".node").removeClass("expand").siblings(".children").fadeOut("fast");return false;}
function setRightGraphicHeight()
{var $right=$("#right");var currentHeight=$right.height();var docHeight=$(document).height();if(window.Touch&&currentHeight!=docHeight)
{$right.css("height",docHeight+"px");}}
