var timer = null; function ScrollStart( dir , div ) { stopScroller(); timer = window.setInterval( function() { scrollIt( dir , div ) }, 10); document.onmouseup=stopScroller; } function scrollIt( dir , div ) { var obj = document.getElementById(div); switch( dir ){ case 'left': obj.scrollLeft-=3; break; case 'up': obj.scrollTop-=3; break; case 'down': obj.scrollTop+=3; break; default: obj.scrollLeft+=3; break; } } function stopScroller() { window.clearInterval( timer ); } function popitup(url) { window.open('http://'+url,'test','height=500,width=977,scrollbars=yes'); return false; } function jspaging(url){ $("#div_paging").hide(); $("#div_paging").load(url); setTimeout(function(){ $("#div_paging").fadeIn("slow"); }, 100); } $(function() { ////// menu search $("#keyword").click(function() { $(this).parent().find("ul.subnav").slideDown('fast').show(); $("li.s_o").parent().click(function() { $(this).parent().find("ul.subnav").slideUp('slow'); }, function(){ $(this).parent().find("ul.subnav").slideUp('slow'); }); }).hover(function() { $(this).addClass("subhover"); }, function(){ $(this).removeClass("subhover"); }); $(".s_o").click(function() { $("#type").val($(this).find("img").attr("id")); $("#show_option").html(''); //$('#search_form').removeAttr("disabled"); $('#keyword').focus(); }); $("#search-close").click(function() { $(".subnav").slideUp('slow'); }); ///////////////////// //// submit search form $(".search_form").click(function(){ $("#msgsearch_back").html(''); $("#msgsearch").removeClass().addClass('white').text('Валидиране').fadeIn(1000); $.post("",{ type:$('#type').val(),keyword:$('#keyword').val(),rand:Math.random() } ,function(response) { if(response == 'no'){ $("#msgsearch").fadeTo(200,0.1,function(){ $(this).html('Няма намерени резултати').addClass('white').fadeTo(900,1); }); } else { $(".subnav").slideUp('slow'); $("#msgsearch").fadeTo(200,0.1,function(){ $(this).html('Зареждане').addClass('white').fadeTo(900,1, function(){ $("#container").html(response); $(this).text(''); }); }); } }); return false; }); /////////////////////// if($("ul#leftmenu")){ $("ul#leftmenu ul").hide(); $('ul#leftmenu li:has(ul) ul').each(function(i) { $(this).slideUp(400); }); $('ul#leftmenu li.clicked ul').show(); $('ul#leftmenu li:has(ul) a').click(function(){ if ($(this).parent().hasClass ("clicked")){ $(this).parent().removeClass("clicked"); $(this).parent().children("ul").slideUp(400); }else{ if ($(this).parent().parent().hasClass('leftmenu')){ $('ul#leftmenu li:has(ul)').removeClass("clicked"); $('ul#leftmenu li:has(ul) ul').slideUp(400); $(this).parent().addClass("clicked"); $(this).parent().children("ul").slideDown(400); } } }); } $('ul#forum_path li:has(ul) a.drop').click(function(){ if ( $(this).parent().hasClass ("clicked")){ $(this).parent().removeClass("clicked"); $(this).parent().children("ul").slideUp(400); }else{ $('ul#forum_path li:has(ul)').removeClass("clicked"); $('ul#forum_path li:has(ul) ul').slideUp(400); $(this).parent().addClass("clicked"); $(this).parent().children("ul").slideDown(400); } }); $(document).click(function(event) { if($(event.target).parents().index($('#forum_path')) == -1) { if($('#forum_path li:has(ul)').hasClass ("clicked")) { $('#forum_path li:has(ul)').removeClass("clicked"); //$('#forum_path li:has(ul) ul').slideUp(400); $('#forum_path li:has(ul) ul').css({'display' : 'none'}); } } if($(event.target).parents().index($('#search_box')) == -1) { $(".subnav").css({'display' : 'none'}); } }); if($("#gallery_news")){ $("#gallery_news").mbScrollable({ dir: 'vertical', width:550, elementsInPage:1, height:150, controls:"#paging_news", slideTimer:600, autoscroll:false, scrollTimer:4000 }); } if($("#gallery_links")){ $("#gallery_links").mbScrollable({ dir:'vertical', width:355, height:182, elementsInPage:7, elementMargin:0, controls:"#paging_links", slideTimer:600, autoscroll:false, scrollTimer:6000 }); } /* bulletin_register */ $("#bulletin_register").click(function(){ $("#newsletter_message").removeClass().addClass('messagebox new').text('Валидиране ....').fadeIn(1000); $.post("",{ email:$('#mail_register').val(),rand:Math.random() } ,function(data) { if(data=='yes'){ $("#newsletter_message").fadeTo(200,0.1,function(){ $(this).html('На посочения mail адрес са Ви изпратени инструкции за завършването на абонамента').addClass('messageboxok').fadeTo(900,1); }); } else if(data=='error'){ $("#newsletter_message").fadeTo(200,0.1,function(){ $(this).html('Има абонамент с този mail адрес').addClass('messageboxerror').fadeTo(900,1); }); } else { $("#newsletter_message").fadeTo(200,0.1,function(){ $(this).html('Моля въведете email адрес.').addClass('messageboxerror red').fadeTo(900,1); setTimeout(function(){ $("#newsletter_message").fadeOut(400); }, 3000); }); } }); return false; }); /* bulletin_register */ });