var summarytimer = 0; var sticktimer = 0; var timeout = 500; var closetimer = 0; var ddmenuitem = 0; var bgtimer = 0; $(document).ready(function() { if (!getCookie('terms_agree')) tb_show('Disclaimer','/disclaimer.php?KeepThis=true&TB_iframe=true&modal=true&height=500&width=600'); $('#carousel').jcarousel({ start: $('#carousel').attr('rel'), scroll: 1, initCallback: mycarousel_initCallback, buttonNextHTML: null, buttonPrevHTML: null }); $('#ourpeople .rightcolumn a.'+$('#carousel').attr('rel')).css('background-color','#495b64'); $('ul#contactnav li a.'+$('#carousel').attr('rel')).css('background-image','url(/_images/selectgrad.jpg)'); $('ul#contactnav li a.'+$('#carousel').attr('rel')).css('color', '#fff'); Cufon.replace('.established, h1, h2, h3, .cufon'); Cufon.replace('.logo', { color: '-linear-gradient(#868889, #fff)' }); $('#navigation > li').bind('mouseover', menu_open); $('#navigation > li').bind('mouseout', menu_timer); $('.stockticker').marquee('stockticker').mouseover(function () { $(this).trigger('stop'); }).mouseout(function () { $(this).trigger('start'); }).mousemove(function (event) { if ($(this).data('drag') == true) { this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX); } }).mousedown(function (event) { $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft); }).mouseup(function () { $(this).data('drag', false); }); //$('.rightcolumn').css("margin-bottom", $('.links').height()+60); if ($('.marketsummary')) { updateSummary(); } bgtimer = setTimeout('setBgSize();', 100); updateStocks(); }); function setCookie(name, value, expires, path, domain, secure) { document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } function mycarousel_initCallback(carousel) { $('#ourpeople .rightcolumn a').click(function () { carousel.scroll($(this).attr('class')); $('#ourpeople .rightcolumn a').css('background-color',''); $(this).css('background-color','#495b64'); return false; }); $('ul#contactnav li a').click(function () { carousel.scroll($(this).attr('class')); $('ul#contactnav li a').css('background-image','url(/_images/selectgradoff.jpg)'); $('ul#contactnav li a').css('color', 'inherit'); $(this).css('background-image','url(/_images/selectgrad.jpg)'); $(this).css('color', '#fff'); return false; }); } function setBgSize() { var imgRatio = $('#bg > img').height() / $('#bg > img').width(); var winRatio = $(window).height() / $(window).width(); var left = 0; if (imgRatio > winRatio) { //Wider... $('#bg > img').width($(window).width()); $('#bg > img').height(); } else { //Longer... $('#bg > img').width(); $('#bg > img').height($(window).height()); //left = Math.round($('#bg > img').width() - $(window).width())/2; } bgtimer = setTimeout('setBgSize();', 300); // $('#bg').css("left", left); } function updateSummary() { $.get("/_includes/_inserts/stockticker/marketsummary.php", { }, function(data) { //alert(data); //alert($('.stockticker').html()); $('.marketsummary').html(data); }); summarytimer = setTimeout('updateSummary()', 600000); } function updateStocks() { $.get("/_includes/_inserts/stockticker/stockticker.php", { }, function(data) { //alert(data); //alert($('.stockticker').html()); $('.stockticker').find('> div').append(data); }); stocktimer = setTimeout('updateStocks()', 60000); } function menu_open() { menu_canceltimer(); menu_close(); ddmenuroot = $(this).addClass('hover'); ddmenuparent = $(this).find('> a').addClass('hover'); ddmenuitem = $(this).find('ul').css('visibility', 'visible'); } function menu_close() { if(ddmenuitem) { ddmenuitem.css('visibility', 'hidden'); ddmenuparent.removeClass('hover'); ddmenuroot.removeClass('hover'); } } function menu_timer() { closetimer = window.setTimeout(menu_close, timeout); } function menu_canceltimer() { if(closetimer){ window.clearTimeout(closetimer); closetimer = null; } }