$(document).ready(function(){

$("#topMenu li").mouseover(function(){
$(".level2").hide();

currentElem = $(this).attr('rel');
$("#sub_lev_" + currentElem).show();
});

$("#topMenu ul li").mouseover(function(){
$(".level3").hide();

currentElem = $(this).attr('rel');
$("#sub_lev_" + currentElem).show();
});

$("#middle, #header").mouseover(function(){
$(".level2").hide();
$(".level3").hide();
});

$(".catLink").click(function(){
$(this).next(".proektInn").slideToggle("slow");
return false;
});


//скроллер в карточке товара
bannerFlag = $(".proektL");
if(bannerFlag.length > 0){
$('.firstFoto').cycle({ 
fx:      'scrollRight', 
speed:    1000, 
timeout:  1000, 
pager: '.smallFotos', 
pause: 1, 
activePagerClass: 'active', 
pagerAnchorBuilder: function(idx, slide) { 
// return selector string for existing anchor 
return '.smallFotos a:eq(' + idx + ')'; 
}
});
$('.firstFoto').cycle('pause');
$("#goSlide").click(function(){
flag = $(this).attr('rel');

if(flag == 0){
$('.firstFoto').cycle('resume');
$(this).html('Остановить слайдшоу');
$(this).attr('rel', '1');
}
else{
$('.firstFoto').cycle('pause');
$(this).html('Запустить слайдшоу');
$(this).attr('rel', '0');
}
//if($(this).html() == 'Запустить слайдшоу') $(this).html('Остановить слайдшоу');
//if($(this).html() == 'Остановить слайдшоу') $(this).html('Запустить слайдшоу');

return false;
});
}
//скроллер в галерее
bannerFlag = $("#main_image");
if(bannerFlag.length > 0){
$('#main_image').cycle({ 
fx:      'scrollRight', 
speed:    1000, 
timeout:  0, 
pager: '.items', 
pause: 1, 
activePagerClass: 'active', 
pagerAnchorBuilder: function(idx, slide) { 
// return selector string for existing anchor 
return '.items a:eq(' + idx + ')'; 
}
});
}

$("#scrollable").scrollable(
{
size: 6,
horizontal:false
}
);




if($("#user_f_44 option:selected").val() == 29){$('.sayd').show();}

$("#user_f_44").change(function(){
sayd = $(this).find("option:selected").val();
if(sayd == 29){
$('.sayd').show();
$('#user_f_52 option:selected').removeAttr('selected');
}else{
$('.sayd').hide();
$('#user_f_52 option:selected').removeAttr('selected');
}
});


if($("#user_f_53_13").attr("checked")){
$(".mn_dom").show();
}


$("input:radio").change(function(){
var dom = $("input:radio:checked").val();
if(dom == '13'){
$(".mn_dom").show();
$("#user_f_50 option:selected").removeAttr('selected');
}else{
$(".mn_dom").hide();
$("#user_f_50 option:selected").removeAttr('selected');
}
});

});
