$(window).addEvent('domready', function(){ initCategories(); } );

function initCategories(){
	initImageHighlightInCategory();
	initCategoryContent();
}

function initImageHighlightInCategory(){
	if($('highlightImage') && $('productInHighlightContent')){
		$('productInHighlightContent').style.left = ($('productInHighlightImage').offsetWidth - ($('highlightImage').offsetWidth/2)) + 'px';
		$('productInHighlightContent').style.top = -($('productInHighlightImage').offsetHeight/4 + ($('highlightImage').offsetHeight/2)) + 'px';
	}
}

function initCategoryContent(){
	if($('categoryContent')){
			/*if($('menuCategories').offsetHeight > $('categoryContent').offsetHeight)
				$('categoryContent').style.height = $('menuCategories').offsetHeight + 'px';
			else
				$('menuCategories').style.height = $('categoryContent').offsetHeight + 'px';*/
				
			initFormFields('formItemsNumber');
	}
}

function toggleSubcategories(parentId, level)
{
	var targetElement = document.getElementById('subcategories' + parentId);
	var togglerElement = document.getElementById('categoryToggler' + parentId);
	
	if(targetElement.style.display == 'none')//open subcategories
	{
		targetElement.style.display = '';
		togglerElement.className = 'categoryTogglerOpen';
	}
	else if(targetElement.innerHTML.length < 41)//load subcategories
	{
		ajaxLoadSync(shop.url + '/ajaxTemplates/common/categoriesContent.cfm?parentId='+parentId+'&deepLevel=1&level='+level, targetElement);
		togglerElement.className = 'categoryTogglerOpen';
		targetElement.style.display = '';
	}
	else //close subcategories
	{
		togglerElement.className = 'categoryTogglerClosed';
		targetElement.style.display = 'none';
	}
}

function getHeightMenu(table){
	if($(table)){ 
		maxHeightTable = $(table).offsetHeight;
		return maxHeightTable;
	}
	if($(table)) { 
		maxHeightContent = $(table).style.height; 
		maxHeightContent = parseInt(maxHeightContent.replace("px", ""));
	}
}


<!--window.addEvent('domready', function(){-->

<!--});-->

