var issue = 2;
var duration = 600;
var leftOffset = -25;
var thisXML = '';
var vars = { XMLSource:'xml/images_F09.xml' };
var params = { scale:'noScale', salign:'lt', menu:'true', bgcolor:'#000000', XMLSource:'xml/images_F09.xml' };
var attributes = { id:'testObject', name:'testObject' }; // give an id to the flash object

$(document).ready(function(){
	
var countIssues = $("#issueSlider a").size();

	$(".sliderArrow").hover(
		function(){
			$(this).stop().animate({
				opacity:1
		      }, duration);
		},
		function(){
			$(this).stop().animate({
				opacity:0
		      }, duration);
		}
	);
	
	$("#rightArrow").click(function(){
		if (issue < countIssues){
			issue++;
			$(".currentIssue").removeClass("currentIssue").stop();
		
		
			$("#issueSlider a:nth-child("+issue+") img").addClass("currentIssue").stop();
		
			leftOffset -= 200;
			$("#issueSlider").stop().animate({
				left:(leftOffset)
		    }, duration);
		}
		else {
			$("#issueSlider").stop().animate({
				left:(leftOffset +10)
		    }, 75)	.animate({
				left:(leftOffset -10)
			}, 150)	.animate({
				left:(leftOffset)
			}, 75);
		}
	});
	
	$("#leftArrow").click(function(){
		if (issue > 1){
			issue--;
			$(".currentIssue").removeClass("currentIssue").stop();
		
		
			$("#issueSlider a:nth-child("+issue+") img").addClass("currentIssue").stop();
		
			leftOffset += 200;
			$("#issueSlider").stop().animate({
				left:(leftOffset)
		    }, duration);
		}
		else {
			$("#issueSlider").stop().animate({
				left:(leftOffset +10)
		    }, 75)	.animate({
				left:(leftOffset -10)
			}, 150)	.animate({
				left:(leftOffset)
			}, 75);
		}
	});
	
	$("#issueSlider a").click(function(){
		
		thisXML = $(this).attr("rel");
		
		var vars = { XMLSource:thisXML };
		var params = { scale:'noScale', salign:'lt', menu:'true', bgcolor:'#000000', XMLSource:thisXML };
		var attributes = { id:'flashContent', name:'testObject' }; // give an id to the flash object

		swfobject.embedSWF("wall.swf", "flashContent", "858", "345", "9.0.0", "js/expressInstall.swf", vars, params, attributes );
	
	
		return false;
	});
	
});
