//menu.js

$().ajaxStart(function(){ $('form').block(); $('#search').unblock(); }).ajaxStop(function(){ $('form').unblock(); $('#search').unblock(); });

$(document).ready(function(){
	//$("#body").corner("5px");
	
	if(trim($("#squery").val()) == "") { 
	$("#squery").val($("#squery").attr("title"));
	$("#squery").css({color:"#444"});
	}

	$("#squery").focus(function(){
		if(trim($(this).val()) == $(this).attr("title")) {
		$(this).val("");
		}
		$(this).css({color:"#fff"});
	});
	
	$("#squery").blur(function(){
		if(trim($(this).val()) == "") { 
		$(this).val($(this).attr("title"));
		$(this).css({color:"#444"});
		}
	});

	$(".messagelink").click(function(){
		var ruid = $(this).attr("rel");
		
		$(".modal").html('<img src="'+siteroot+'images/aload.gif" border="none" />');
		
		$.get(siteroot+"inc/message.php",{ruid: ruid, name:$(this).attr("name"), author:$(this).attr("rev")}, 
		  function(msg) { $(".modal").html(msg);  });
		showmodal(480,420);
		
	 return false;
	});
	

	
	$("#quickblurb_link").click(function(){
		var top = ($(this).position().top -10);
		var left = ($(this).position().left + $(this).width() - 5);
		$("#quickblurb").css({			position:		'absolute',
										left: 			left + 'px',
										top: 			top + 'px',
										width:			"320px"
										});
		$("#quickblurb").show();
		$("#body").fadeTo("fast",.8);
		document.getElementById("txt_qblurb").focus();
	 return false;
	});
	
	$("#can_qb").click(function(){
	$("#quickblurb").fadeOut();
	$("#body").fadeTo("fast",1.0);	
	});
	
	$("form#qblurb").submit(function(){
	var formid = $(this).attr("id");	
	var o = $("#"+formid).parent("div");
 	$.post(siteroot+"act/update.user.php?req=newblurb",{  
	   entry: $("#"+formid+" > textarea").val()
		 }, function(msg) {
			
			if(trim(msg) == "yes") {
			o.text($("#"+formid+" > textarea").val());
			o.fadeTo("slow", .8,function() {$("#quickblurb").fadeOut("slow");});
			} else {
			$("#"+formid).parent("div").fadeTo("slow", .8,function() {$("#quickblurb").fadeOut("slow");});
			}
			$("#body").fadeTo("fast",1.0);	
			
	 });
	
	 return false;
	});
	
	$("#squery").autocomplete(
	siteroot+"act/find.suggest.php", 
	{ minChars:3,
	cacheLength:10,
	onItemSelect:selectSquery
	});

	function selectSquery(li) {
	if( li == null ) { return alert("No match!"); }
	
		if( !!li.extra) { 
		var sValue = li.extra[0]; 
		window.location = siteroot+"profile/"+sValue;
		}
	
	}


	$("#msgbox").click(function(){
			$("#msgbox").fadeOut();				
	});
	
		
	$(".quicktime").click(function(){
	var src = $(this).attr("rel");
	var addqt = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="24" width="320"><param name="src" value="'+src+'"><param name="autoplay" value="true"><param name="type" value="audio/quicktime" height="24" width="320"><embed src="'+src+'" height="24" width="320" autoplay="true" type="audio/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></object>';
	$(this).html(addqt);
	jQuery.blockUI({ message: "be patient while the file loads..." }); 
	setTimeout(jQuery.unblockUI, 1000); 
	return false;
	});
				
	$(".musicpop").click(function () {
	var id = $(this).attr("rel");
	var show = $(this).attr("name");
	var x = $(this).attr("rev");
	var url = siteroot+"popout.music.php?id="+id+"&show="+show+"&x="+x;
	window.open(url,"musicpopout","location=0,menubar=0,scrollbars=0,toolbar=0,status=0,width=410,height=360,resizable=0");
	$(this).hide()
	
	return false;							
	});
		
 });

