function xxlMarquee(args){
      	if(!args){
      		this.postNum		= 4;
      		this.changeSpeed 	= 6000;
      		this.imgHeight 	= 350;
				this.headlineWidth= 200;
      	}else{
				this.postNum 		= (typeof args.postNum == 'undefined') ? 			4 			: args.postNum-1;
      		this.changeSpeed 	= (typeof args.changeSpeed == 'undefined') ? 	6000 		: args.changeSpeed;
      		this.imgHeight 	= (typeof args.imgHeight == 'undefined') ? 		350 		: args.imgHeight;
				this.headlineWidth= (typeof args.headlineWidth == 'undefined') ? 	200 		: args.headlineWidth;
      	}

      	// define for local use
			postNum		= this.postNum;
      	changeSpeed = this.changeSpeed;
      	imgHeight = this.imgHeight;
			headlineWidth = this.headlineWidth
			this.slideSpeed 	= this.changeSpeed / 16;
      	slideSpeed  = this.slideSpeed;

      }
      
      xxlMarquee.prototype.animate = function(){
			jQuery.easing.def = "easeInOutCirc";
			if($("#image-slider").height()>350){
				var curTitle = $("#marquee-nav .active").attr("title");
				var nextTitle = parseInt(curTitle) + 1;
			
				if(curTitle<postNum){
					// FIX THIS FOR IE must come up with an equation
					var curPos = $("#image-slider").css("top");
					var nextPos = parseInt(curPos)-imgHeight;
					
		         $("#image-slider").animate({"top":nextPos},slideSpeed,function(){ 
						curTitle++;
						$("#marquee-nav .active").removeClass("active");
						$("#marquee-nav li#slide-nav-"+curTitle).addClass("active");
					
		  			});
				}else{
					$("#image-slider").animate({top:0},slideSpeed*2,function(){
					
					});
					curTitle=0;
					nextTitle = 0;
					$("#marquee-nav .active").removeClass("active");
					$("#marquee-nav li#slide-nav-"+curTitle).addClass("active");
				}
				
				// For headline animatin
				
				var hlPos = headlineWidth*(-1);
				hlPos = hlPos.toString();
				hlPos = hlPos+"px";
				
				$("#headline").animate({"left" : hlPos,"opacity": "toggle"},slideSpeed/1.5,function(){
						$("#headline a").html(jsMarqueeData[nextTitle]["postTitle"]);
						$("#headline p").html(jsMarqueeData[nextTitle]["postExcerpt"]);
						$("#headline a").attr("href",jsMarqueeData[nextTitle]["postLink"]);
						$("#headline").animate({"left": "0px","opacity": "toggle"},slideSpeed/2.5,function(){});
				});
		}
	}

xxlMarquee.prototype.init = function (){
	
	// appends images to image-slider div after document loads
	$(function(){
		if(document.images){
			var i=1;
			for (x in jsMarqueeData){
				if(i<jsMarqueeData.length){				
					imgNum=i.toString();
					marqueeImg = "image"+imgNum;
					marqueeImg = new Image(410,350);
			 		marqueeImg.src = jsMarqueeData[i]["postImg"];
					marqueeImg.alt = jsMarqueeData[i]["postTitle"];
					var link = $("<a />").attr("href",jsMarqueeData[i]["postLink"]).html(marqueeImg);
					$("#image-slider").append(link);
					i++;
				}
			}
		}
	})

	function startInt(){slideInterval = window.setInterval("xxlMarquee.prototype.animate();", changeSpeed);}
	function stopInt(){window.clearInterval(slideInterval);}
	startInt();
	
	// HOME FUNCTIONS
	$(".home #marquee-nav li").mouseover(
		function(){
			var id = $(this).attr("id");
			var title = $(this).attr("title");
			$("#marquee-popup img:first").hide();
			var curImg = $("#marquee-popup img."+id);
			curImg.remove();
			$("#marquee-popup").prepend(curImg);
			$("#marquee-popup img."+id).show();
			$("#marquee-popup span").html(jsMarqueeData[title]["postTitle"]);
			$("#marquee-popup").animate({"bottom":"50px","opacity": "toggle"},75,function(){});
		})

	$(".home #marquee-nav li").mouseout(
		function(){
			$("#marquee-popup").hide();
			$("#marquee-popup").css("bottom","40px")
	})


	// EYE CANDY FUNCTIONS
	$(".eyecandy #marquee-nav li").mouseover(
		function(){
			stopInt();
			
			// Remove & add active state
			$("#marquee-nav .active").removeClass("active");
			$($(this)).addClass("active");
			$("#headline a").attr("href",jsMarqueeData[$(this).attr("title")]["postLink"]);
			$("#headline a").html(jsMarqueeData[$(this).attr("title")]["postTitle"]);
			$("#headline p").html(jsMarqueeData[$(this).attr("title")]["postExcerpt"]);
			
			//animate marquee to new postion based on pos attr on the list marquee-nav item
			var pos = $(this).attr("pos")*-1;
			$("#image-slider").animate({top:pos},slideSpeed,function(){});

		})

	$(".eyecandy #marquee-nav li").mouseout(
		function(){
			startInt();
	})

}