
$(document).ready(function() {
	//debug bar
	$("#debug a.close").click(function() {
		$("#debug").addClass('hidden');
	});

	//i_utils.js
	CheckIframe();
	mapBaseActions();
	StaticTextPaging();
    alignMenu();
	
	//i_menu.js
	//menuHorizontalPadding("menu_top"); //wysrodkowanie menu horyzontalnego (lewo - prawo) na cala szerokosc kontenera
	
	/*parametry konstruktora mapMenuDropdown:
	index - indeks menu w globalnej tablicy mouse_over (musi byc unikalny)
	menu_id - id div'a, w którym znajduje się menu (a nie samego menu!)
	margin - margines, o ile pikseli wyskakujace menu ma byc przesunięte względem danej pozycji
	xory - wg której osi menu sie powtarza (x - menu poziome, y - menu pionowe)
	ie8fix - jeśli się pieprzy w IE8, to trzeba w konstrukturze ustawić true, jeśli jest OK to lepiej false
	*/
	
	//deklaracja rozwijanego menu dla menu_top
	
    //var ob = new mapMenuDropdown(0,"menu_top2",220, "x", true);
	//ob.map();

	//deklaracja rozwijanego menu dla menu_left
	var ob2 = new mapMenuDropdown(1,"menu_left",310, "y", false);
	ob2.map();
	
	//deklaracja rozwijanego menu dla menu_right
	//var ob3 = new mapMenuDropdown(2,"menu_right",20, "y", false);
	//ob3.map();
    
    generate_partners_actions();

    $('#flash').flash({
        src: 'css/swf/top.swf',
        width: 960,
        height: 182,
        name: 'flash_top'
    });    
    
    $('#menu_top_0_').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(2);
        document.flash_top.Play();
        
    });
    $('#menu_top_1_').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(46);
        document.flash_top.Play();
        
    });
    $('#menu_top_2_').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(91);
        document.flash_top.Play();
        
    });
    $('#menu_top_3_').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(132);
        document.flash_top.Play();
        
    });
    $('#menu_top_4_').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(173);
        document.flash_top.Play();
        
    });
    $('#menu_top_0').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(2);
        document.flash_top.Play();
        
    });
    $('#menu_top_1').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(46);
        document.flash_top.Play();
        
    });
    $('#menu_top_2').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(91);
        document.flash_top.Play();
        
    });
    $('#menu_top_3').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(132);
        document.flash_top.Play();
    });
    $('#menu_top_4').mouseover(function(){
        document.flash_top.SetVariable("firsttime", 0);
        document.flash_top.GotoFrame(173);
        document.flash_top.Play();
    });
    
    setTimeout("play_top_flash()",35000);
    

});
function play_top_flash()
{
    document.flash_top.SetVariable("firsttime", 1);
    document.flash_top.GotoFrame(2);
    document.flash_top.Play();
    setTimeout("play_top_flash()",35000);
}



var partners_id = new Array;
var active_partner = 0;
var ilosc = 0;
function generate_partners_actions()
{
    
    $('li.partner').each(function(){
        partners_id[ilosc]= $(this).attr('id');
        if(ilosc>0)
        {
            $(this).fadeOut(1);
                
        }
        ilosc++;
    });
    setTimeout("change_partner()",5000);
}

function change_partner()
{
    if(ilosc == 0) return false;
    
    
    
    $('#'+partners_id[active_partner]).fadeOut('slow', function(){
        active_partner++;
        
        if(active_partner>=ilosc) active_partner = 0;
        $('#'+partners_id[active_partner]).fadeIn(300);
    });
    
    setTimeout("change_partner()",5000);
}