// slideshow
	var slideInterval = 3; //seconds between slides
	var slideTimeout; //setTimeout holder
	var slideCurrent = 0;
	var slideTotal;
	jQuery(document).ready(function(){
		
		jQuery("<ul class='slide-navigation-mkt'></ul>").appendTo(".slideShow-mkt");
		jQuery(".slide-mkt").each(function(i){

			jQuery("<li><a href='#'></a></li>").appendTo(".slide-navigation-mkt").click(function(e){
				clearTimeout(slideTimeout);
				slideSelect(i);
				e.preventDefault();
				return false;
			});
			if (i > 0) {
				jQuery(this).hide();
			}
		});
		//.not(":first").hide();
		jQuery(".slide-navigation-mkt a").eq(slideCurrent).addClass("active");
		slideTimeout = setTimeout("slideAdvance()",slideInterval * 1000);
		slideTotal = jQuery(".slide-mkt").length;


		jQuery(".video a").overlay({
			mask:'black',
			fixed:false,
			onBeforeLoad: function() {
				//var myhref = jQuery(this).attr("href");
				var wrap = this.getOverlay().find(".video-wrap");
				var whathref = this.getTrigger().attr("href");
				//console.log("what is wrap? " + wrap + " and whathref: "+ whathref);
				if (whathref.indexOf("http://youtu") != -1) {
					var tmpArray = whathref.split("/");
					var youtubecode = tmpArray[tmpArray.length - 1];
					wrap.css({"width":"640px","height":"390px","background":"#000","padding":"10px"});
					wrap.html("<iframe title=\"YouTube video player\" width=\"640\" height=\"390\" src=\"http://www.youtube.com/embed/" + youtubecode + "\" frameborder=\"0\" allowfullscreen></iframe>");
				} else {
					wrap.load(whathref, function(response, status, xhr) {
						//console.log("status: " + status);
						
						  if (status == "error") {
						    var msg = "Sorry but there was an error: ";
						    //console.log(msg);
						  }
						  //console.log("xhr status: " + xhr.status + " " + xhr.statusText);
					});
				}
				//return false;

			}
		});

		//Set up the videos to show up in a dialog:
		// jQuery(".video a").overlay({
		// 	mask:'darkblue',
		// 	onBeforeLoad: function() {
		// 		var wrap = this.getOverlay().find(".video-wrap");
		// 		var whathref = this.getTrigger().attr("href");
		// 		console.log("what is wrap? " + wrap + " and whathref: "+ whathref);
		// 		wrap.load(whathref, function(response, status, xhr) {
		// 			console.log("status: " + status);
					
		// 			  if (status == "error") {
		// 			    var msg = "Sorry but there was an error: ";
		// 			    console.log(msg);
		// 			  }
		// 			  console.log("xhr status: " + xhr.status + " " + xhr.statusText);
		// 		});


		// 	}
		// });


	});
	function slideAdvance() {
		jQuery(".slide-navigation-mkt a").eq(slideCurrent).removeClass("active");
		var cpast = jQuery(".slide-mkt").eq(slideCurrent);
		cpast.css("z-index",300);
		slideCurrent += 1;
		if (slideCurrent == slideTotal) {
			slideCurrent = 0;
		}
		var cslide = jQuery(".slide-mkt").eq(slideCurrent);
		jQuery(".slide-navigation-mkt a").eq(slideCurrent).addClass("active");
		cslide.css("z-index",400);
		cslide.fadeIn(1000,function(){cpast.hide();slideTimeout = setTimeout("slideAdvance()",slideInterval * 1000);});
		//slideNext();
	}
	function slideSelect(slideNum){
		jQuery(".slide-navigation-mkt a").eq(slideCurrent).removeClass("active");
		var cpast = jQuery(".slide-mkt").eq(slideCurrent);
		cpast.css("z-index",300);
		slideCurrent = slideNum;
		var cslide = jQuery(".slide-mkt").eq(slideCurrent);
		jQuery(".slide-navigation-mkt a").eq(slideCurrent).addClass("active");
		cslide.css("z-index",400);
		cslide.fadeIn(1000,function(){cpast.hide();});
	}
	//


