/*
	Serengeti Communications scripts (utilizing jQuery 1.3.2)
	Developed by TAW ~ tdblanchard
*/

/* --- Initialize page --- */
$(document).ready(function(){

if ($.browser.msie && $.browser.version < 7) {
	$('#primary-navigation ul').addClass("forie6");
	}

//$("#content-wrapper").wrapInner("<div id='sidebar-animal'></div>");


//mailchimp form
	$("a.mailchimp-on").click(function () {
		$("#mailchimp-form-widget").fadeIn("fast");
		return false;
	});	
	
	$("a.close-daddy").click(function () {
		$("#mailchimp-form-widget").fadeOut("fast");
		return false;
	});	


// WORDPRESS
$("#primary-navigation ul").css({display: "none"}); // Opera Fix
$("#primary-navigation li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(268);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
//end WORDPRESS
	// add active class to current nav
	$("#primary-navigation li.current_page_item>a").addClass("active");
	
	// Insert document icons
	$("a[href$=pdf]:not(:has(img))").append('<img class="icon" src="images/icon_pdf.gif" width="14" height="14" alt=" (PDF)">');
	$("a[href$=doc]:not(:has(img)), a[href$=docx]:not(:has(img))").append('<img class="icon" src="images/icon_word.gif" width="14" height="14" alt=" (Word Document)">');
	$("a[href$=xls]:not(:has(img)), a[href$=xlsx]:not(:has(img))").append('<img class="icon" src="images/icon_excel.gif" width="14" height="14" alt=" (Excel Spreadsheet)">');
	$("a[href$=ppt]:not(:has(img)), a[href$=pptx]:not(:has(img))").append('<img class="icon" src="images/icon_powerpoint.gif" width="14" height="14" alt=" (Powerpoint Presentation)">');

	// children CSS3 fix
	$(".columns .col:last-child").addClass("last-child");
	$(".columns .col:first-child").addClass("first-child");
	$(".columns.three .col:eq(1)").addClass("middle-child");
	$("#network-nav ul li:first-child").addClass("first-child");
	$("#primary-navigation>li:first-child").addClass("first-child");

	// IE6 helper functions
	if ($.browser.msie && $.browser.version < 7) {
	$("#bottom-area #box1").addClass("box1ie6");
	$("#bottom-area #box2").addClass("box2ie6");
	$("#bottom-area #box3").addClass("box3ie6");
	}

$("#home-top_photo .photo img").each(function(){
   $(this).attr("title", $(this).attr("alt"));// inject a title attribute that matches the alternate text attribute
});

$("#home #bottom-area").wrapInner("<div id='bottom-area-tree'></div>");

/*
 cycle box call. conditional for IE6 to remove boxes 2-3 & not cycle
*/
if (document.getElementById("home")) {

	if ($.browser.msie && $.browser.version < 7) {
	$('#home-top_photo2, #home-top_photo3').remove();
	}
	else{
		/* Homepage cycle box */
		$('#home-top_photo')
			.cycle({
				fx: 'fade',
				speed: '900',
				timeout: 5000,
				pause: true
			});
		//$("div#cyclenumbers").append('<div class="white"></div>');
	}};

});





