jQuery.preloadImages = function () {
    if (typeof arguments[arguments.length - 1] == 'function') {
        var callback = arguments[arguments.length - 1];
    } else {
        var callback = false;
    }
    if (typeof arguments[0] == 'object') {
        var images = arguments[0];
        var n = images.length;
    } else {
        var images = arguments;
        var n = images.length - 1;
    }
    var not_loaded = n;
    for (var i = 0; i < n; i++) {
        jQuery(new Image()).attr('src', images[i]).load(function() {
            if (--not_loaded < 1 && typeof callback == 'function') {
                callback();
            }
        });
    }
} 

$(document).ready(function(){
// Add Scroller Object
$jScroller.add(".head_logo","#scroller","left",10, true);
// Start Autoscroller
$jScroller.start();



$("#scroller img").load(function(){
  if ((jQuery.browser.msie == true)&&(jQuery.browser.version ==6) && ($(this).attr("src").indexOf("x.gif")==-1)){ 
      $(this).css("height","");
      $(this).css("width","");
      $(this).css("height",this.height);
      $(this).css("width",this.width);
      if(this.height==40)
      $(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).attr("src").replace("r=0,30_image","r=0,40_image")+"')");
      else
      $(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).attr("src").replace("r=0,40_image","r=0,30_image")+"')");
      $(this).attr("rel",$(this).attr("src"));
      $(this).attr("src","/images/x.gif");
  }
});

$("#scroller img").hover(
function(){
if ((jQuery.browser.msie == true)&&(jQuery.browser.version ==6)){ 
$(this).attr("src",$(this).attr("rel").replace("r=0,30_image","r=0,40_image"));
}else $(this).attr("src",$(this).attr("src").replace("r=0,30_image","r=0,40_image"));
$(this).height(40).parent().css("margin-top","0");
},
function(){
if ((jQuery.browser.msie == true)&&(jQuery.browser.version ==6)){ 
$(this).attr("src",$(this).attr("rel").replace("r=0,40_image","r=0,30_image"));
}else $(this).attr("src",$(this).attr("src").replace("r=0,40_image","r=0,30_image"));
$(this).height(30).parent().css("margin-top","0");
});

$("#scroller img").removeAttr("width").removeAttr("height").css("cursor","pointer");
//.css("width","").css("height","");
jQuery.each($("#scroller img"), function() {
  $.preloadImages($(this).attr("src").replace("r=0,30_image","r=0,40_image"));
  if ((jQuery.browser.msie == true)&&(jQuery.browser.version ==6) && ($(this).attr("src").indexOf("x.gif")==-1)){ 
  $(this).css("height",this.height);
  $(this).css("width",this.width);
  $(this).css("filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+$(this).attr("src")+"')");
  $(this).attr("rel",$(this).attr("src"));
  $(this).attr("src","/images/x.gif");
 
  }
});

addimg(0);
});

function addimg(count)
{
$("#scroller a").eq(count).clone(true).appendTo("#scroller p");
$("#scroller").css("width",$("#scroller").width()+200);
count++;
if(count==50){
    $("#scroller a").slice(0, count-10).remove();
    $("#scroller").css("width","4000");
    $("#scroller").css("left","0");
    count=1;
}
setTimeout(function(){addimg(count)},1100);
}
