
ph$ = {
	bindEvt : function() {
		var o_error = {};
		o_error.btn_sell_l = $("#pageLeft");
		if (o_error.btn_sell_l.length > 0) {
		    o_error.btn_sell_l.bind("click", function() {
				ph$.scrollLveSell('right');
			});
		}
		o_error.btn_sell_r = $("#pageRight");
		if (o_error.btn_sell_r.length > 0) {
			o_error.btn_sell_r.bind("click", function() {
				ph$.scrollLveSell('left');
			});
		}

	},
	scrollLveSell : function(o_error) {
		if (this.cfg.lv_flag == 0)
			return false;
		var tar = $("#sell_order");
		var tar2 = $("#sell_order_t");
		tar.stop();
		tar2.stop();
		//debugger;
		var max_num = $("#sell_order>li").length;
		var width = 175;//liΏνΆΘ
		var left = 0;
		var pos = tar.position();
		//alert(pos.left + "|" + width);
		if (o_error == "left") {
			if (Math.abs(pos.left)+width > width*(max_num-2)) {//max_num-5
			left=0;
			pos.left=width*2;
			}
			left = pos.left - width*2;
		} else if (o_error == "right") {
			if (pos.left >= 0) {
			    pos.left=0-width*max_num;
				left=pos.left-width*2;				
			}
			left = pos.left + width*2;
		}
		
		left = left + "px";
		//alert(left);
		ph$.cfg.lv_flag = 0;
		tar.animate({
			left: left
		}, 600);
		tar2.animate({
			left: left
		}, 600, function() {
			ph$.cfg.lv_flag = 1;
			//alert(pos.left);
		});
	},

	cfg : {

	},
	init : function() {
		this.bindEvt();
	}
};

jQuery(function($) {
	ph$.init();
});
