$(document).ready(function() { 
  
   	$('#slideshow').cycle({ 
        timeout:  4200
   	}); 
    
    offset = 1;
    
   $('img.unitPng').fixPNG();
       
    
    $('#homeslide').cycle({ 
    timeout:  5200,
	before: onBefore 
	}); 
    
 
 
});


    function onBefore(curr, next, opts) { 
        
        //$('img.unitPng').supersleight(); 
        
        // on the first pass, addSlide is undefined (plugin hasn't yet created the fn); 
        // when we're finshed adding slides we'll null it out again 
        if (!opts.addSlide) 
            return; 
 
        // on Before arguments: 
        //  curr == DOM element for the slide that is currently being displayed 
        //  next == DOM element for the slide that is about to be displayed 
        //  opts == slideshow options 
             
            $.post("/", {
   				offset: offset
   			}, function(data) {
    			//$("#homeslide").append(data);
				opts.addSlide(data); 
  		  });   
        
         
        // add our next slide 
      
    }; 
    
/* IE PNG fix multiple filters */
(function ($) {
    if (!$) return;
    $.fn.extend({
        fixPNG: function(sizingMethod, forceBG) {
                if (!($.browser.msie)) return this;
                var emptyimg = "/clear.gif"; //Path to empty 1x1px GIF goes here
                sizingMethod = sizingMethod || "scale"; //sizingMethod, defaults to scale (matches image dimensions)
                this.each(function() {
                        var isImg = (forceBG) ? false : jQuery.nodeName(this, "img"),
                                imgname = (isImg) ? this.src : this.currentStyle.backgroundImage,
                                src = (isImg) ? imgname : imgname.substring(5,imgname.length-2);
                        this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + sizingMethod + "')";
                        if (isImg) this.src = emptyimg;
                        else this.style.backgroundImage = "url(" + emptyimg + ")";
                });
                return this;
        }
    });
})(jQuery);

