jQuery.fn.WG_Scroller = function(options) {
	var settings = {
	       interval:  0,    // Dont touch !
	       refresh:   150,  // Refresh Time in ms
	       direction: "up", // down,right,left,up
	       speed:     1,    // Set the Scroller Speed
	       id:        "div#scroller",
	       cont_id:   "div#scroller_container"
	};
	//if(options) {
	//	jQuery.extend(settings, options);
	//}
	options = jQuery.extend(settings, options), jscroller_scroller = $(options.id), jscroller_scroller_cont = $(options.cont_id);

	for(i = 0; i < 3; i++){
		jscroller_scroller.html(jscroller_scroller.html() + jscroller_scroller.html());
	}


			  if (jscroller_scroller && jscroller_scroller_cont) {
			      jscroller_scroller.css({position: 'absolute', left: 0, top: 0});
			      jscroller_init();
			   }

			   function jscroller_startScroll() {
			     if(!options.interval) {
			      options.interval=window.setInterval(jscroller_doScroll,options.refresh);
			     }
			   }

			   function jscroller_stopScroll() {
			     if (options.interval) {
			      window.clearInterval(options.interval);
			      options.interval=0;
			     }
			   }

			   function jscroller_init() {
			    $("#scroller a").click(function(){
			      //window.open(this.href);
			      return false;
			    });
			    jscroller_scroller_cont.css('overflow','hidden');
			    if(!options.interval) {
			      if (window.attachEvent) {
			       window.attachEvent("onfocus", jscroller_startScroll);
			       window.attachEvent("onblur",  jscroller_stopScroll);
			       window.attachEvent("onresize", jscroller_startScroll);
			       window.attachEvent("onscroll", jscroller_startScroll);
			      }
			      else if (window.addEventListener) {
			       window.addEventListener("focus", jscroller_startScroll, false);
			       window.addEventListener("blur",  jscroller_stopScroll, false);
			       window.addEventListener("resize", jscroller_startScroll, false);
			       window.addEventListener("scroll", jscroller_startScroll, false);
			      }
			      jscroller_startScroll();
			      if ($.browser.msie) {window.focus()}
			     }
			   }

			   function jscroller_getElem(Elem) {
			    return (typeof Elem == "string" && document.getElementById)? document.getElementById(Elem) : Elem;
			   }

			   function jscroller_doScroll() {
			    if (scroller_dom = jscroller_getElem(jscroller_scroller.attr("id"))) {
			    	//alert(scroller_dom.tex());
			     var
			      p_top= Number((/[0-9-,.]+/.exec(jscroller_scroller.css('top'))||0)),
			      p_left=Number((/[0-9-,.]+/.exec(jscroller_scroller.css('left'))||0)),
			      min_height=jscroller_scroller_cont.height(),
			      min_width=jscroller_scroller_cont.width(),
			      speed=options.speed,
			      p_height=scroller_dom.offsetHeight,
			      p_width=scroller_dom.offsetWidth,
			      direction=options.direction,
			      jscroller=jscroller_scroller;

			     switch(direction) {
			       case 'up':
			        if (p_top <= -1*p_height) {p_top=min_height;}
			        jscroller.css('top',p_top-speed+'px');
			       break;
			       case 'right':
			        if (p_left >= min_width) {p_left=-1*p_width;}
			        jscroller.css('left',p_left+speed+'px');
			       break;
			       case 'left':
			        if (p_left <= -1*p_width) {p_left=min_width;}
			        jscroller.css('left',p_left-speed+'px');
			       break;
			       case 'down':
			        if (p_top >= min_height) {p_top=-1*p_height;}
			        jscroller.css('top',p_top+speed+'px');
			       break;
			     }
			    }
			   }


};