$(document).ready(function () {
	$(".hmenu .dashed").click(function(){
		$(".hmenuItems").slideToggle("slow");
	});

	if ( $('#searchBrandsCenter').length > 0 ) {
		$('#searchBrandsCenter').scrollable({items:'#searchBrandsCenter ul li',horizontal:true,prev:'#searchBrandsLeft a',next:'#searchBrandsRight a'})
		$('#searchBrandsLeft a').click(function() { return false; });
		$('#searchBrandsRight a').click(function() { return false; });
	}	
});

var browser_name = navigator.appName;
function printit() 
{
    if (browser_name == "Netscape") 
    {
        window.print();
    } 
    else 
    {
        var WebBrowser = '<object id="WebBrowser1" width=0 height=0 classid="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></object>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2);   
    } 
}

function getCategoryList(selBrands)
{
    var categoryList = new Array();
    for ( i in selBrands )
    {
        
        var brandCode = selBrands[i];
        if ( brandCode != '-' )
        {
            for ( k in brandListJson[brandCode]['categoryList'] )
            {   
                categoryList[ k ] = brandListJson[brandCode]['categoryList'][ k ]['name']                       
            }                        
        }
        else
        {
            for ( b in brandListJson )
            {   
                for ( k in brandListJson[b]['categoryList'] )
                {   
                    categoryList[ k ] = brandListJson[b]['categoryList'][ k ]['name']                       
                }
            }                        
        }
        
        
    } 
    return categoryList;   
}
function refreshCatSelect( categoryList )
{
    $('#searchCategory').empty();
                
    for ( k in categoryList )
    {   
        $('#searchCategory').prepend($('<option value="'+ k +'">'+ categoryList[k] +'</option>'))                        
    }
    if ( $('#searchCategory option').length )
    {
        $('#searchCategory').prepend($('<option value="-">Выберите категорию</option>'))                                                            
    }
    
}
function selCurrentCat( currentCategories )
{
    for ( k in currentCategories )
    {
        var catCode = currentCategories[ k ];
        $("#searchCategory [value='"+ catCode +"']").attr("selected", "selected");
          
    }    
}
