
var alphabet = new Array();
alphabet[' '] = 0;
alphabet['a'] = 1;
alphabet['ą'] = 2;
alphabet['b'] = 3;
alphabet['c'] = 4;
alphabet['ć'] = 5;
alphabet['d'] = 6;
alphabet['e'] = 7;
alphabet['ę'] = 8;
alphabet['f'] = 9;
alphabet['g'] = 10;
alphabet['h'] = 11;
alphabet['i'] = 12;
alphabet['j'] = 13;
alphabet['k'] = 14;
alphabet['l'] = 15;
alphabet['ł'] = 16;
alphabet['m'] = 17;
alphabet['n'] = 18;
alphabet['ń'] = 19;
alphabet['o'] = 20;
alphabet['ó'] = 21;
alphabet['p'] = 22;
alphabet['q'] = 23;
alphabet['r'] = 24;
alphabet['s'] = 25;
alphabet['ś'] = 26;
alphabet['t'] = 27;
alphabet['u'] = 28;
alphabet['v'] = 29;
alphabet['w'] = 30;
alphabet['x'] = 31;
alphabet['y'] = 32;
alphabet['z'] = 33;
alphabet['ż'] = 34;
alphabet['ź'] = 35;

var polishLetters = new Array('ą','ć','ę','ł','ń','ó','ś','ź','ż');

$(document).ready(function()
{
	loadMenuImages();
	for (var i=1; i<1; i++)
	{//alert(i);
		/*
		$("#option"+i).click(function ()				    
	    {alert(i); //var x = "#li-option"+i+" ul"; alert(x);
	      if ($("#li-option"+i+" ul").is(":hidden")) 
	      {
	        $("#li-option"+i+" ul").show("slow");
	      } 
	      else 
	      {
	        $("#li-option"+i+" ul").slideUp();
	      }
	    });*/
		/*
		for (var j=1; j<5; j++)
		{
			$("#option"+i+"_"+j).click(function ()				    
		    {
		      if ($("#li-option"+i+"_"+j+" ul").is(":hidden")) {
		        $("#li-option"+i+"_"+j+" ul").show("slow");
		      } else {
		        $("#li-option"+i+"_"+j+" ul").slideUp();
		      }
		    });
		}*/
	}
 /*
		$("#option1").click(function ()				    
	    {
	      if ($("#li-option1 ul").is(":hidden")) {
	        $("#li-option1 ul").show("slow");
	      } else {
	        $("#li-option1 ul").slideUp();
	      }
	    });
	  

		$("#option2").click(function ()				    
	    {
	      if ($("#li-option2 ul").is(":hidden")) {
	        $("#li-option2 ul").show("slow");
	      } else {
	        $("#li-option2 ul").slideUp();
	      }
	    });
		$("#option2_1").click(function ()				    
	    {
	      if ($("#li-option2_1 ul").is(":hidden")) {
	        $("#li-option2_1 ul").show("slow");
	      } else {
	        $("#li-option2_1 ul").slideUp();
	      }
	    });	   


		$("#option3").click(function ()				    
	    {
	      if ($("#li-option3 ul").is(":hidden")) {
	        $("#li-option3 ul").show("slow");
	      } else {
	        $("#li-option3 ul").slideUp();
	      }
	    });
	    
		$("#option4").click(function ()				    
	    {
	      if ($("#li-option4 ul").is(":hidden")) {
	        $("#li-option4 ul").show("slow");
	      } else {
	        $("#li-option4 ul").slideUp();
	      }
	    });	    
	    */	    
/*
	    $("#leftMenuOptions ul li").click(function () 
	    {
	      if ($("#leftMenuOptions ul li ul").is(":hidden")) {
	        $("#leftMenuOptions ul li ul").show("slow");
	      } else {
	        $("#leftMenuOptions ul li ul").slideUp();
	      }
	    });*/

  });


function switchSubmenu(id)
{
	if ($("#option"+id+" > ul").is(":hidden")) 
	{
        $("#option"+id+" > ul").show("slow");
    } 
    else 
    {
        $("#option"+id+" > ul").slideUp();
    }
}


function displaySeasonsMenu()
{

	if ($("#layer1").css("display") == 'none')
	{
		setSeasonsMenuPosition();
	
		$("#layer1").fadeIn(300,function () {
    	    $("#layer2").fadeIn(300);
      	});	
	}
	else
	{
		$("#layer2").fadeOut(300, function () {
    	    $("#layer1").fadeOut(300);
      	});
    }
}

function setSeasonsMenuPosition()
{
	var screenWidth = screen.width;
	var websiteWidth = 980;
	var right = (screenWidth - websiteWidth)/2-3;

	$("#layer1").css("right",right);
	$("#layer2").css("right",right);
}


function toggleClubMenu(id)
{//alert('?');
	var layer = id+'Layer';
	var link  = id+'Link';
	
	$("#resultsLayer").css('display','none');
	$("#resultsLink").attr("class","");
	$("#standingsLayer").css('display','none');
	$("#standingsLink").attr("class","");
	$("#statisticsLayer").css('display','none');
	$("#statisticsLink").attr("class","");

		
	$("#"+layer).fadeIn('slow');
	$("#"+link).attr("class","selected");
	//$("#"+link).css('font-weight','bold');
	//$("#"+link).css('color','black');
}

function loadMenuImages()
{
   image1_on = new Image;
   image1_off = new Image;
   image2_on = new Image;
   image2_off = new Image;
   image3_on = new Image;
   image3_off = new Image;

   image1_on.src  = "/gfx/menu_strona_glowna_over.png";
   image1_off.src = "/gfx/menu_strona_glowna.png";
   image2_on.src  = "/gfx/menu_liga_polska_over.png";
   image2_off.src = "/gfx/menu_liga_polska.png";
   image3_on.src  = "/gfx/menu_reprezentacja_over.png";
   image3_off.src = "/gfx/menu_reprezentacja.png";
}

function showOverlibDescription(elem,text)
{//alert('?');
	$(elem).css('background-color','black');
	overlib('<center>'+text+'</center>', FGCOLOR, '#D50000', BGCOLOR, '#D50000', TEXTCOLOR, '#FFFFFF', STATUS, HEIGHT, 30, WIDTH, 100, 'Dymek zwykły');
	//alert('2');
}

function hideOverlibDescription(elem)
{
	$(elem).css('background-color','');
	nd();
}

function switchCoachesMenu(id)
{
	if (id == 'summaryLink')
	{
		$('#chronologicalTable').fadeOut();
		$('#summaryTable').fadeIn();
		/*$('#chronologicalLink').css('text-decoration','underline');
		$('#chronologicalLink').css('font-weight','normal');
		$('#summaryLink').css('text-decoration','none');
		$('#summaryLink').css('font-weight','bold');*/
	}
	else if (id == 'chronologicalLink')
	{
		$('#chronologicalTable').fadeIn();
		$('#summaryTable').fadeOut();
		/*$('#chronologicalLink').css('text-decoration','none');
		$('#chronologicalLink').css('font-weight','bold');
		$('#summaryLink').css('text-decoration','underline');
		$('#summaryLink').css('font-weight','normal');*/	
	}
	 
}


function sortTable(col,type)
{alert(type);
	var str='';
	
	$("td[name='"+col+"']").each(function()
	{
		str+=$(this).html().toLowerCase()+";";
	});
	
	$.ajax({
	   type: "POST",
	   url: "common.class.php",
	   data: "action=sort&arr="+str+"&type="+type,
	   success: function(msg)
	   {
	   		document.write(msg );
	   }
	 });

}


function clubSearch(type)
{
	if (type == 'city')
	{
		$('#regionSearch').attr('disabled','true');
		$('#citySearch').attr('disabled','');
		$('#citySearchRadio').click();//attr('checked','true');
		$('#searchType').attr('value','m');
	}
	else if (type == 'region')
	{
		$('#searchType').attr('value','w');
		$('#regionSearch').attr('disabled','');
		$('#regionSearchRadio').click();//attr('checked','true');
		$('#citySearch').attr('disabled','true');
		//$('#citySearchRadio').attr('checked','false');
	}

}

function pulire()
{
    $("body").mousemove(function(e)
    {
		$("#as").attr('value','pronto');
    });
}

function trim(arg) 
{ 
	if (!arg)
		return '';
    return arg.replace(/^\s+/, '').replace(/\s+$/, '');
}


