$(document).ready(function(){


   $(".brand")
        .bind("mouseenter", function(){  
            //if($(this).attr("class") !== "brand selected")
               // $(this).attr( "class", "brandLight" );
               $(this).addClass("brandLight");
        })
	.bind("mouseleave", function(){ 
           // if($(this).attr("class") !== "brand selected")
                //$(this).attr( "class", "brand" );
                $(this).removeClass("brandLight");
        });

    $(".toCartGood")
	.bind("mouseenter", function(){ $(this).attr( "class", "toCartGoodOver" ); })
	.bind("mouseleave", function(){ $(this).attr( "class", "toCartGood" ); }) ;


    // Выделяем текущие ссылки, блоки-ссылки
    $("a[href='"+ document.location.href +"'], div[onclick=\"document.location.href='"+ document.location.href +"';\"]")
        .addClass('selected');
        // for IE:
        $("a[href='"+ document.location.href +"']").parents("div.brand")
            .addClass('selected');
            //attr('class', 'brand selected');


     // Реакция наведения на директорию
     $('div.dirPreview')
        .bind("mouseenter", function(){ 
            $(this).find('center a').attr("style", "color:maroon;");
        })
	.bind("mouseleave", function(){
            $(this).find('center a').attr("style", "");
        });

});



function assign(element, node, value)
{
	if(!element || !node) return false;
	element[node]=value;

	return true;
}

function append(element, node, value, mode)
{
	if(!element || !node) return false;

	if(mode=='up') 
		element[node] = value + element[node];
	else
		element[node]+=value;

	return true;
}

var oIFrame = null;

function createIFrame()
{
	var newIFrame = document.createElement('iframe');

	newIFrame.width = 0;
	newIFrame.height = 0;
	newIFrame.frameBorder = 0;
	newIFrame.name = 'buffer';
	newIFrame.id = 'buffer';

	document.body.appendChild(newIFrame);

	oIFrame = frames['buffer'];
}

function execPHPScript(php_script)
{
	if(!oIFrame)
	{
		createIFrame();
		setTimeout('execPHPScript("'+php_script+'")', 10);
		return;
	}

	oIFrame.location = php_script;
}