 $(document).ready( function () {
                     
    if (typeof(page) == 'undefined') page = 'resizeImageNotAllowed';     
     
    //$("#body_cont").click(function(){
        //alert('kontejner: ' + $("#body_cont").height() + ' window:' + $(window).height());
        
    //});
    //Hlida zda pouzit na strance zvetsovani obrazku    
    if (page == 'resizeImageAllowed')
    {
    //pro konejnery ktere obsahuji obrazek
    $("li[id^='tc']").each(function ( i, e) {
        $(e).hover(function(){overPlus()},function(){overRemove()});      
        $(e).click(function(){
            var objID = $(this).attr('id');                   
            if (regObject[objID][0] === true) {              
                regObject[objID][0] = false;
                overRemove()  
                $(this).unbind('hover');         
                $(this).html(regObject[objID][1]);
                
                var $_y = 0;  
                if ($("#body_cont").height() < $(window).height()) {
                     $_y = 0;                    
                } else {
                     $_y = $(this);
                }
                $.scrollTo( $_y, 600,{easing:'easeOutCirc',offset:{top: -100}} );
                
                //$.scrollTo( $(this), 600,{easing:'easeOutCirc',offset:{top: -100}} );                
                $(this).hover(function(){overPlus()},function(){overRemove()});                           
            } else {                           
                regObject[objID][0] = true;
                overRemove()
                $(this).unbind('hover');                                 
                $(this).html(regObject[objID][2]);                
                $.scrollTo( $(this), 600,{easing:'easeOutCirc',offset:{top: -10}}  );                                                
                $(this).hover(function(){overMinus()},function(){overRemove()});               
            } 
            $('img[@src$=.png]').ifixpng();                        
        });
    });
    
        
    //pro konejnery ktere obsahuji flash
    
    function resizeUp( pObj) 
    {               
        var pObjID = $(pObj).attr('id'); 
        var Obj = $('#e'+pObjID);        
        regObject[pObjID][0] = true;
        overRemove()
        $(Obj).unbind('click');         
        $(Obj).unbind('hover');   
        $(pObj).html(regObject[pObjID][2]);         
        var Obj = $('#e'+pObjID);       
        $.scrollTo( $(pObj), 600,{easing:'easeOutCirc',offset:{top: -10}} );  
        $(Obj).hover(function(){overMinus()},function(){overRemove()});
        $(Obj).click(function(){                   
            resizeDown( pObj);
            $('img[@src$=.png]').ifixpng();   
        });
    }
    
    function resizeDown( pObj)
    {
        var pObjID = $(pObj).attr('id'); 
        var Obj = $('#e'+pObjID);        
        regObject[pObjID][0] = true;
        overRemove()
        $(Obj).unbind('click');         
        $(Obj).unbind('hover'); 
        $(pObj).html(regObject[pObjID][1]);         
        var Obj = $('#e'+pObjID);
         var $_y = 0;  
                if ($("#body_cont").height() < $(window).height()) {
                     $_y = 0;                    
                } else {
                     $_y = $(pObj);
                }
         $.scrollTo( $_y, 600,{easing:'easeOutCirc',offset:{top: -100}} );
       // $.scrollTo( $(pObj), 600,{easing:'easeOutCirc',offset:{top: -10}} );
        $(Obj).hover(function(){overPlus()},function(){overRemove()});
        $(Obj).click(function(){                   
            resizeUp( pObj);
            $('img[@src$=.png]').ifixpng();   
        });
    }
          
    $("li[id^='sp']").each(function ( i, e) {
       var ObjID = $(e).attr('id');     
       $('#e'+ObjID).hover(function(){overPlus()},function(){overRemove()});    
       $('#e'+ObjID).click(function() {            
              resizeUp($(e));
       });       
    });
    } //resizeImageAllowed
 
 });
