function showmenu(elmnt)
{
	document.getElementById(elmnt).style.visibility="visible";
}
function hidemenu(elmnt)
{
	document.getElementById(elmnt).style.visibility="hidden";
}

function loadAllStartingWith(firstL) {
  $("#song-list-box").html('<img src="images/lightbox-ico-loading.gif" border="0" alt="" />').load("songs.php", {'first':firstL}).slideDown() ;
}

$(document).ready(function() {
  $("a[href$='.jpg']").lightBox();
  $("a[href$='.gif']").lightBox();
  $("a[href$='.png']").lightBox();
  
  $("#search_song_button").click( function() {
	  var searchFor = $("#search_song").attr("value");
	  $("#song-list-box").html('<img src="images/lightbox-ico-loading.gif" border="0" alt="" />').load( "songs.php", {'search':searchFor} ) ;
  });
  $("#abc-box").load("songs.php?get_abc=1");
  $("#song-list-box").html('<img src="images/lightbox-ico-loading.gif" border="0" alt="" />').load("songs.php", {'first':'A'} );
	
	if( $("#modal_box").html() )
		$("#modal_box").modal();
  
	$('.bar-container div').each(function(){
		var initWidth = $(this).css('width');
		$(this).css({width: "0%"}).animate({width: initWidth}, 'slow');
	});
    
   $("#search_song").keypress( function (e) {
      var keyCode = e.which ;
		if( keyCode==13 ) {
		  var searchFor = $("#search_song").attr("value");
		  $("#song-list-box").html('<img src="images/lightbox-ico-loading.gif" border="0" alt="" />').load( "songs.php", {'search':searchFor} ) ;
		}
   });
   
	$('#feedback').submit( function() {
		var submitThisForm = 1 ;
		var alertText = $('#alert-text').val(); 
		if( !alertText )
			alertText = 'Fill the form please.';
		var thisFormCookie = $('#cookie-text').attr("name") ;
		$('#feedback .ne-pusto').each( function() {
			if( $(this).val()=='' ) {
				submitThisForm = 0 ;
				alert(alertText);
			}
		} );
		if( thisFormCookie ) {
			var checkCookie = $.cookie( thisFormCookie );
			var alreadySentText = $('#cookie-text').val();
			if( checkCookie=='sent' ) {
				submitThisForm = 0 ;
				alert(alreadySentText);
			}
		}
		if( submitThisForm == 0 )
			{ return false; }
		$('#feedback input:checked').remove();
		$('#feedback input:radio').parent().remove();
		$('#feedback input:checkbox').parent().remove();
		$('#feedback input:text').each( function() {
			var inputText = $(this).val();
			$(this).replaceWith(inputText);
		});
		$('#feedback textarea').each( function() {
			var inputText = $(this).text();
			$(this).replaceWith(inputText);
		});
		$('#feedback select').each( function() {
			var inputText = $(this).find('option:selected').val();
			$(this).replaceWith(inputText);
		});
		$('#feedback input').remove();
		var formHtml = $('#feedback').html();
		$('#feedback').html('<img src="images/lightbox-ico-loading.gif" border="0" alt="" />');
		$.post (
			"submit.php" , 
			{ 'feedback' : formHtml } ,
			function(data) {
				$('#feedback').html(data);
				if( thisFormCookie ) {
					$.cookie( thisFormCookie, 'sent' );
				}
			}
		); 
		return false; 
	});
}); 
























































