function contact() {
	var contactData = $('#contactForm').serialize();
	if(contactData == '')	{ return false; }
	$.ajax({
	   type: "POST",
	   url: HOMEPAGE + "/ajax/contact/",
	   data: contactData,
	   success: function(msg){
	   		$('#contact').html(msg);
	   }
	 });
}

function hideInfo()	{ 
	if($('#infoWrapper').html() != null) {
		$('#infoWrapper').css('display', 'none'); 
	}
}	

function searchClose() {
	$('#q').val('');
	if ($('#search_results').html() != null) {	$('#search_results').remove(); }
	$('#searchClose').css('display', 'none');
}

function search() {
	var q = $('#q').val();
	if (q == '')								{ return false; }
	$('#searchClose').css('display', 'inline');
	if ($('#search_results').html() != null) 	{ $('#search_results').remove(); }
	var output = '<div id="search_results"><span id="searching"><img src="/resources/images/layout/ajax-loader.gif" alt="loading..." /> loading</span></div>';
	$(output).insertAfter('#searchform');
	
	$.ajax({ 
		type: "GET",
		url:  HOMEPAGE + '/ajax/search/',
		data: 'q=' + q,
		success: function(msg) {
			$(output).insertAfter('#searchform');
			$("#search_results").html(msg);
			$('#searching').remove();
		}
	});
}

jQuery.playlist = {
	
	toggleMore: function()
	{
		$('.moreless').text(($('.moreless').hasClass('more') ? 'more' : 'less'));
		$('#playlist ul.hidden').slideToggle(750);
		$('.moreless').toggleClass('more');
	}
}

$(document).ready(function() {
	$("a[rel^='prettyPhoto']").prettyPhoto();
	$('#searchform').bind('submit', function() { search(); });
	hideInfo();
});
                                                                     