jQuery.fn.shiftViewport = function(dx, dy, duration){
	duration = duration == undefined ? 500:duration;
	if (this[0].p == undefined) this[0].p = { x:0, y:0 };
	this[0].p.x -= dx;
	this[0].p.y -= dy; 	
 	this.children().eq(0).animate({left:this[0].p.x, top:this[0].p.y}, duration);
}

jQuery.fn.shiftLeftChild = function(duration,vis){
	duration = duration == undefined ? 500:duration;
	vis = vis || 1;
	if (this[0].p == undefined) this[0].p = 0;
	var ch = this.children().eq(0).children();
	if (this[0].p == ch.length - vis) return false;
	this[0].p++;
	this.children().eq(0).animate({left:-ch[this[0].p].offsetLeft}, duration);
	return (this[0].p == ch.length - vis ? false : true);
}

jQuery.fn.shiftRightChild = function(duration){
	duration = duration == undefined ? 500:duration;
	if (this[0].p == undefined) this[0].p = 0;
	var ch = this.children().eq(0).children();
	if (this[0].p == 0) return false;
	this[0].p--;
	this.children().eq(0).animate({left:-ch[this[0].p].offsetLeft}, duration);
	return (this[0].p == 0 ? false : true);
}
jQuery.fn.shiftTopChild = function(duration,vis){
	duration = duration == undefined ? 500:duration;
	vis = vis || 1;
	if (this[0].p == undefined) this[0].p = 0;
	var ch = this.children().eq(0).children();
	if (this[0].p == ch.length - vis) return false;
	this[0].p++;
	this.children().eq(0).animate({top:-ch[this[0].p].offsetTop}, duration);
	return (this[0].p == ch.length - vis ? false : true);
}
jQuery.fn.shiftBottomChild = function(duration){
	duration = duration == undefined ? 500:duration;
	if (this[0].p == undefined) this[0].p = 0;
	var ch = this.children().eq(0).children();
	if (this[0].p == 0) return false;
	this[0].p--;
	this.children().eq(0).animate({top:-ch[this[0].p].offsetTop}, duration);
	return (this[0].p == 0 ? false : true);
}

jQuery.fn.prevFrameH = function(lb,rb,duration){
	rb.className = 'enabled';
	if (!this.shiftRightChild(duration)) lb.className = 'disabled';
}
jQuery.fn.nextFrameH = function(rb,lb,duration,vis){
	lb.className = 'enabled';
	if (!this.shiftLeftChild(duration,vis)) rb.className = 'disabled';
}

jQuery.fn.prevFrameV = function(tb,bb,duration){
	bb.className = 'enabled';
	if (!this.shiftBottomChild(duration)) tb.className = 'disabled';	
}
jQuery.fn.nextFrameV = function(bb,tb,duration,vis){
	tb.className = 'enabled';
	if (!this.shiftTopChild(duration,vis)) bb.className = 'disabled';	
}
