$(document).ready(function() {  
     $('input[type="text"]').addClass("idleField");  
     $('input[type="text"]').focus(function() {  
         $(this).removeClass("idleField").addClass("focusField");  
         if (this.value == this.defaultValue){  
             this.value = '';  
         }  
         if(this.value != this.defaultValue){  
             this.select();  
         }  
     });  
     $('input[type="text"]').blur(function() {  
         $(this).removeClass("focusField").addClass("idleField");  
         if ($.trim(this.value) == ''){  
             this.value = (this.defaultValue ? this.defaultValue : '');  
         }
	});
}); 
$(function() { 
$("#accordion").tabs("#accordion div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
$("#accordion-sub").tabs("#accordion-sub div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
$("#accordion-video").tabs("#accordion-video div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
$("#accordion-frames").tabs("#accordion-frames div.pane", {tabs: 'h2', effect: 'slide', initialIndex: null});
$("img[rel]").overlay({expose: '#000', effect: 'apple'});
});
$(function(){
		$('input').click(function(){
			var ourText = $('p');
			var currFontSize = ourText.css('fontSize');
			var finalNum = parseFloat(currFontSize, 10);
			var stringEnding = currFontSize.slice(-2);
			if(this.id == 'large') {
				finalNum *= 1.2;
				if (finalNum >= 20) {finalNum = 18;}
			}
			else if (this.id == 'small'){
				finalNum /=1.2;
				if (finalNum <= 9) {finalNum = 10;}
			}
			ourText.css('fontSize', finalNum + stringEnding);
		});
	});
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function openWindow(address){
	var openWindow = window.open(address,"","fullscreen=no,toolbar=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,directories=no,location=yes,width=800,height=600,left=10,top=20")
openWindow.focus();
}
function openccWindow(address){
	var openccWindow = window.open(address,"","fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=yes,width=800,height=600,left=10,top=20")
openWindow.focus();
}
$(document).ready(function() {
	$("img[rel]").overlay({expose: '#000', effect: 'apple'});
});
$(document).ready(function() {

			//Set css in Firefox (Required to use the backgroundPosition js)
			$('#shutter1').css({backgroundPosition: '0px 0px'});
			$('#shutter2').css({backgroundPosition: '0px 0px'});
			$('#shutter3').css({backgroundPosition: '0px 0px'});

			//Animate the shutter  
			$(".link").hover(function(){
			      $(this).parent().stop().animate({backgroundPosition: '(0px -150px)'}, 500 );
			    }, function() {
			      $(this).parent().stop().animate({backgroundPosition: '(0px 0px)'}, 500 );
			}); 
		 });
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];           
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];
            
           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);
function init(){
	$(document).ready( function(){
		$('#locations').innerfade({
				animationtype: 'fade', 
				speed: 'slow',
				timeout: 4000,
				type: 'sequence',
				containerheight: '0px'
			});
		
		$("#overlay").fadeIn(2000).fadeTo(5000, 1).fadeOut(2000);
	});								
}
function ymca(){
	$(document).ready( function(){
		$('#ymca').innerfade({
				animationtype: 'fade', 
				speed: 'slow',
				timeout: 3000,
				type: 'sequence',
				containerheight: '0px'
			});
		
		$("#overlay").fadeIn(2000).fadeTo(5000, 1).fadeOut(2000);
	});								
}
