 var slider, sliderCont, filter, filterCont, str, nW, nW1;
 window.onload = function() {
       //nW = $("#sliderBg").width();
       if($("#sliderBg").length){
           slider = Raphael("sliderBg", $("#sliderBg").width(), 340);
           str = "M"+ Math.floor($("#sliderBg").width()/2) +" 1L"+
               ($("#sliderBg").width()-30) +" 30C"+
               ($("#sliderBg").width()-30) +" 30 "+ ($("#sliderBg").width()-22) +" 32 "+ ($("#sliderBg").width()-20) +" 40L"+
               ($("#sliderBg").width()-1) +" 170L"+
               ($("#sliderBg").width()-20) +" 300C"+
               ($("#sliderBg").width()-20) +" 300 "+ ($("#sliderBg").width()-22) +" 308 "+ ($("#sliderBg").width()-30) +" 310L"+
               Math.floor($("#sliderBg").width()/2) +" 339L30 310C30 310 22 308 20 300L1 170L20 40C20 40 22 32 30 30z";
           sliderCont = slider.path(str)
           sliderCont.attr({fill: "url('/img/slider-bg.png')"});
       }
       
       if($("#makerInfoBg").length){
           slider = Raphael("makerInfoBg", $("#makerInfoBg").width(), 340);
           str = "M"+ Math.floor($("#makerInfoBg").width()/2) +" 1L"+
               ($("#makerInfoBg").width()-30) +" 30C"+
               ($("#makerInfoBg").width()-30) +" 30 "+ ($("#makerInfoBg").width()-22) +" 32 "+ ($("#makerInfoBg").width()-20) +" 40L"+
               ($("#makerInfoBg").width()-1) +" 170L"+
               ($("#makerInfoBg").width()-20) +" 300C"+
               ($("#makerInfoBg").width()-20) +" 300 "+ ($("#makerInfoBg").width()-22) +" 308 "+ ($("#makerInfoBg").width()-30) +" 310L"+
               Math.floor($("#makerInfoBg").width()/2) +" 339L30 310C30 310 22 308 20 300L1 170L20 40C20 40 22 32 30 30z";
           sliderCont = slider.path(str)
           sliderCont.attr({fill: "url('/img/maker-info-bg.png')",  stroke: "#fff"});
       }
       if($(".filtersContainer").length){
           $(".filtersContainer").each(function(){
                var $curCont = $(this);
                $(".filtersBg", $curCont).css({height: $curCont.height() + 80});
                filter = Raphael($(".filtersBg", $curCont)[0], 260, ($curCont.height() + 80));
                str = "M130 1L"+
               "240 30C"+
               "240 30 243 31 245 35L"+
               "259 " + Math.floor(($curCont.height() + 80)/2) + "L"+
               "245 " + ($curCont.height() + 80 - 35) + "C"+
               "245 " + ($curCont.height() + 80 - 35) + " 243 " + ($curCont.height() + 80 - 31) + " 240 " + ($curCont.height() + 80 - 30) + "L"+
               "130 " + ($curCont.height() + 80 - 1) + "L20 " + ($curCont.height() + 80 - 30) + 
               "C20 " + ($curCont.height() + 80 - 30) + " 17 " + ($curCont.height() + 80 - 31) + " 15 " + ($curCont.height() + 80 - 35) + 
               "L1 " + Math.floor(($curCont.height() + 80)/2) + "L15 35C15 35 17 31 20 30z";
               filterCont = filter.path(str)
               filterCont.attr({fill: "#fff",  stroke: "#00a8b7"});
           })
       }
       
     // jquery reflect
    if($.browser.msie && $.browser.version<9) {
        // do nothing
    }
    else {
        var reflectOptions = {
            el: ".reflect",
            height: 0.1,
            opacity: 0.4,
            distanceV: 0,
            addHeight: true,
            IEbackground: "white"
        }
        reflection(reflectOptions);
    }
       
  }
  
  $(window).resize(function(){
     if($("#sliderBg").length){
         slider.remove();
         slider = Raphael("sliderBg", $("#sliderBg").width(), 340);     
         str = "M"+ Math.floor($("#sliderBg").width()/2) +" 1L"+
               ($("#sliderBg").width()-30) +" 30C"+
               ($("#sliderBg").width()-30) +" 30 "+ ($("#sliderBg").width()-22) +" 32 "+ ($("#sliderBg").width()-20) +" 40L"+
               ($("#sliderBg").width()-1) +" 170L"+
               ($("#sliderBg").width()-20) +" 300C"+
               ($("#sliderBg").width()-20) +" 300 "+ ($("#sliderBg").width()-22) +" 308 "+ ($("#sliderBg").width()-30) +" 310L"+
               Math.floor($("#sliderBg").width()/2) +" 339L30 310C30 310 22 308 20 300L1 170L20 40C20 40 22 32 30 30z";
         sliderCont = slider.path(str)
         sliderCont.attr({fill: "url('/img/slider-bg.png')"});
     }
     
     if($("#makerInfoBg").length){
           slider.remove();
           slider = Raphael("makerInfoBg", $("#makerInfoBg").width(), 340);
           str = "M"+ Math.floor($("#makerInfoBg").width()/2) +" 1L"+
               ($("#makerInfoBg").width()-30) +" 30C"+
               ($("#makerInfoBg").width()-30) +" 30 "+ ($("#makerInfoBg").width()-22) +" 32 "+ ($("#makerInfoBg").width()-20) +" 40L"+
               ($("#makerInfoBg").width()-1) +" 170L"+
               ($("#makerInfoBg").width()-20) +" 300C"+
               ($("#makerInfoBg").width()-20) +" 300 "+ ($("#makerInfoBg").width()-22) +" 308 "+ ($("#makerInfoBg").width()-30) +" 310L"+
               Math.floor($("#makerInfoBg").width()/2) +" 339L30 310C30 310 22 308 20 300L1 170L20 40C20 40 22 32 30 30z";
           sliderCont = slider.path(str)
           sliderCont.attr({fill: "url('/img/maker-info-bg.png')",  stroke: "#fff"});
       }
     /*nW1 = $("#sliderBg").width();
     if(nW === nW1){ 
          // do nothing
     } 
     else { 
        $("body").append(nW + ' / ' + nW1 + ' # ');
        var sc = Math.floor((nW1/nW)*100)/100;
        sliderCont.scale(sc, 1, Math.floor(nW1/2), 170);
        sliderCont.translate(-(Math.floor(((nW/2) - (nW1/2))/2)),0);
        nW = nW1;
     }*/
  })



