
$(document).ready(function(){
	/*param = {
		search:$('#search >input.input').attr('value')
	}
	$('#search >input.input').focus(function(){
		if( $(this).attr('value')==param.search ) $(this).attr('value','');
	}).blur(function(){
		if( $(this).attr('value')=='' ) $(this).attr('value',param.search)
	});*/


	if ($.browser.msie && $.browser.version == 6) {
		$('div.menu-left >ul >li').hover(function(){
				$(this).addClass('over');
			},function(){
				$(this).removeClass('over');
		});
	}

    /*

	$('#select-type a.selected').click(function(){
		$('~ul',this).slideToggle();
		return(false);
	});
	$('#select-type ul a').click(function(){
		$(this).parent().parent().slideToggle();

		// Клик на пункте селекта...

		return(false);
	});
    */


	$('div.in-1 input,#search >input.input,div.text-1 textarea').each(function(){
		$(this).data('value',$(this).attr('value'));

		$(this).focus(function(){
			if( $(this).attr('value')==$(this).data('value') ) $(this).attr('value','');
		}).blur(function(){
			if( $(this).attr('value')=='' ) $(this).attr('value',$(this).data('value'))
		});
	});

    $("#feedback input[type=submit]").click(function(){
        $.post("/feedback.php", { "name" : $("#feedback input[name=name]").val(), "mail" : $("#feedback input[name=mail]").val(), "text" : $("#feedback textarea").val() }, function(data){
            $("#feedback").html("Ваше сообщение отправлено. Спасибо!");
        });
    });
});

function category_search(name_exact, name)
{
    $('#select-type>div>input[name=category]').val(name_exact);
    $('#searchFormSelectedCategoryTitle>span').html(name + '<img src="/img/sel-1-5.gif" alt="sel" />');
    $('#searchForm').submit();
}

function open_window(url, width, height)
{
    pleft = screen.width ? (screen.width - width) / 2 : 100;
    ptop  = screen.height ? (screen.height - height) / 2 : 100;
    scrollbars = (width < screen.width && height < screen.height) ? 'no' : 'yes';
    settings = 'width=' + width + ',height=' + height + ',top=' + ptop + ',left=' + pleft + ',scrollbars=' + scrollbars + ',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
    image = window.open('/' + url, 'image', settings);
}

