/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) * Licensed under the MIT License (LICENSE.txt). * * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. * Thanks to: Seamus Leahy for adding deltaX and deltaY * * Version: 3.0.4 * * Requires: 1.2.2+ */ (function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a= f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery); /* * FancyBox - jQuery Plugin * Simple and fancy lightbox alternative * * Examples and documentation at: http://fancybox.net * * Copyright (c) 2008 - 2010 Janis Skarnelis * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated. * * Version: 1.3.4 (11/11/2010) * Requires: jQuery v1.3+ * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ ;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("
")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('

The requested content cannot be loaded.
Please try again later.

'); F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)|| c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick= false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('
').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel", function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='';P="";b.each(e.swf,function(x,H){C+='';P+=" "+x+'="'+H+'"'});C+='";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win== "function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('
');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor, opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length? d.titlePosition=="float"?'
'+s+'
':'
'+s+"
":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding}); y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height== i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents()); f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode== 37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto"); s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('').appendTo(j); f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c); j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type== "image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"), 10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)}; b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k= 0,C=a.length;ko.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+ 1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h= true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1; b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5- d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
'),t=b('
'),u=b('
'),f=b('
'));D=b('
').append('
').appendTo(f); D.append(j=b('
'),E=b(''),n=b('
'),z=b(''),A=b(''));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()}); b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('').prependTo(D)}}}; b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing", easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery); /** * @author Alexander Farkas * v. 1.22 */ (function($) { if(!document.defaultView || !document.defaultView.getComputedStyle){ // IE6-IE8 var oldCurCSS = $.curCSS; $.curCSS = function(elem, name, force){ if(name === 'background-position'){ name = 'backgroundPosition'; } if(name !== 'backgroundPosition' || !elem.currentStyle || elem.currentStyle[ name ]){ return oldCurCSS.apply(this, arguments); } var style = elem.style; if ( !force && style && style[ name ] ){ return style[ name ]; } return oldCurCSS(elem, 'backgroundPositionX', force) +' '+ oldCurCSS(elem, 'backgroundPositionY', force); }; } var oldAnim = $.fn.animate; $.fn.animate = function(prop){ if('background-position' in prop){ prop.backgroundPosition = prop['background-position']; delete prop['background-position']; } if('backgroundPosition' in prop){ prop.backgroundPosition = '('+ prop.backgroundPosition; } return oldAnim.apply(this, arguments); }; function toArray(strg){ strg = strg.replace(/left|top/g,'0px'); strg = strg.replace(/right|bottom/g,'100%'); strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2"); var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/); return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]]; } $.fx.step. backgroundPosition = function(fx) { if (!fx.bgPosReady) { var start = $.curCSS(fx.elem,'backgroundPosition'); if(!start){//FF2 no inline-style fallback start = '0px 0px'; } start = toArray(start); fx.start = [start[0],start[2]]; var end = toArray(fx.end); fx.end = [end[0],end[2]]; fx.unit = [end[1],end[3]]; fx.bgPosReady = true; } //return; var nowPosX = []; nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0]; nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1]; fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1]; }; })(jQuery); $(document).ready(function() { $("BODY").bind("keyup", function(e) { if (e.keyCode == 27) { hideNews(); } return false; }); callNews(5000); }); function showNews() { var $rem = 0; $.get("/tools/news.php", function(html) { if (html) { $("#notify .body").append(html); if ($("#notify .body UL").size() > 4) { $("#notify .body UL:first").remove(); } $("#notify .body FORM:not(:first)").remove(); $("#notify .body H1:not(:first)").remove(); $("#notify .body .read:not(:last)").remove(); $("#notify .body FORM INPUT").bind("change", function(e) { $.get("/tools/news-status.php?notifynews="+(this.checked?"0":"1")); return false; }); // $("td:lt(4)"). $("#notify").show("fast"); $("#notify .close").click(function () { $("#notify").hide("fast"); return false; }); // window.setTimeout("hideNews()", 10000); } }); callNews(); } function hideNews() { $("#notify .body").html(""); $("#notify").hide("fast"); } function callNews(timer) { timer = timer ? timer : 15000; window.setTimeout("showNews()", timer); } // bistrij poisk $qsHandler = false; $qsDelay = 300; $qsSubj = ''; $qsDiv = '.top .head #search'; $qsResult = '.top .head #result'; $qsForm = '#fQS'; $qsInput = '#fQS INPUT[name=qs]'; $urlSearch = '/tools/quick-search.php'; function qsSetup() { $($qsResult).hide(); $($qsResult).width($($qsDiv).width() - 16); // $($qsForm).submit(function(){return false;}) $($qsInput).keyup(function() { if (this.value.length > 2) { if ($qsHandler) { clearTimeout($qsHandler); } $qsHandler = setTimeout("qsSearch()", $qsDelay); } else { // qsCancel(); } }); $($qsInput).blur(function() { // $($qsResult).hide(); // $($qsInput).val(''); }); $($qsInput).focus(function() { if ($($qsInput).val() && ($($qsInput).val() == $qsSubj)) { $($qsResult).show(); } }); /* $('body').click(function(event) { if ((event.target.className != 'line') && (event.target.className != 'search_results')) { $('#qs-clubs INPUT[name=qs]_results_ajax').css('display','none'); } }); */ $(document).keypress(function(event) { if (event.keyCode == 27) { qsCancel(); } }); } function qsSearch() { if ($($qsInput).val().length > 2) { var $qs = jQuery.trim($($qsInput).val()); // teperj proverim, so vremeni proshlogo poiska izmenilosj che-to ili net; if ($qsSubj == $qs) { $($qsResult).show(); } else { qsLoading(); $qsSubj = $qs; jQuery.get($urlSearch, $($qsForm).serialize(), function($data) { if ($data) { $($qsResult).html($data); /* $($qsResult).find("DIV.item") .mouseover(function(){ $(this).addClass("over"); }) .mouseout(function(){ $(this).removeClass("over"); }) ; */ } else { // $($qsResult).css('display', 'none'); qsCancel(); } }, 'html' ); } } else { qsCancel(); } } function qsCancel() { $($qsResult).hide(); $($qsInput).val(''); $qsSubj = false; } function qsLoading() { $($qsResult).show(); $($qsResult).html('loading...'); } function showChar($id, $this) { // $stopBy = document.getElementById($id); // window.scrollTo(1, findPosY($stopBy)); // alert(findPosY($stopBy)); // $stopBy.focus(); $('.pages A').removeClass('act'); $(".pages ."+$this.className).addClass('act'); if ($id) { // eto bukva ili "promo" $('UL.letter').hide(); $('UL#li-'+$id).show(); } else { // eto vse srazu $('UL.letter').show(); // vo vremja vseh srazu, vne sekcii "promo" nado virubitj // "promo' v bukvah; } /* $('.pages A').attr('style', ''); $('.pages A:first').attr('style', 'background: #cc1f24'); $('.'+$this.className).attr('style', 'background: #cc1f24'); */ /* $stopBy = document.getElementById("listContainer"); window.scrollTo(1, findPosY($stopBy)); */ return false; } function getWeather($target) { $('#'+$target).hide(); var $url = "../tools/weather.php"; jQuery.get($url, function($data) { $('#'+$target).html($data); // $('#'+$target+" STYLE").remove(); $('#'+$target+" #weather_mail_2 .top").remove(); $('#'+$target+" #weather_mail_2 .podr").remove(); $('#'+$target+" #weather_mail_2 .main").css("border", "none"); // $('#'+$target+" #weather_mail_2 .main").css("height", "164px"); // $('#'+$target+" #weather_mail_2 .main h2").css("padding-top", "-10px"); $('#'+$target).show(); }); } function toCart($form, $callback) { // dobavlaem v korzinku // $fId - gde bratj parametri // var $url = "/tools/cart.php"; var $form = $($form); var $url = $baseURL + "?" + $form.serialize(); // var $callback = $callback || 'module(93, "#cartList", "'+$url+'")'; var $callback = $callback || 'module(93, "#cartList")'; // $url += "&ids=" + collectIds(); module(74, "#cart", $url, $callback); return false; } function pickColor($form) { // $("FORM.order DIV.pic a").fancybox({titlePosition:"over",padding:10,margin:0,hideOnContentClick:1}); $("DIV#colors A").click(function(){ // set middle image in the var image = new Image(); image.src = $(this).find("IMG").attr('rel'); $(image).fadeTo(0,0); $("DIV#colors A").removeClass('act'); $(this).addClass('act'); $($form).find("INPUT[name=color]") .val($(this).attr("rev")); $("FORM.order A.fancybox") .attr("title", this.title) .attr("href", this.href) ; // $("FORM.order A.fancybox").fancybox({titlePosition:"over",padding:10,margin:0,hideOnContentClick:1}); $("FORM.order A.fancybox IMG").fadeTo(200,0, function(){ $("FORM.order A.fancybox IMG") .replaceWith(image); $("FORM.order A.fancybox IMG") .fadeTo(200,1); return false; }); /* $("FORM.order A.fancybox IMG").fadeTo(200,0, function(){ $(this).addClass('act'); }); */ return false; }); // $("FORM.order A.fancybox IMG").attr("") $($form + " A.fancybox") .mouseenter(function(){$(this.parentNode).find(".zoom").fadeTo(200,1)}) .mouseleave(function(){$(this.parentNode).find(".zoom").fadeTo(200,0.2)}) .fancybox({titlePosition:"over",padding:10,margin:0,hideOnContentClick:1}) ; return false; } function pickSize($form) { $form = $($form); $("DIV.sizes INPUT[type=radio]").click(function(){ $("DIV.sizes TR").removeClass("act"); $(this.parentNode.parentNode).addClass("act"); $form.find("INPUT[name=size]").val(this.value); }); $("DIV.sizes TR").hover(function(){$(this).addClass("over")}, function(){$(this).removeClass("over")}) return false; } function myForm($data) { // var $form = $("
").attr("id", $fId); var $form = $(""); for ($i in $data) { $form .append( $("") .attr("type", "hidden") .attr("name", $i) .val($data[$i]) ); } return $form; } function fixPrice($flo) { $flo = parseFloat($flo); $flo = $flo.toFixed(4); $flo = $flo.split("."); $flo[1] = $flo[1] ? $flo[1].substr(0, 3) : 0; $flo = Math.round($flo.join("."), 2); return $flo.toFixed(2); } function setFilter($target, $mode, $mId, $eId) { $("DIV#"+$target+"") .find("INPUT:checkbox,INPUT:radio").bind("click", function(){ // build AJAX request and re-send data applyFilter($mode, $mId, $eId); }) ; toggleMoreLess($target); toggleSort($target); toggleFull($target, $mode, $mId, $eId); toggleClear($target, $mode, $mId, $eId); } function parseFilter($mode) { var $dir = nofilter(dirname($baseURL)); var $file = basename($baseURL); var $ext = fileext($baseURL); var $params = [$dir]; $("DIV.filter").each(function(){ // tut eshe nado opredelatj rezim: OR (;) ili AND (,) // esli AND (,), to drugie boxi ostajutsa; // esli OR (;), to drugie boxi nado virubatj; var $div = this.id; var $key = this.id.split("-").pop(); var $data = []; $(this).find("INPUT:checkbox:checked,INPUT:radio:checked").each(function(){ /* eto na sluchaj, esli nuzhno budet toka ODIN parametr if (($mode == ";") && ($target == $div) && ($box != this)) { this.checked = false; } */ $data.push(this.value); }); if ($data.length) { $params.push($key + ":" + $data.join($mode)); } }); if ($ext) { $params.push($file); } else { $params.push(""); } $params = $params.join("/"); // eto pripiska k realnomu URL'u return $params; } function applyFilter($mode, $mId, $eId) { var $params = parseFilter($mode); // vizivaem nuzhnij module s etim URL; // alert($params); return module($mId, $eId, $params); } /* [ =================================================================== ] */ var $maxHeight = $(window).height() > 650 ? 650 : $(window).height() - 20; function toggleMoreLess($target) { $("DIV#"+$target+" A.more").bind("click", function(){ $("DIV#"+$target+" DIV.more").show(); $("DIV#"+$target+" DIV.fold").find("P").hide(); $("DIV#"+$target+" A.more").hide(); $("DIV#"+$target+" A.less").show(); $(document).scrollTop($("DIV#"+$target+"").offset().top); return false; }); $("DIV#"+$target+" A.less").bind("click", function(){ $("DIV#"+$target+" DIV.more").hide(); $("DIV#"+$target+" DIV.fold").find("P").show(); $("DIV#"+$target+" A.less").hide(); $("DIV#"+$target+" A.more").show(); $(document).scrollTop($("DIV#"+$target+"").offset().top); return false; }); } function toggleSort($target) { $("DIV#"+$target+" DIV.sort A.sort").bind("click", function(){ var $mode = this.id.split("-").pop(); return sortFilter($("DIV#"+$target+" DIV.list"), $mode); }); } function toggleFull($target, $mode, $mId, $eId) { $("DIV#"+$target+" DIV.full") .find("A.opt") .click(function() { // nado dobavit opciju v filtr; var $id = this.id.substr(4); $("DIV#"+$target+" DIV#added_"+$id+"").remove(); /* */ $( '
'+ ''+ this.title + ''+ $(this).find("SPAN").html() + '
' ).prependTo( $("DIV#"+$target+" DIV.list") ); setFilter($target, $mode, $mId, $eId); $.fancybox.close(); return false; }) ; $("DIV#"+$target+" A.all:not(.ajax)").fancybox({ "width" : 750, "height" : $maxHeight, "type" : "inline", "autoDimensions" : false, "autoScale" : false, // "scrolling" : false, "centerOnScroll" : true }); $("DIV#"+$target+" A.all.ajax").click(function(){ var $href = $urlCall + (($urlCall.indexOf("?", 0) !== -1) ? "&" : "?") + "mid=" + this.rel + "&ajax=1"; $.fancybox({ "href" : $href, "width" : 750, "height" : $maxHeight, "type" : "ajax", "autoDimensions" : false, "autoScale" : false, "centerOnScroll" : true }); return false; }); } function toggleClear($target, $mode, $mId, $eId) { $("DIV#"+$target+" A.clear").click(function(){ $("DIV#"+$target+" INPUT:checkbox:checked").attr('checked', false); applyFilter($mode, $mId, $eId); return false; }); } function uncheckFilter($id) { $id = "INPUT#"+$id.split("rm_")[1]; $($id).attr("checked", false); $($id).trigger("change"); } function activateNav($id) { $("#"+$id+" DIV").click(function() { var $cname = this.parentNode.className.replace(" ", "."); $("DIV."+$cname+" DIV").removeClass("act"); $(this).addClass("act"); }); } function buildPlaces($id) { activateNav("aArea"); $("#"+$id+" DIV#aArea DIV").click(function(){ var $nId = this.id.substr(2); $("#"+$id+" DIV#aRegion").html( $aTree[$nId] ? $aTree[$nId].join("") : "" ); activateNav("aRegion"); $("#"+$id+" DIV#aCounty").html("—"); $("#"+$id+" DIV#aCity").html("—"); $("#"+$id+" DIV#aDistrict").html("—"); $("#"+$id+" DIV#aRegion DIV").click(function(){ var $nId = this.id.substr(2); $("#"+$id+" DIV#aCity").html( $aTree[$nId] ? $aTree[$nId].join("") : "" ); $("#"+$id+" DIV#aCounty").html( $aSub[$nId] ? $aSub[$nId].join("") : "" ); $("#"+$id+" DIV#aDistrict").html("—"); activateNav("aCity"); activateNav("aCounty"); $("#"+$id+" DIV#aCity DIV").click(function(){ var $nId = this.id.substr(2); $("#"+$id+" DIV#aDistrict").html( $aTree[$nId] ? $aTree[$nId].join("") : "" ); activateNav("aDistrict"); }); // $("#"+$id+" DIV#aCity DIV:first").trigger("click"); }); // $("#"+$id+" DIV#aRegion DIV:first").trigger("click"); }); } function sortFilter($list, $mode) { var $coll = $list.children("DIV[class!=act]").get(); switch ($mode) { case "quan09": $f = function (a, b){a-b;}; break; case "quan90": $f = function(a, b) { var compA = $(a).find("B").text().toUpperCase(); var compB = $(b).find("B").text().toUpperCase(); compA = compA.match(/[\d\.]+/g)[0]; compB = compB.match(/[\d\.]+/g)[0]; return compB - compA; }; break; default: $f = function(a, b) { var compA = $(a).find("A,LABEL").text().toUpperCase(); var compB = $(b).find("A,LABEL").text().toUpperCase(); return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; }; break; } $coll.sort($f); $.each($coll, function(idx, itm) { $list.append(itm); }); return false; } function sortProducts($list, $link) { var $coll = $list.children("DIV.item").get(); var $order = $($link).hasClass("up") ? "09" : "90"; switch (true) { case $($link).hasClass("date"): $mode = "date"; break; case $($link).hasClass("name"): $mode = "name"; break; default: $mode = "price"; break; } $mode = $mode + $order; switch ($mode) { case "price09": $f = function(a, b) { var compA = $(a).find("SPAN.price").text().toUpperCase(); var compB = $(b).find("SPAN.price").text().toUpperCase(); compA = isNaN(parseInt(compA)) ? '0' : compA; compB = isNaN(parseInt(compB)) ? '0' : compB; compA = compA.match(/[\d\.]+/g)[0]; compB = compB.match(/[\d\.]+/g)[0]; return compA - compB; } break; case "price90": $f = function(a, b) { var compA = $(a).find("SPAN.price").text().toUpperCase(); var compB = $(b).find("SPAN.price").text().toUpperCase(); compA = isNaN(parseInt(compA)) ? '0' : compA; compB = isNaN(parseInt(compB)) ? '0' : compB; compA = compA.match(/[\d\.]+/g)[0]; compB = compB.match(/[\d\.]+/g)[0]; return compB - compA; } break; case "name09": $f = function(a, b) { var compA = $(a).find("A.title B").text().toUpperCase(); var compB = $(b).find("A.title B").text().toUpperCase(); return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; }; break; case "name90": $f = function(a, b) { var compA = $(a).find("A.title B").text().toUpperCase(); var compB = $(b).find("A.title B").text().toUpperCase(); return (compB < compA) ? -1 : (compB > compA) ? 1 : 0; }; break; case "date09": $f = function(a, b) { var compA = a.id.split("product")[1]; var compB = b.id.split("product")[1]; return (compA < compB) ? -1 : (compA > compB) ? 1 : 0; }; break; case "date90": $f = function(a, b) { var compA = a.id.split("product")[1]; var compB = b.id.split("product")[1]; return (compB < compA) ? -1 : (compB > compA) ? 1 : 0; }; break; } $coll.sort($f); $.each($coll, function(idx, itm) { $list.append(itm); }); return false; } function showBanner() { show($products[$pos]); } function hideBanner() { hide($products[$pos]); $pos++; if (($pos+1) > $products.length) { $pos = 0; } } function show($banner) { $("#log").html(""); var $step=1; $("DIV#banner-content") .click(function(){document.location.href=$banner.url;}) .css({ "cursor": "pointer", "background-image": "url("+$banner.image+")", "opacity": 0, "background-position": "75% "+($("DIV#banner-content .title").height()/4)+"px" }) .attr({ "title": $banner.alt, "alt": $banner.alt }) .html('
 
'+$banner.html+'
') .animate({ opacity: 1 }) .find("DIV.title SPAN").css("opacity", .8) /* .animate({ backgroundPosition: "100% 10%" }, ($banner.pause), "linear") */ ; //, $banner.pause*10, "linear" $("DIV#banner-content .title") .css("opacity", 0) .css("display", "block") .css("top", "-"+$("DIV#banner-content").height()/5+"px") .animate({ opacity: 1, top: -1 }, $banner.speed, "easeInQuint", function() { // Animation complete. window.setTimeout("hideBanner()", $banner.pause); }); } function hide($banner) { $("DIV#banner-content") .css("opacity", 1) .animate({ opacity: 0 }, $banner.speed/4) ; $("DIV#banner-content .title") .css("opacity", 1) .css("left", 0) .animate({ opacity: 0, top: "+="+($("DIV#banner-content .title").height())+"" }, $banner.speed/3, "easeOutQuart", function() { // Animation complete. window.setTimeout("showBanner()", 0); }); } function advOpen(openUrl, openWidth, openHeight, openSwitch) { var srw = screen ? (screen.width-50) : 750; var srh = screen ? (screen.height-36) : 564; var openScroll = "0"; var documentWrite = ""; var openParameters = ""; if ((openWidth>srw) || (openHeight>srh)) { openScroll = "1"; if (openHeight>srh) { openWidth = openWidth+16; openHeight = srh-50; } if (openWidth>srw) { openHeight = openHeight+16; openWidth = srw-50; } } srw = (srw - openWidth)/2; srh = (srh - openHeight)/5; var UTCstring; Today = new Date(); UTCstring = Today.getUTCHours()+Today.getUTCMinutes()+Today.getUTCSeconds()+Today.getTime(); var openName; openName = "openPopup"+UTCstring; openParameters = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars="+openScroll+",titlebar=1,resizable=0"; switch(openSwitch) { case "print": openParameters = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars=1,titlebar=1,resizable=0,menubar=1"; break; case "scroll": openParameters = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars=1,titlebar=1,resizable=0"; break; } var openPopup = open(openUrl, openName, openParameters); return false; } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop; obj = obj.offsetParent; } } else if (obj.y) { curtop += obj.y; } return curtop; } function doSort($sort) { document.fList.sort.value = (document.fList.sort.value == $sort) ? $sort+"-" : $sort; document.fList.submit(); return false; } function trimString(str) { while (str.charAt(0) == ' ') str = str.substring(1); while (str.charAt(str.length - 1) == ' ') str = str.substring(0, str.length - 1); return str; } function formActivate($form) { $($form).find(".text").bind("blur focus", function(e) { switch (e.type) { case "blur": $(this).toggleClass("act", 0); if (!this.value) { this.value = trimString(this.title); } break; case "focus": $(this).toggleClass("act", 1); if (trimString(this.value) == trimString(this.title)) { this.value = ""; } break; } this.value = trimString(this.value); return true; }); $($form).find(".text").each(function($i){ if (!this.value) { this.value = this.title; } }); } /* AJAX */ function tryLogin($form) { jQuery.post("/tools/login.php", $($form).serialize(), function($html) { $("#fAuth").html($html); }, "html"); return false; }; /* onload shit */ $(document).ready(function(){ $(document).focus(); $("FORM").each(function($i){ formActivate(this); }); if (!$("IMG#indicator").length) { $("BODY") .append( $('') .attr("id", "indicator") .attr("src", "images/indicator.gif") .hide() ); } }); function showIndicator($target) { // overlay $($target).parent().css("position", "relative"); $("
") .attr("id", "overlay") // .css("top", $($target).parent().offset().top) // .css("left", $($target).parent().offset().left) .css("top", 0) .css("left", 0) .width($($target).parent().width()) .height($($target).parent().height()) .appendTo($($target).parent()) ; /* var $top = $($target).offset().top + 5; var $left = $($target).offset().left + $($target).width() - 1; $("IMG#indicator") .css("position", "absolute") .css("top", $top+"px") .css("left", $left+"px") .show() ; */ } function hideIndicator() { // $("IMG#indicator").hide(); $("DIV#overlay").remove(); } var $urlCall = '/tools/call.php'; var $baseURL = dirname(location.href) + "/" + basename(location.href); $baseURL = $baseURL.split(document.domain)[1] . replace(/^\/+/g, ''); function module($mId, $eId, $sUrl, $callback) { // showIndicator($eId + " H1"); // $sUrl = $urlCall + ($sUrl ? $sUrl : ''); // var $sUrl = $sUrl; var $url = $sUrl ? $sUrl : $baseURL; showIndicator("DIV.main H1"); $.get($urlCall, { // eto URL na rasparku url: $url, // eto module, kotorij nado pozvatj mid: $mId }, function($data) { hideIndicator(); $($eId).html($data); if ($callback) { eval($callback); } }); return false; } function basename(path) { return path.replace(/\\/g,'/').replace( /.*\//, '' ); } function dirname(path) { return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, ''); } function nofilter(path) { return path.replace(/(\/[^\/]+:[^\/]+)/ig, ''); } function fileext(path) { return basename(path).replace(/[^.]+[\s\S]([\s\S]*)/g, '$1'); }