$(document).ready(function(){
		
    //MATERIAL SETS
    $('.mat_switch_new').click(function() {
        var temp_link = $(this).attr("id");
        var hash_id = temp_link.replace("link_", "");
        $('#photo_sets_container').children().fadeOut();
        $('#photo_set_'+hash_id).delay(200).fadeIn();
        $('#stone_internet_id').text(hash_id);
        $('#form_mat_id').val(hash_id);
        window.location.hash = $(this).attr("href");
        $('.mat_switch2').children().children().removeClass('selected');
        $(this).addClass('selected');
        $('#photo_sets_container .image_large').delay(500).fadeIn().css('zIndex','100');
        var button = $('.add_remove_fav');
        button.attr('id', 'fav_4_'+hash_id);
        
        $.getJSON('../../include/favorites.php?action=check&id=fav_4_'+hash_id, function(material) {
            if(material.present){
                button.removeClass("add_to_favorites");
                button.addClass("remove_from_favorites");
            }
            else{
                button.removeClass("remove_from_favorites");
                button.addClass("add_to_favorites");
            }
        });
        return false;
    });
    
    // materials mouseover
    $('.mat_box2').mouseover(function() {
         $(this).children("a").css('color', '#990000');
         $(this).addClass('mat_box2_over');
    });
    $('.mat_box2').mouseout(function() {
         $(this).children("a").css('color', '#666666');
         $(this).removeClass('mat_box2_over')
    });
    
    
    //footer loc_links
    $('.loc_link').mouseover(function() {
         $(':first', this).children(".dir").show();
    });
    $('.loc_link').mouseout(function() {
         $(':first', this).children(".dir").hide();
    });

    
    // FAQ
    $('.quest').click(function() {
        if ($(this).parent().is('.open')){
            $(this).parent().children(".ans").stop(true, true).slideUp();
            $(this).parent().removeClass("open");
        } else{
            $(this).parent().children(".ans").stop(true, true).slideDown();
            $(this).parent().addClass("open");
        }
    });
    
    $('#faq .header a').click(function() {
        $(this).toggleClass("close");
        if ($(this).is('.close')){
            var qa_box = $(this).parent().parent().children(".qa_box");
            qa_box.children(".ans").stop(true, true).slideDown();
            qa_box.addClass("open");
        } else{
            var qa_box = $(this).parent().parent().children(".qa_box");
            qa_box.children(".ans").stop(true, true).slideUp();
            qa_box.removeClass("open");
        }
    });
    
    
    // MrStone Slider
    $("#mrstone-slider").easySlider({
        auto: true,
        continuous: true,
        pause: 8000,
        prevId: 'mrstone_prev',
        prevText: '',
        nextId: 'mrstone_next',
        nextText: ''
    });
    
    
    // SHADOWBOX
    var fav_href = 'my-selection'; 
    var href = window.location.href;
    var hrefArray = href.split('/');
        // separate init for favorites
    if(jQuery.inArray(fav_href, hrefArray) > -1){
        Shadowbox.init({
            overlayOpacity:     0.9,
            slideshowDelay:      5,
            continuous:         true
        });
        
    }else{
        Shadowbox.init({
            overlayOpacity:     0.9,
            flashVars: {
            skin: 'http://www.marble.com/theme/js/overlay.swf',
            plugins: 'gapro-1',
            dock: true,
            frontcolor: 'ffffff',
            lightcolor: 'cc9900',
            controlbar: 'over',
            bufferlength: '5',
            stretching: 'fill'},
            onOpen: function(y){ $("#wpcumuluswidgetcontent").hide(); },
            onClose: function(y){ $("#wpcumuluswidgetcontent").fadeIn(2000); }
        });   
    }
    
    // ZIP CODE FORM
    $('#zipcode_estimate').setDefaultValue();
});


function switch_tab_info(s) {
    if(s==0){
        $('#mat_info_technical').hide();    
        $('#mat_info_description').show();    
    }
    else
    {
        $('#mat_info_technical').show();    
        $('#mat_info_description').hide();    
    }
}

//MATERIAL MENU

function mat_menu_more() {
    $('#group_one').animate({ marginLeft: '-930px' }, 1000);      
}
function mat_menu_more_instant() {
    $('#group_one').css('marginLeft', '-930px');      
}
function mat_menu_back() {
    $('#group_one').animate({ marginLeft: '0' }, 1000);       
}
//material menu main page
function mat_main_menu_more() {
    $('#group_one').animate({ marginTop: '-300px' }, 1000);      
}
function mat_main_menu_back() {
    $('#group_one').animate({ marginTop: '0' }, 1000);       
}

// MY-SLIDER - TO CHANGE
 (function ($) {
        $.fn.fadeTransition = function(options) {
          var options = $.extend({pauseTime: 5000, transitionTime: 2000}, options);
          var transitionObject;

          Trans = function(obj) {
            var timer = null;
            var current = 0;
            var els = $("> *", obj).css("display", "none").css("left", "0").css("top", "0").css("position", "absolute");
            $(obj).css("position", "relative");             
            $(els[current]).css("display", "block");

            function transition(next) {
              $(els[current]).fadeOut(options.transitionTime);
              $(els[next]).fadeIn(options.transitionTime);
              current = next;
              cue();
            };

            function cue() {
              if ($("> *", obj).length < 2) return false;
              if (timer) clearTimeout(timer);
              timer = setTimeout(function() { transition((current + 1) % els.length | 0)} , options.pauseTime);
            };
            
            this.showItem = function(item) {
              if (timer) clearTimeout(timer);
              transition(item);
            };

            cue();
          }

          this.showItem = function(item) {
            transitionObject.showItem(item);
          };

          return this.each(function() {
            transitionObject = new Trans(this);
          });
        }

      })(jQuery);
    
      var page = {
        tr_a: null,
        init: function() {
          page.tr_a = $("#slider_620x300").fadeTransition({pauseTime: 8000, transitionTime: 1000});
          $("div.navigation_a").each(function() {
            $(this).children().each( function(idx) {
              if ($(this).is("div.pag"))
                $(this).click(function() { page.tr_a.showItem(idx); })
            });
          });
        },

        show: function(idx) {
          if (page.tr_a.timer) clearTimeout(page.tr_a.timer);
          page.tr.showItem(idx);
        }
      };
      
      
      
var openTutorial = function(){ 
Shadowbox.open({ 
        content:    '/v/v/v/company/estimate_tutorial.flv',
        player:     "flv",
        title:      "Instant Quote Tool - Tutorial",
        height:     406,
        width:      720
    }); 
};
      
      
      
      
      
      $(document).ready(page.init);

// END OF MY-SLIDER





// RATING
var Behaviour = {
    list : new Array,
    
    register : function(sheet){
        Behaviour.list.push(sheet);
    },
    
    start : function(){
        Behaviour.addLoadEvent(function(){
            Behaviour.apply();
        });
    },
    
    apply : function(){
        for (h=0;sheet=Behaviour.list[h];h++){
            for (selector in sheet){
                list = document.getElementsBySelector(selector);
                
                if (!list){
                    continue;
                }

                for (i=0;element=list[i];i++){
                    sheet[selector](element);
                }
            }
        }
    },
    
    addLoadEvent : function(func){
        var oldonload = window.onload;
        
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
                oldonload();
                func();
            }
        }
    }
}

Behaviour.start();


function getAllChildren(e) {
  // Returns all children of element. Workaround required for IE5/Windows. Ugh.
  return e.all ? e.all : e.getElementsByTagName('*');
}

document.getElementsBySelector = function(selector) {
  // Attempt to fail gracefully in lesser browsers
  if (!document.getElementsByTagName) {
    return new Array();
  }
  // Split selector in to tokens
  var tokens = selector.split(' ');
  var currentContext = new Array(document);
  for (var i = 0; i < tokens.length; i++) {
    token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
    if (token.indexOf('#') > -1) {
      // Token is an ID selector
      var bits = token.split('#');
      var tagName = bits[0];
      var id = bits[1];
      var element = document.getElementById(id);
      if (tagName && element.nodeName.toLowerCase() != tagName) {
        // tag with that ID not found, return false
        return new Array();
      }
      // Set currentContext to contain just this element
      currentContext = new Array(element);
      continue; // Skip to next token
    }
    if (token.indexOf('.') > -1) {
      // Token contains a class selector
      var bits = token.split('.');
      var tagName = bits[0];
      var className = bits[1];
      if (!tagName) {
        tagName = '*';
      }
      // Get elements matching tag, filter them for class selector
      var found = new Array;
      var foundCount = 0;
      for (var h = 0; h < currentContext.length; h++) {
        var elements;
        if (tagName == '*') {
            elements = getAllChildren(currentContext[h]);
        } else {
            elements = currentContext[h].getElementsByTagName(tagName);
        }
        for (var j = 0; j < elements.length; j++) {
          found[foundCount++] = elements[j];
        }
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      for (var k = 0; k < found.length; k++) {
        if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
          currentContext[currentContextIndex++] = found[k];
        }
      }
      continue; // Skip to next token
    }
    // Code to deal with attribute selectors
    if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
      var tagName = RegExp.$1;
      var attrName = RegExp.$2;
      var attrOperator = RegExp.$3;
      var attrValue = RegExp.$4;
      if (!tagName) {
        tagName = '*';
      }
      // Grab all of the tagName elements within current context
      var found = new Array;
      var foundCount = 0;
      for (var h = 0; h < currentContext.length; h++) {
        var elements;
        if (tagName == '*') {
            elements = getAllChildren(currentContext[h]);
        } else {
            elements = currentContext[h].getElementsByTagName(tagName);
        }
        for (var j = 0; j < elements.length; j++) {
          found[foundCount++] = elements[j];
        }
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      var checkFunction; // This function will be used to filter the elements
      switch (attrOperator) {
        case '=': // Equality
          checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
          break;
        case '~': // Match one of space seperated words 
          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
          break;
        case '|': // Match start with value followed by optional hyphen
          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
          break;
        case '^': // Match starts with value
          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
          break;
        case '$': // Match ends with value - fails with "Warning" in Opera 7
          checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
          break;
        case '*': // Match ends with value
          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
          break;
        default :
          // Just test for existence of attribute
          checkFunction = function(e) { return e.getAttribute(attrName); };
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      for (var k = 0; k < found.length; k++) {
        if (checkFunction(found[k])) {
          currentContext[currentContextIndex++] = found[k];
        }
      }
      // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
      continue; // Skip to next token
    }
    
    if (!currentContext[0]){
        return;
    }
    
    // If we get here, token is JUST an element (not a class or ID selector)
    tagName = token;
    var found = new Array;
    var foundCount = 0;
    for (var h = 0; h < currentContext.length; h++) {
      var elements = currentContext[h].getElementsByTagName(tagName);
      for (var j = 0; j < elements.length; j++) {
        found[foundCount++] = elements[j];
      }
    }
    currentContext = found;
  }
  return currentContext;
}



var xmlhttp
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
      try {
      xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")
     } catch (e) {
      try {
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
      } catch (E) {
       xmlhttp=false
      }
     }
    @else
     xmlhttp=false
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
     try {
      xmlhttp = new XMLHttpRequest();
     } catch (e) {
      xmlhttp=false
     }
    }
    function myXMLHttpRequest() {
      var xmlhttplocal;
      try {
        xmlhttplocal= new ActiveXObject("Msxml2.XMLHTTP")
     } catch (e) {
      try {
        xmlhttplocal= new ActiveXObject("Microsoft.XMLHTTP")
      } catch (E) {
        xmlhttplocal=false;
      }
     }

    if (!xmlhttplocal && typeof XMLHttpRequest!='undefined') {
     try {
      var xmlhttplocal = new XMLHttpRequest();
     } catch (e) {
      var xmlhttplocal=false;
      alert('couldn\'t create xmlhttp object');
     }
    }
    return(xmlhttplocal);
}

function sndReq(vote,id_num) {
    var theUL = document.getElementById('rating_box'); // the UL
    
    // switch UL with a loading div
    theUL.innerHTML = '<div style="font:12px Arial;color:white;width:100px;">Voting</div>';
    
    xmlhttp.open('get', 'http://www.marble.com/include/drawrating_rpc.php?j='+vote+'&q='+id_num);
    xmlhttp.onreadystatechange = handleResponse;
    xmlhttp.send(null);    
}

function handleResponse() {
  if(xmlhttp.readyState == 4){
        if (xmlhttp.status == 200){
           
        var response = xmlhttp.responseText;
        var update = new Array();

        if(response.indexOf('|') != -1) {
            update = response.split('|');
            changeText(update[0], update[1]);
        }
        }
    }
}

function changeText( div2show, text ) {
    // Detect Browser
    var IE = (document.all) ? 1 : 0;
    var DOM = 0; 
    if (parseInt(navigator.appVersion) >=5) {DOM=1};

    // Grab the content from the requested "div" and show it in the "container"
    if (DOM) {
        var viewer = document.getElementById(div2show);
        viewer.innerHTML = text;
    }  else if(IE) {
        document.all[div2show].innerHTML = text;
    }
}

/* =============================================================== */
var ratingAction = {
        'a.rater' : function(element){
            element.onclick = function(){

            var parameterString = this.href.replace(/.*\?(.*)/, "$1"); // onclick="sndReq('j=1&q=2&t=127.0.0.1&c=5');
            var parameterTokens = parameterString.split("&"); // onclick="sndReq('j=1,q=2,t=127.0.0.1,c=5');
            var parameterList = new Array();

            for (j = 0; j < parameterTokens.length; j++) {
                var parameterName = parameterTokens[j].replace(/(.*)=.*/, "$1"); // j
                var parameterValue = parameterTokens[j].replace(/.*=(.*)/, "$1"); // 1
                parameterList[parameterName] = parameterValue;
            }
            var theratingID = parameterList['q'];
            var theVote = parameterList['j'];
            
            //for testing    alert('sndReq('+theVote+','+theratingID+','+theuserIP+','+theunits+')'); return false;
            sndReq(theVote,theratingID); return false;        
            }
        }
        
    };
Behaviour.register(ratingAction);



// END RATING 



// DEFAULT VALUE FOR INPUT TEXT - START
$.fn.setDefaultValue = function(options){
    var options = $.extend({css : 'txt_default'}, options);
    return this.each(function(){
        var $this = $(this);
        var value = $this.attr('title');
        $(this).attr('autocomplete','off');
        
        if($this.val().length <= 0 || $this.val() == value){
            $this.addClass(options.css);
            $this.val(value);
        }
        $this.click(clear);
        $this.blur(fill);
        $this.focus(clear).blur();
        
        function clear(){
            if($this.hasClass(options.css) || $this.val() == value){
                $this.val('');
                $this.removeClass(options.css);
            }
        }
        
        function fill(){
            if($this.val().length <= 0){
                $this.addClass(options.css);
                $this.val(value);
            }
        }
        $(window).unload(clear); // Firefox-Autocomplete
    });  
};
// DEFAULT VALUE FOR INPUT TEXT - END







// Easy Slider
(function($) {

    $.fn.easySlider = function(options){
      
        // default configuration properties
        var defaults = {            
            prevId:         'prevBtn',
            prevText:         'Previous',
            nextId:         'nextBtn',    
            nextText:         'Next',
            controlsShow:    true,
            controlsBefore:    '',
            controlsAfter:    '',    
            controlsFade:    true,
            firstId:         'firstBtn',
            firstText:         'First',
            firstShow:        false,
            lastId:         'lastBtn',    
            lastText:         'Last',
            lastShow:        false,                
            vertical:        false,
            speed:             800,
            auto:            false,
            pause:            2000,
            continuous:        false, 
            numeric:         false,
            numericId:         'controls'
        }; 
        
        var options = $.extend(defaults, options);  
                
        this.each(function() {  
            var obj = $(this);                 
            var s = $("li", obj).length;
            var w = $("li", obj).width(); 
            var h = $("li", obj).height(); 
            var clickable = true;
            obj.width(w); 
            obj.height(94); // na sztywno wpisana wysokosc
            obj.css("overflow","hidden");
            var ts = s-1;
            var t = 0;
            $("ul", obj).css('width',s*w);            
            
            if(options.continuous){
                $("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
                $("ul", obj).append($("ul li:nth-child(2)", obj).clone());
                $("ul", obj).css('width',(s+1)*w);
            };                
            
            if(!options.vertical) $("li", obj).css('float','left');
                                
            if(options.controlsShow){
                var html = options.controlsBefore;                
                if(options.numeric){
                    html += '<ol id="'+ options.numericId +'"></ol>';
                } else {
                    if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
                    html += ' <span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
                    html += ' <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
                    if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';                
                };
                
                html += options.controlsAfter;                        
                $(obj).after(html);                                        
            };
            
            if(options.numeric){                                    
                for(var i=0;i<s;i++){                        
                    $(document.createElement("li"))
                        .attr('id',options.numericId + (i+1))
                        .html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>')
                        .appendTo($("#"+ options.numericId))
                        .click(function(){                            
                            animate($("a",$(this)).attr('rel'),true);
                        });                                                 
                };                            
            } else {
                $("a","#"+options.nextId).click(function(){        
                    animate("next",true);
                });
                $("a","#"+options.prevId).click(function(){        
                    animate("prev",true);                
                });    
                $("a","#"+options.firstId).click(function(){        
                    animate("first",true);
                });                
                $("a","#"+options.lastId).click(function(){        
                    animate("last",true);                
                });                
            };
            
            function setCurrent(i){
                i = parseInt(i)+1;
                $("li", "#" + options.numericId).removeClass("current");
                $("li#" + options.numericId + i).addClass("current");
            };
            
            function adjust(){
                if(t>ts) t=0;        
                if(t<0) t=ts;    
                if(!options.vertical) {
                    $("ul",obj).css("margin-left",(t*w*-1));
                } else {
                    $("ul",obj).css("margin-left",(t*h*-1));
                }
                clickable = true;
                if(options.numeric) setCurrent(t);
            };
            
            function animate(dir,clicked){
                if (clickable){
                    clickable = false;
                    var ot = t;                
                    switch(dir){
                        case "next":
                            t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1;                        
                            break; 
                        case "prev":
                            t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1;
                            break; 
                        case "first":
                            t = 0;
                            break; 
                        case "last":
                            t = ts;
                            break; 
                        default:
                            t = dir;
                            break; 
                    };    
                    var diff = Math.abs(ot-t);
                    var speed = diff*options.speed;                        
                    if(!options.vertical) {
                        p = (t*w*-1);
                        $("ul",obj).animate(
                            { marginLeft: p }, 
                            { queue:false, duration:speed, complete:adjust }
                        );                
                    } else {
                        p = (t*h*-1);
                        $("ul",obj).animate(
                            { marginTop: p }, 
                            { queue:false, duration:speed, complete:adjust }
                        );                    
                    };
                    
                    if(!options.continuous && options.controlsFade){                    
                        if(t==ts){
                            $("a","#"+options.nextId).hide();
                            $("a","#"+options.lastId).hide();
                        } else {
                            $("a","#"+options.nextId).show();
                            $("a","#"+options.lastId).show();                    
                        };
                        if(t==0){
                            $("a","#"+options.prevId).hide();
                            $("a","#"+options.firstId).hide();
                        } else {
                            $("a","#"+options.prevId).show();
                            $("a","#"+options.firstId).show();
                        };                    
                    };                
                    
                    if(clicked) clearTimeout(timeout);
                    if(options.auto && dir=="next" && !clicked){;
                        timeout = setTimeout(function(){
                            animate("next",false);
                        },diff*options.speed+options.pause);
                    };
            
                };
                
            };
            // init
            var timeout;
            if(options.auto){;
                timeout = setTimeout(function(){
                    animate("next",false);
                },options.pause);
            };        
            
            if(options.numeric) setCurrent(0);
        
            if(!options.continuous && options.controlsFade){                    
                $("a","#"+options.prevId).hide();
                $("a","#"+options.firstId).hide();                
            };                
            
        });
      
    };

})(jQuery);
// end of easy slider
      

/// paging


    function change_page(id, max) {
        if(id == 1) $('#prev').hide();
        else $('#prev').show();
        if(id == max) $('#next').hide();
        else $('#next').show();
        $('#'+id).addClass('this-page');
        $('#'+id).siblings().removeClass('this-page');
        $('#page'+id).siblings().hide();
        $('#page'+id).delay('100').show();
    }   
    function change_page_next(max) {
        current = $(".this-page").text();
        if(current < max) {
            $(".this-page").removeClass("this-page");
            next = Number(current) + 1;
            if(next == max) $('#next').hide();
            if(next > 1) $('#prev').show();
            $('#'+next).addClass('this-page');    
            $('#page'+next).siblings().hide();
            $('#page'+next).delay('100').show();
        }
    }
    function change_page_prev(max) {
        current = $(".this-page").text();
        if(current > 1) {
            $(".this-page").removeClass("this-page");
            prev = Number(current) - 1;
            if(prev == 1) $('#prev').hide();
            if(prev < max) $('#next').show();
            $('#'+prev).addClass('this-page');    
            $('#page'+prev).siblings().hide();
            $('#page'+prev).delay('100').show();
        }
    }    

    $(document).ready(function(){
    //$('.header_underline').hide();
        $('#postcomment').click(function(){
            $('.header_underline').animate({
                height: '300px'
            },1000, function(){
                $('#cancelcomment').fadeIn('fast');
            });
        });
        
        $('#cancelcomment').click(function(){
            $('.header_underline').animate({
                height: '1px'
            },1000, function(){
                $('#cancelcomment').fadeOut('fast');
            });
        }); 
    }); 

    //end paging

(function(a){a.fn.extend({reflect:function(b){b=a.extend({height:1/3,opacity:0.5},b);return this.unreflect().each(function(){var c=this;if(/^img$/i.test(c.tagName)){function d(){var g=c.width,f=c.height,l,i,m,h,k;i=Math.floor((b.height>1)?Math.min(f,b.height):f*b.height);l=a("<canvas />")[0];if(l.getContext){h=l.getContext("2d");try{a(l).attr({width:g,height:i});h.save();h.translate(0,f-1);h.scale(1,-1);h.drawImage(c,0,0,g,f);h.restore();h.globalCompositeOperation="destination-out";k=h.createLinearGradient(0,0,0,i);k.addColorStop(0,"rgba(255, 255, 255, "+(1-b.opacity)+")");k.addColorStop(1,"rgba(255, 255, 255, 1.0)");h.fillStyle=k;h.rect(0,0,g,i);h.fill()}catch(j){return}}else{if(!a.browser.msie){return}l=a("<img />").attr("src",c.src).css({width:g,height:f,marginBottom:i-f,filter:"FlipV progid:DXImageTransform.Microsoft.Alpha(Opacity="+(b.opacity*100)+", FinishOpacity=0, Style=1, StartX=0, StartY=0, FinishX=0, FinishY="+(i/f*100)+")"})[0]}a(l).css({display:"block",border:0});m=a(/^a$/i.test(c.parentNode.tagName)?"<span />":"<div />").insertAfter(c).append([c,l])[0];m.className=c.className;a.data(c,"reflected",m.style.cssText=c.style.cssText);a(m).css({width:g,height:f+i,overflow:"hidden"});c.style.cssText="display: block; border: 0px";c.className="reflected"}if(c.complete){d()}else{a(c).load(d)}}})},unreflect:function(){return this.unbind("load").each(function(){var c=this,b=a.data(this,"reflected"),d;if(b!==undefined){d=c.parentNode;c.className=d.className;c.style.cssText=b;a.removeData(c,"reflected");d.parentNode.replaceChild(c,d)}})}})})(jQuery);
