/* Author: Tim Blanchard | The Associated Web, LLC

*/

$(document).ready(function() {

//   Browser sniffers
//~~~~~~IE7

if ($.browser.msie) {
	$("html").addClass("browser-ie");
	}
//~~~~~~Firefox
if ($.browser.mozilla) {
	$("html").addClass("browser-firefox");
	}
//~~~~~~Safari
if ($.browser.safari) {
	$("html").addClass("browser-firefox");
	}
$('.page-navi > ul').addClass('top-level-ul');
$('.page-navi > ul > li').addClass('top-level');
$('.page-navi > ul > li > a').addClass('lg');
$('.page-navi > ul > li:last-child').addClass('last');
$('.page-navi > ul > li:first-child').addClass('first');
$('#primary-nav').css({visibility:'visible'});
$('.dbem_events_list li').addClass('clearfix');

$('.page-navi > ul > li.current_page_item > a, .page-navi > ul > li.current_page_ancestor > a').addClass('activia');

$('.wp-caption a').attr('rel', 'lightbox')


if (document.getElementById("home")) {
//Events/News list hider, since we can't seem to limit the events list on the homepage, this will limit both to 3

$('.tabbed-content ul.dbem_events_list li').slice(3).remove();
$('ul.news-list li').slice(3).remove();

//END event list hider

	if ($.browser.msie && $.browser.version < 7) {
		$('#home-top-message2, #home-top-message3').remove();
		}
		else{
		$('#phoneybox').cycle({ 
	    fx:     'fade', 
	    speed:  '900', 
	    timeout: 5000, 
	    pause: true,
	    next: '#next',
		prev: '#prev',
	    pager:  '#cyclenav', 
		    pagerAnchorBuilder: function(idx, slide) { 
		        // return selector string for existing anchor 
		        return '#cyclenav li:eq(' + idx + ')'; 
		    }
		});
		$('#tab-cycle').cycle({ 
	    fx:     'fade',
	    pager:  '#tabs', 
		    pagerAnchorBuilder: function(idx, slide) { 
		        // return selector string for existing anchor 
		        return '#tabs li:eq(' + idx + ')'; 
		    }
		}).cycle('pause');
		}//end if ie6
}//end if home

//the script below activates the placeholder text for input fields
//<![CDATA[
              $('[placeholder]').focus(function() {
                var input = $(this);
                if (input.val() == input.attr('placeholder')) {
                  input.val('');
                  input.removeClass('placeholder');
                }
              }).blur(function() {
                var input = $(this);
                if (input.val() == '') {
                  input.addClass('placeholder');
                  input.val(input.attr('placeholder'));
                }
              }).blur().parents('form').submit(function() {
                $(this).find('[placeholder]').each(function() {
                  var input = $(this);
                  if (input.val() == input.attr('placeholder')) {
                    input.val('');
                  }
                })
              });
            //]]>





});//end DocReady
$(document).ready(function() {
//$("#dropmenu ul").css({display: "none"}); // Opera Fix
$("#dropmenu li").hover(function(){
$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(268);
},function(){
$(this).find('ul:first').css({visibility: "hidden"});
});
});

