jQuery.noConflict();

jQuery(function() {
		
	/* PRETTY PHOTO */
	if(jQuery(".btn-viewmap").length>0) {
		jQuery(".btn-viewmap[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
	}
	
	if(jQuery(".wailea-gallery").length>0) {
		jQuery(".wailea-gallery ul li a[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
	}
	
	if(jQuery(".btn-course-layout").length>0) {
		jQuery("a.btn-course-layout[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
	}

	if(jQuery(".calendar").length>0) {
		jQuery("a.calendar[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
	}
	
	if(jQuery(".gc2").length>0) {
		jQuery("a.gc2[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
	}

	if(jQuery("a.gc-architect").length>0) {
		jQuery("a.gc-architect[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
	}	
	
	if(jQuery("a.btn_location").length>0) {
		jQuery("a.btn_location[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
	}	
	
	if(jQuery("#terms_link").length>0) {
		jQuery("#terms_link").prettyPhoto({theme: 'facebook'});
	}	
	
	if(jQuery("a.dl_image").length>0) {
		jQuery("a.dl_image[rel^='prettyPhoto']").prettyPhoto({theme: 'facebook'});
	}
		
	/* MAIN NAV */
	if(jQuery(".download li").length>0) {
		jQuery(".download li a span.hover").hide();
		jQuery(".download li").hover(
  			function () {
				jQuery(this).children('a').children('span.hover').fadeIn(200);
			}, 
			function () {
				jQuery(".download li a span.hover").hide();
			}
		);
	}
	
	if(jQuery(".scoreTable").length>0) {
		jQuery(".scoreTable tr").hover(
  			function () {
				jQuery(this).addClass('hover');
			}, 
			function () {
				jQuery(this).removeClass('hover');
			}
		);
	}
	
	if(jQuery("table").length>0) {
		jQuery("table tr").hover(
  			function () {
				jQuery(this).addClass('hover');
			}, 
			function () {
				jQuery(this).removeClass('hover');
			}
		);
	}
	
	/* SPECIALS */
	if(jQuery(".specials li").length>0) {
	
		jQuery(".specials li .spec-desc").hide();
		jQuery(".specials li .btn-more-details").click(function() {
			jQuery(this).parent('li').children('.spec-desc').toggle('fast');
			return false;
		});
	}
	
	/* DOWNLOAD */
	if(jQuery(".main-nav-left").length>0) {	
		jQuery(".main-nav-left > li").hover(
  			function () {
				jQuery(this).addClass('hover');
				jQuery(this).children('a').addClass('active2');
			}, 
			function () {
				jQuery(this).removeClass('hover');
				jQuery(this).children('a').removeClass('active2');
			}
		);
	}
		
	/* CLOCK */
	var options = {
        timeNotation: '12h',
        am_pm: true,
        fontFamily: '"Tahoma", Arial, Helvetica, sans-serif',
        fontSize: '13px',
        foreground: 'white',
        utc: true,
		utc_offset: -10
    };
	jQuery('.jclock').jclock(options);
				
	/* newsticker */
	/*
	jQuery(".newsticker-jcarousellite").jCarouselLite({
		vertical: true,
		hoverPause:true,
		visible: 2,
		auto:8000,
		speed:1000
	});
	*/
	
	/* INPUT FIELDS */
	if(jQuery(".newsletter input:text").length>0){
		jQuery(".newsletter input:text").attr("value", "Your email here");
		jQuery(".newsletter input:text").focus(function() {
			if(jQuery(".newsletter input:text").attr("value")=="Your email here"){
  				jQuery(".newsletter input:text").attr("value", "");
			}
		});
		jQuery(".newsletter input:text").blur(function() {
			if(jQuery(".newsletter input:text").attr("value")==""){
	  			jQuery(".newsletter input:text").attr("value", "Your email here");
			}
		});
	}
	
	/* INPUT FIELDS */
	if(jQuery(".search-div input:text").length>0){
		jQuery(".search-div input:text").attr("value", "Search");
		jQuery(".search-div input:text").focus(function() {
			if(jQuery(".search-div input:text").attr("value")=="Search"){
  				jQuery(".search-div input:text").attr("value", "");
			}
		});
		jQuery(".search-div input:text").blur(function() {
			if(jQuery(".search-div input:text").attr("value")==""){
	  			jQuery(".search-div input:text").attr("value", "Search");
			}
		});
	}
	
	/* TABBER 
	if(jQuery(".tabber").length>0) {
		var visibleTab = 0;
		jQuery(".tabber .tabber-content").hide();
		jQuery(".tabber .tabber-content").eq(visibleTab).show();
		jQuery(".tabber-nav li").eq(visibleTab).addClass('active');
		
		jQuery('.tabber-nav li a').click(function() {
			var clickedTab = jQuery(this).parents('li').index();
			if(!jQuery(this).parents('li').hasClass('active')){
				jQuery(".tabber-nav li").removeClass('active');
				jQuery(".tabber-nav li").eq(clickedTab).addClass('active');
				
				jQuery(".tabber .tabber-content").hide();
				jQuery(".tabber .tabber-content").eq(clickedTab).show();
			}
			return false;
		}); 
	}
	*/
	/* CAROUSEL */
	if(jQuery(".lnd-carousel").length>0) {
		jQuery('.lnd-carousel ul').roundabout({
			'easing': 'easeOutExpo',
			'duration': 800,
			'btnNext': '.btn-next',
			'btnPrev': '.btn-prev',
			'shape': 'lazySusan',
			'maxOpacity': 1,
			'minOpacity': 1,
			'minScale':0.74,
			'maxScale':1,
			'clickToFocus': false
		});
		
		jQuery(window).resize(function() {
			jQuery('.lnd-carousel ul').roundabout_animateToBearing(jQuery.roundabout_getBearing(jQuery('.lnd-carousel ul')));
		});
	}
	
	/* LANDING IMAGE ROTATOR */
	if(jQuery(".landing .bg-container").length>0) {
	   if(!jQuery.browser.flash) {  
            var bg_images = jQuery(".landing .bg-container img").length;
            var delay = 8000;
            var current = bg_images-1;
            
            if(bg_images != 0 || bg_images != 1){
                jQuery(".bg-container").oneTime(delay, "updateBg", function() { 
                    updateBG(current, delay);		
                });
            }
            
            function updateBG(current, delay){
                jQuery(".bg-container").stopTime('updateBg');
                if(current > 0){
                    jQuery(".landing .bg-container img:eq("+current+")").fadeOut(1200);
                    current--;
                } else {
                    jQuery(".landing .bg-container img:eq("+(bg_images-1)+")").fadeIn(1200, function() {
                        jQuery(".landing .bg-container img").show();
                    });
                    current=(bg_images-1);
                }
                jQuery(".bg-container").oneTime(delay, "updateBg", function() { 
                    updateBG(current, delay);		
                });
            } 
		} else { 
                var flashvars = {};
                var params = {};
                params.play = "true";
                params.loop = "true";
                params.menu = "false";
                params.quality = "high";
                params.scale = "noscale";
                params.salign = "tl";
                params.wmode = "transparent";
                params.bgcolor = "#000000";
                params.devicefont = "false";
                params.allowfullscreen = "false";
                params.allowscriptaccess = "sameDomain";
                var attributes = {};
                attributes.id = "landingAnimation";
                attributes.name = "landingAnimation";
                attributes.styleclass = "landingAnimation";
                attributes.align = "middle";
                swfobject.embedSWF("http://www.waileaoldblue.com/preview.swf", "bgContainer", "100%", "100%", "8.0.0", "expressInstall.swf", flashvars, params, attributes);	
		}
	}


					
	/* jQuery FLASH 
    $('#widget').flash(
        { 
          src: 'http://www.waileaoldblue.com/widget.swf',
          width: 120,
          height: 31,
          flashvars: { xml_path: 'http://www.waileaoldblue.com/index.php?file=get_weather.php' }
        },
        { version: 8 }
    );*/
	if (jQuery('#event-date').length > 0)
		jQuery('#event-date').datepicker();
	
});		   
