var i=0

$(document).ready( function()
{
    $('#banery').css('height',$('#configscrol span').html()+'px')
    loadScrolProdukty()
})

function open(id)
{
    $('#'+id).css('display','block')
}

function close(id)
{
    $('#'+id).css('display','none')
}


function edytor()
{
    i++
    if(i==1)
    tinyMCE.init(
    {
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount",
        mode : "exact",
        elements : "elm1",

		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,search,replace,|,undo,redo,|,preview,code,|,visualaid",
        theme_advanced_buttons2 : "link,unlink,|,image,media,|,emotions,charmap,|,hr,iespell,advhr,|,insertdate,inserttime,|,tablecontrols",
        theme_advanced_buttons3 : "bold,italic,underline,strikethrough,|,forecolor,backcolor,|,fontsizeselect,|,justifyleft,justifycenter,justifyright,|,bullist,numlist,|,outdent,indent,blockquote,|,sub,sup,|,removeformat",
        theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_resizing : true,

		// Example content CSS (should be your site CSS)
		content_css : "css/content.css",

		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "lists/template_list.js",
		external_link_list_url : "lists/link_list.js",
		external_image_list_url : "lists/image_list.js",
		media_external_list_url : "lists/media_list.js",

		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
}

function loadScrolProdukty()
{
    $('#banery').css('height','500px')
    $('#scrol').css('top','0')

    heightTaca=$('#scrol').height()/2-8

    $('#scrol').hover(function ()
    {
        $('#scrol').stop();
    },
    function ()
    {
        topTaca=parseFloat($('#scrol').css('top'))

        loadScrolProduktyMove(heightTaca+topTaca)
    });

    loadScrolProduktyMove(heightTaca)
}

function loadScrolProduktyMove(ile)
{
    var speed=ile*10

    $("#scrol").animate({top:'-='+ile+'px'}, speed, "linear", function()
    {
        var topTaca=parseFloat($('#scrol').css('top'))

        loadScrolProduktyMoveRe()
    });
}

function loadScrolProduktyMoveRe(ile)
{
    $('#banery').css('height','500px')
    $('#scrol').css('top','0')

    heightTaca=$('#scrol').height()/2-8

    loadScrolProduktyMove(heightTaca)
}

