/** Associates Accordian */

$(document).ready(function(){
						   
	/* HIDE ALL TO BEGIN */					   	
	$(".associates li div.profile").hide();
	
	/* IF ACCORDION CLICKED */
	$(".associates li div.name").click(function(){
		$(".associates li div.profile:visible").slideUp("slow");
		$(this).next(":not(:visible)").slideDown("slow");
		return false;
	});
	
	/* IF PAGE LOADED WITH HASH */
	if (window.location.hash) {
		var $theAnchor = window.location.hash;
		var $theOpenItem = '.associates li' + $theAnchor + ' div.profile';
		$($theOpenItem).show();
		var $newLocation = $theAnchor;	
		location.href = $newLocation;
	}
	
	/* IF MENU ITEM CLICKED */
	$("ul li.page-item-111 ul li a").click(function(){
		var $theAnchor = this.hash;
		$(".associates li div.profile:visible").hide();
		var $theOpenItem = '.associates li' + $theAnchor + ' div.profile';
		$($theOpenItem).slideDown("slow");
		var $newLocation = $theAnchor;	
		location.href = $newLocation;
	});

});

/*

$(document).ready( function(){
if (window.location.hash) {
		var $theAnchor = window.location.hash;
		//alert ($theAnchor);
		var associateProfiles = $('.associates li div.profile');
		associateProfiles.hide();
		var $theOpenItem = '.associates li' + $theAnchor + ' div.profile';
		$($theOpenItem).show();
		$('.associates li div.name').click(function () {
		var $newLocation = '#' + $(this).parent().attr("id");	
		location.href = $newLocation;
		//associateProfiles.hide();
		$(this).next().toggle('slow');
		return false;
		}).associateProfiles.hide()

} else {
		var associateProfiles = $('.associates li div.profile');
		associateProfiles.hide();
		$('.associates li div.name').click(function () {
		var $newLocation = '#' + $(this).parent().attr("id");	
		location.href = $newLocation;
		//associateProfiles.hide();
		$(this).next().toggle();
		return false;
		}).associateProfiles.hide();

} 	
});

*/


		//var tabFirstName = $('#guideMenu ul li > a');
		//tabFirstLink.filter(':first').addClass('onState');
		//$('.associates li div.name').click(function () {
			//tabContainers.hide();
			//tabContainers.filter(this.hash).show();
			//tabFirstLink.filter(':first').removeClass('onState');
			//$('div.rolloverGuide #guideMenu ul li a').removeClass('onState');
			//$(this).addClass('onState');
			//return false;
			
		/* WORKS
		var associateProfiles = $('.associates li div.profile');
		associateProfiles.hide();
		$('.associates li div.name').click(function () {
		var $newLocation = '#' + $(this).parent().attr("id");	
		location.href = $newLocation;
		associateProfiles.hide();
		$(this).next().toggle();
		return false;
		});
		*/
			

	

/** AutoClear for Search Form */
$(document).ready( function(){
	autoFill($("#name"), "Your name");
});

function autoFill(id, v){
	$(id).css({ }).attr({ value: v }).focus(function(){
		if($(this).val()==v){
			$(this).val("").css({ });
		}
	}).blur(function(){
		if($(this).val()==""){
			$(this).css({ }).val(v);
		}
	});
	
}

/** Remove elements from DOM */
$(document).ready( function(){
	$('.linklove').remove(); /* cforms link */
	$('.remove').remove(); /* cforms link */
});

/** Form highlighting */
$(document).ready(function(){
	$("form input").focus(function() {
		$(this).parent().addClass("form-focus");
	});
	$("form input").blur(function() {
		$(this).parent().removeClass("form-focus")
	});
	$("form textarea").focus(function() {
		$(this).parent().addClass("form-focus");
	});
	$("form textarea").blur(function() {
		$(this).parent().removeClass("form-focus")
	});
	$("form select").focus(function() {
		$(this).parent().addClass("form-focus");
	});
	$("form select").blur(function() {
		$(this).parent().removeClass("form-focus")
	});
});