﻿var jqCounter = 0;
var jqDiff = 3;
$(function initJqAS2(){
	$(".jqAS2prev").click(function(){
		if (jqCounter > 0) {
			jqCounter -= jqDiff;
			if (jqCounter < 0) jqCounter = 0;
			$("#jqAS2 .contentArea").animate({ left:-jqCounter*parseInt($("#jqAS2 .content").css("width"))+"px" });
		}
	});
	$(".jqAS2next").click(function(){
		if (jqCounter < ($("#jqAS2 .content").length-1)) {
			jqCounter += jqDiff;
			if (jqCounter > ($("#jqAS2 .content").length-1)) jqCounter = $("#jqAS2 .content").length-1;
			$("#jqAS2 .contentArea").animate({ left:-jqCounter*parseInt($("#jqAS2 .content").css("width"))+"px" });
		}
	});
	$("#jqAS2 .content").each(function(idx, obj){
		obj.style.position = "absolute";
		obj.style.left = idx * parseInt($("#jqAS2 .content").css("width")) + "px";
		obj.style.height = parseInt($("#jqAS2 .content").css("height")) + "px";
		obj.style.overflow ="hidden";
	});
});
$(window).resize(function(){
	$("#jqAS2 .content").each(function(idx, obj){
		obj.style.left = idx * parseInt($("#jqAS2 .content").css("width")) + "px";
		obj.style.height = parseInt($("#jqAS2 .content").css("height")) + "px";
	});
	$("#jqAS2 .contentArea").css({ left:-jqCounter*parseInt($("#jqAS2 .content").css("width"))+"px" });
});
