Cufon.replace('#closeheadbutt, #homeLink, #submenu .title, #submenu a, #menu_top>ul>li, #menu_main>ul>li>a, #footer-menu>ul>li>a, .event h2 a, p.button a, a.button',{hover: true});	
Cufon.replace('h1, h2, h3, h4, .eventMonthSec, .event .daterange, #menu_top_content .title');
	
$(document).ready(function(){
	
	$(".placeholderField").focus(function(){
    	if($(this).val()==$(this).attr('title')){
        	$(this).val('');
        }
    });
    $(".placeholderField").blur(function(){
    	if($(this).val()==''){
       		$(this).val($(this).attr('title'));
       	}
    });
    $(".placeholderField").blur();
	
	/*********************************************************************************************/
	/*External links to _blank target (allows valid XHTML strict whilst opening external windows)*/
	/*********************************************************************************************/
	$('a[rel="external"]').click(function(){
		this.target = "_blank";
	});
	
	/******************/
	/* Top Slide Menu */
	/******************/
	$('#menu_top,#closeheadbutt').click(function(){
		if($('#menu_top_content').is(':visible')===false){
			$('#redBar').show();
		}
		$('#menu_top_content').slideToggle(250,function(){
			if($('#menu_top_content').is(':visible')===false){
				$('#redBar').hide();
			}
		});
	});
	/********************************/
	/* Head contact form validation */
	/********************************/
	$("#headContactForm").validate({
		rules: {
			name:{
				required:true
			},				
			text:{
				required:true
			},
			email:{
				required:true,
				email:true
			}
		}
	});
	
	/**************/
	/* Slideshows */
	/**************/
	$("#slideshow .slidetabs").tabs("#slideshow .images>div",{
		effect: 'fade',
		fadeOutSpeed:2000,
		rotate: true
	}).slideshow({autoplay:true,interval:8000});
	
	$("#event_slideshow .slidetabs").tabs("#event_slideshow .images>div",{
		effect: 'fade',
		fadeOutSpeed:2000,
		rotate: true
	}).slideshow({autoplay:true,interval:8000});
	
	$("#sponsors .slidetabs").tabs("#sponsors .images>div",{
		effect: 'fade',
		fadeOutSpeed:1000,
		rotate: true
	}).slideshow({autoplay:true,interval:3000});
	
	/**********************/
	/*INIT GALLERY COLORBOX/
	/**********************/
	$('a[rel="gallerySlideshow"]').colorbox({slideshow:true,slideshowSpeed:6000,slideshowAuto:false});
	
	/*******************/
	/*START SCROLLABLES*/
	/*******************/
	$(".scrollable").scrollable({circular:true,speed:200}).autoscroll({ autoplay:true,interval:6000 });
	
	/**************/
	/*HOME MARQUEE*/
	/**************/
	$('#reminder').SetScroller({	velocity:500,
											direction: 	 'horizontal',
											startfrom: 	 'right',
											loop:		 'infinite',
											movetype: 	 'linear',
											onmouseover: 'play',
											onmouseout:  'play',
											onstartup: 	 'play',
											cursor:'arrow'
										});
										
	var contentLoginError = $("#content .loginMessage");
	//if login message found in content then we are already on the main login page. if not, throw dialog and redirect on close.
	if(contentLoginError.length==0){	
		var errorElToCheck = $("#menu_top_content .loginMessage");
		if(errorElToCheck.html()!=''){

			errorElToCheck.dialog({
				title: 'Member Login',
				modal: true,
				beforeClose: function(event, ui){
					window.location.href='/31';
				}
			});

		}
	}
	
});

