//Menu Script________________________________________________________________________________________________
$(function() {
		// set opacity to nill on page load
		$("ul#menu span").css("opacity","0");
		// on mouse over
		$("ul#menu span").hover(function () {
			// animate opacity to full
			$(this).stop().animate({
				opacity: 1
			}, 'slow');
		},
		// on mouse out
		function () {
			// animate opacity to nill
			$(this).stop().animate({
				opacity: 0
			}, 'slow');
		});
	});



// Feedback Tab Location Script________________________________________________________________________________________________
jQuery.fn.feedback = function (absolute) {
	return this.each(function () {
		var t = jQuery(this);

		t.css({
			position:	absolute ? 'absolute' : 'fixed'
		}).css({
			marginTop:	'-' + (t.outerHeight() / 2) + 'px'
		});

		if (absolute) {
			t.css({
				marginTop:	parseInt(t.css('marginTop'), 10) + jQuery(window).scrollTop(), 
			});
		}
	});
};


// Center Location Script________________________________________________________________________________________________
jQuery.fn.center = function (absolute) {
	return this.each(function () {
		var t = jQuery(this);

		t.css({
			position:	absolute ? 'absolute' : 'fixed', 
			left:		'50%', 
			top:		'50%', 
			zIndex:		'1500'
		}).css({
			marginLeft:	'-' + (t.outerWidth() / 2) + 'px', 
			marginTop:	'-' + (t.outerHeight() / 2) + 'px'
		});

		if (absolute) {
			t.css({
				marginTop:	parseInt(t.css('marginTop'), 10) + jQuery(window).scrollTop(), 
				marginLeft:	parseInt(t.css('marginLeft'), 10) + jQuery(window).scrollLeft()
			});
		}
	});
};


// Tab Script________________________________________________________________________________________________
	  $(document).ready(function(){
		
		$("a.tab").click(function () {
			
			
			$(".active").removeClass("active");
			
			$(this).addClass("active");
			
			$(".content").slideUp();
			
			var content_show = $(this).attr("title");
			$("#"+content_show).slideDown();
		  
		});
	
	  }); 

// Accordian Script________________________________________________________________________________________________
$(document).ready(function(){
	
	$(".accordion2 h3").eq().addClass("active");
	$(".accordion2 p").eq().show();

	$(".accordion2 h3").click(function(){
		$(this).next("p").slideToggle("slow")
		.siblings("p:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});

});

// Drop Script________________________________________________________________________________________________
$(document).ready(function(){
						   						   
            $(".dropLink").click(function(){
                        $("#dropForm, #dropBack").fadeIn("slow");
                });
				
				$(".dropLink2").click(function(){
                        $("#dropForm2, #dropBack").fadeIn("slow");
                });
				 
				$(".dropLink3").click(function(){
                        $("#dropForm3, #dropBack").fadeIn("slow");
                });
				
				$(".dropLinkPray").click(function(){
                        $("#dropFormPray, #dropBack").fadeIn("slow");
                });
				
				$(".dropLinkFeedBack").click(function(){
                        $("#dropFormFeedBack, #dropBack").fadeIn("slow");
                });
				
				$(".dropLinkAnnounce").click(function(){
                        $("#dropFormAnnounce, #dropBack").fadeIn("slow");
                });
				
				$(".dropLinkcom").click(function(){
                        $("#dropForm_com, #dropBack").fadeIn("slow");
                });
				
				$(".dropLinkimg").click(function(){
                        $("#dropimg, #dropBack").fadeIn("slow");
                });
				
				$("#dropClose, #dropClose2, #dropClose3, #dropClosePray, #dropCloseFeedBack, #dropClosecom, #dropCloseimg, #dropBack").click(function(){
                        $("#dropForm, #dropForm2, #dropForm3, #dropFormPray, #dropFormFeedBack, #dropForm_com, #dropimg, #dropBack").fadeOut("slow");
                });
				
				$("#dropCloseAnnounce, #dropBackAnnounce").click(function(){
                        $("#dropFormAnnounce, #dropBackAnnounce").fadeOut("slow");
                });
				
				$("#dropForm, #dropForm2, #dropForm3, #dropFormPray, #dropFormFeedBack, #dropFormAnnounce, #dropForm_com, #dropimg").center();
				
				$(".Feedback").feedback();
				$(window).resize(function(){
						$("#dropForm, #dropForm2, #dropForm3, #dropFormPray, #dropFormFeedBack, #dropFormAnnounce, #dropForm_com, #dropimg").center();
					});
				
            });



// Rollover Script________________________________________________________________________________________________
if(document.images)
		{
		  var image_array = new Array();
			
		  // path to the directory with images
		  var path = 'images/';
		
		  // enumeration of the "active" images
		  image_array[0] = path + "feed_out.png";
		
		  var preload_image = new Array ();
		 
		  for(var i=0; i<image_array.length; i++)
		  {
			preload_image[i]= new Image();
			preload_image[i].src = image_array[i];
		  }
		}
		
		
function rollover(name, filename)
{
  var fullpath = 'images/' + filename;
  document.images[name].src = fullpath;
}


// Rotator Script________________________________________________________________________________________________
$(document).ready(function() {
//Show the paging and activate its first link
$(".paging").show();
$(".paging a:first").addClass("active");

//Get size of the image, how many images there are, then determin the size of the image reel.
var imageWidth = $(".window").width();
var imageSum = $(".image_reel img").size();
var imageReelWidth = imageWidth * imageSum;

//Adjust the image reel to its new size
$(".image_reel").css({'width' : imageReelWidth});

//Paging  and Slider Function
rotate = function(){
    var triggerID = $active.attr("rel") - 1; //Get number of times to slide
    var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

    $(".paging a").removeClass('active'); //Remove all active class
    $active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)

    //Slider Animation
    $(".image_reel").animate({
        left: -image_reelPosition
    }, 500 );

}; 

//Rotation  and Timing Event
rotateSwitch = function(){
    play = setInterval(function(){ //Set timer - this will repeat itself every 7 seconds
        $active = $('.paging a.active').next(); //Move to the next paging
        if ( $active.length === 0) { //If paging reaches the end...
            $active = $('.paging a:first'); //go back to first
        }
        rotate(); //Trigger the paging and slider function
    }, 5000); //Timer speed in milliseconds (7 seconds)
};

rotateSwitch(); //Run function on launch
});


// Verify Script________________________________________________________________________________________________
var fb_lastup="";
var verifylist=new Array();

function formverify()
{
   if(fb_lastup && fb_lastup!=null && fb_lastup!="")
   {
      alert("File upload in progress.  Please wait till your file upload has finished to submit this form.");
      return false;
   }
   m=document.fform;
   

   e=m.elements;
   for(i=0;i<e.length;i++){
      t=e[i].type;
      if(t=="hidden")
       continue;
      n=e[i].name;
      n=n.substring(5);

      if(t=="text" || t=="textarea"){
         for(j=0;j<verifylist.length;j++){
           if(n==verifylist[j]){
             l=e[i].value;
             re=new RegExp(" +");
             if(l.length==0 || l.replace(re,"").length==0){
              alert("Please ensure all fields are entered correctly.");
              return false;
              }
             }

           }
      }
   }
   return true;
}


// Search Script________________________________________________________________________________________________
(function() { var f = document.getElementById('cse-search-box'); if (!f) { f = document.getElementById('searchbox_demo'); } if (f && f.q) { var q = f.q; var n = navigator; var l = location; if (n.platform == 'Win32') { q.style.cssText = 'border: 1px solid #7e9db9; padding: 2px;'; } var b = function() { if (q.value == '') { q.style.background = '#FFFFFF left no-repeat'; } }; var f = function() { q.style.background = '#ffffff'; }; q.onfocus = f; q.onblur = b; if (!/[&?]q=[^&]/.test(l.search)) { b(); } } })();


// Results Script________________________________________________________________________________________________
(function(){var e=null,b=window,o=b.googleSearchResizeIframe||b.googleSearchPath&&b.googleSearchPath=="/cse"&&typeof b.googleSearchResizeIframe=="undefined",l,k,h;function p(a,c,d,i){var f={};a=a.split(d);for(d=0;d<a.length;d++){var g=a[d],j=g.indexOf(c);if(j>0){var m=g.substring(0,j);m=i?m.toUpperCase():m.toLowerCase();g=g.substring(j+1,g.length);f[m]=g}}return f}function r(){var a=document.location.search;if(a.length<1)return"";a=a.substring(1,a.length);a=p(a,"=","&",false);if(b.googleSearchQueryString!=
"q"&&a[b.googleSearchQueryString]){a.q=a[b.googleSearchQueryString];delete a[b.googleSearchQueryString]}if(a.cof){var c=p(decodeURIComponent(a.cof),":",";",true);if(c=c.FORID)l=parseInt(c,10)}if(c=document.getElementById(b.googleSearchFormName)){if(c.q&&a.q&&(!a.ie||a.ie.toLowerCase()=="utf-8"))c.q.value=decodeURIComponent(a.q.replace(/\+/g," "));if(c.sitesearch)for(var d=0;d<c.sitesearch.length;d++)c.sitesearch[d].checked=a.sitesearch==e&&c.sitesearch[d].value==""?true:c.sitesearch[d].value==a.sitesearch?
true:false}c="";for(var i in a)c+="&"+i+"="+a[i];return c.substring(1,c.length)}function n(a,c){return c?"&"+a+"="+encodeURIComponent(c):""}function q(a,c){return a?Math.max(a,c):c}function s(){var a="http://";a+=b.googleSearchDomain?b.googleSearchDomain:"www.google.com";a+=b.googleSearchPath?b.googleSearchPath:"/custom";a+="?";if(b.googleSearchQueryString)b.googleSearchQueryString=b.googleSearchQueryString.toLowerCase();a+=r();a+=n("ad","w"+k);a+=n("num",h);a+=n("adtest",b.googleAdtest);if(o){var c=
b.location.href,d=c.indexOf("#");if(d!=-1)c=c.substring(0,d);a+=n("rurl",c)}return a}function t(){(k=b.googleSearchNumAds)||(k=9);h=(h=b.googleNumSearchResults)?Math.min(h,20):10;var a={};a[9]=780;a[10]=780;a[11]=500;var c={};c[9]=300+90*h;c[10]=300+50*Math.min(k,4)+90*h;c[11]=300+50*k+90*h;var d=s();if(!b.googleSearchFrameborder)b.googleSearchFrameborder="0";var i=document.getElementById(b.googleSearchIframeName);if(i&&a[l]){a=q(b.googleSearchFrameWidth,a[l]);c=q(b.googleSearchFrameHeight,c[l]);
var f=document.createElement("iframe");d={name:"googleSearchFrame",src:d,frameBorder:b.googleSearchFrameborder,width:a,height:c,marginWidth:"0",marginHeight:"0",hspace:"0",vspace:"0",allowTransparency:"true",scrolling:"no"};for(var g in d)f.setAttribute(g,d[g]);i.appendChild(f);f.attachEvent?f.attachEvent("onload",function(){window.scrollTo(0,0)}):f.addEventListener("load",function(){window.scrollTo(0,0)},false);o&&b.setInterval(function(){if(b.location.hash&&b.location.hash!="#"){var j=b.location.hash.substring(1)+
"px";if(f.height!=j&&j!="0px")f.height=j}},10)}b.googleSearchIframeName=e;b.googleSearchFormName=e;b.googleSearchResizeIframe=e;b.googleSearchQueryString=e;b.googleSearchDomain=e;b.googleSearchPath=e;b.googleSearchFrameborder=e;b.googleSearchFrameWidth=e;b.googleSearchFrameHeight=e;b.googleSearchNumAds=e;b.googleNumSearchResults=e;b.googleAdtest=e}t()})();



