//drop menu
function dropMenu(){
	$("#nav > ul > li:has(ul)").hover(function(){
		$(">ul",this).show();		
	},function(){
		$(">ul",this).hide();
	});
}
(function($){
	$.fn.resetField = function(o){
		o=$.extend({defTxt:"keywords",delColor:"#666",txtColor:"#666"},o);
		this.val(o.defTxt).css("color",o.delColor);
		this.focus(function(){
			if($(this).val() == o.defTxt){$(this).val("").css("color",o.txtColor)};
		});
		this.blur(function(){
			if($(this).val()==""){$(this).val(o.defTxt).css("color",o.delColor)};
			if($(this).val()!= o.defTxt){$(this).css("color",o.txtColor);}
		});
	}
})(jQuery);

//run
$(document).ready(function(){

	Cufon.replace("#nav li a,h2,#respond h3",{hover:true});
	dropMenu();
	$("#search input").resetField({defTxt:"Search"});
	var body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
	$(".staff-menu li").click(function(){
		var target=$(this).attr("class");
		$(".staff-menu a").removeClass("selected");
		$(">a",this).addClass("selected");
		//$(".staff-view").hide();
		//$("#"+target).show();
		body.animate({scrollTop: $('#'+target).offset().top}, 1000);
		return false;
	});
});

//fancybox and jonathan being messy
$(document).ready(function() {
		
	$("a.iframe-link").fancybox({});
	
	$("a.location").fancybox({
		'type'	:	'iframe',
		'height' : '100%',
		'width' : '100%'
	});

	$("a#loginn").fancybox({
		'type'	:	'inline',
		'overlayShow' : false,
		'transitionIn' : 'none',
		'transitionOut' : 'none',
		'autoDimensions' : false,
		'width' : 300,
		'height' : 230,
		'scrolling' : 'no'
	});
	
	$('.getdirections a').each(function(){
		if ( $(this).attr('a') == null ) { 
			$(this).remove();
		}
	});
	
	//breakly
	$('.file a').breakly('3');
	
// ??

$(".copyinput").click(function()
  {

	//var id = $(this).attr("name");
	//$("#"+ id).append("Please Hold CTRL+C to Copy this URL");
  	selectAllText($(this))
	
  });
  
});
	function selectAllText(textbox) {
    textbox.focus();
    textbox.select();
}

// cycle
$(document).ready(function() {
    $('.cycle').cycle({
		fx: 'fade',
		timeout: 8000
	});
});
