jQuery.noConflict();
jQuery(document).ready(function(){

      //hover firmy
      jQuery('.companyMenuChild').live('mouseover', function() {
        if(!jQuery(this).hasClass('activeLink')){
            jQuery(this).css('background','url(http://technolen.eu/themes/Common/img/currentBig.png) left center no-repeat');
        }
      });
      jQuery('.companyMenuChild').live('mouseout', function() {
        if(!jQuery(this).hasClass('activeLink')){
            jQuery(this).css('background','none');
        }
      });
      //hover firmy

      //firmy click
      jQuery('#companyMenuChildren > a').live('click', function() {
        
        var clickedElementId = jQuery(this).attr('id');
        var tempArray = clickedElementId.split("-");
        var elementId = tempArray[0];
        
        var elementTitle = '';
        for(i=1;i<tempArray.length;i++){
            elementTitle = elementTitle + tempArray[i] + '-';
        }
        if(elementTitle.indexOf('-',elementTitle.length - 1) > -1){
            elementTitle = elementTitle.substr(0,elementTitle.length - 1);
        }

        var root = jQuery('.activeMainMenu').attr('alt');
        currentLang = jQuery('.currentLang').attr('id');

        jQuery.ajax({
                type: "POST",
                url: "http://technolen.eu/index.php/"+currentLang+"/catalog/",
                data: "action=company&lang="+currentLang+"&root="+root+"&title="+elementTitle+"&cat_id="+elementId+"&product_id=",
                success: function(data){
                        jQuery('#ajaxRenderWrapper').html(data);
                        if(jQuery('#companyMenuChildren').is(':visible')){
                                var minWidth = 220;
                                var tempWidth = jQuery('#companyMenuChildren').width();
                                jQuery('.companyMenuChild strong').each(function (){
                                    if(minWidth > tempWidth){
                                        tempWidth = minWidth - 40;
                                    }else{
                                        tempWidth = tempWidth;
                                    }
                                });
                                jQuery('#companyMenuChildren').css('width',tempWidth + 'px');
                                jQuery('#companyCurrentDetail').css('left',(40+tempWidth) + 'px');
                            }
                    },
                    error: function(xmlhttp, status, error){
                        alert(error);
                    },
                    beforeSend: function(){
                    },
                    complete: function(){
                        jQuery('#'+clickedElementId).addClass('activeLink');
                    }
              });
      });
      //firmy click




});

