$(document).ready(function(){


   $(".brand").each(function() {
       if( !$(this).hasClass("selected") ) {
            $(this).bind("mouseenter", function(){
                $(this).addClass("brandLight");
            })
            $(this).bind("mouseleave", function(){
                $(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;
}
