// JavaScript Document

function yousure(text,location) {
	var answer = confirm(text);
	if(answer) {
		window.location = location;
	} else {
			return false;
	}
};

function Clickheretoprint() {
	if($('#content_large').html() != "") {
		$('#content_large').printArea();
	}
}

$(document).ready(function(){
	$('#keywords').example('- Type Key Words -');

	$('#rotation').cycle({ 
			fx:     'scrollHorz', //how the slides change. Can also use
			speed:   1500, //how quickly the slides change. In milliseconds
			timeout: 6000, //how long slide is displayed before change. In milliseconds
			pause:   1 //slides pause when moused over.  change to 0 for no pause
	});

		// Override default parameters onload
		$.fn.hoverscroll.params = $.extend($.fn.hoverscroll.params, {
			vertical: true,	// true displays the list vertically, false displays the list horizontally	
			width: 180,	// Width of the list container
			height: 450,	// Height of the list container
			arrows: true,	// Display direction indicator arrows or not
			arrowsOpacity: 0.4	// Max possible opacity of the arrows
		});
		
		// Generate hoverscroll with overridden default parameters		
		$('#featured_list').hoverscroll();


	//javascript to change emails to links
	$(".email_link").each(function (i) {
		var id = $(this).attr("id");
		var temp = id.split('&');
		var name = temp[0];
		var domain = temp[1];
		$(this).html('<a href="mailto:'+name+'@'+domain+'">'+name+'@'+domain+'</a>');
	});
	
	//find links that are subscribe or book-now
	$("a[href*='/book-now/']").each(function (i) {
		var href = $(this).attr("href");
		href = href+'?KeepThis=true&TB_iframe=true&height=500&width=550';
		$(this).attr("href",href);
		$(this).addClass("thickbox");
	});

	$("area[href$='/book-now/']").each(function (i) {
		var href = $(this).attr("href");
		href = href+'?KeepThis=true&TB_iframe=true&height=500&width=550';
		$(this).attr("href",href);
		$(this).addClass("thickbox");
	});

	$("a[href*='/speaker-quote/']").each(function (i) {
		var href = $(this).attr("href");
		href = href+'?KeepThis=true&TB_iframe=true&height=500&width=550';
		$(this).attr("href",href);
		$(this).addClass("thickbox");
	});

	$("area[href$='/speaker-quote/']").each(function (i) {
		var href = $(this).attr("href");
		href = href+'?KeepThis=true&TB_iframe=true&height=500&width=550';
		$(this).attr("href",href);
		$(this).addClass("thickbox");
	});

	$("a[href$='/subscribe/']").each(function (i) {
		var href = $(this).attr("href");
		href = href+'?KeepThis=true&TB_iframe=true&height=250&width=450';
		$(this).attr("href",href);
		$(this).addClass("thickbox");
	});

	$("a[href*='/email-link/']").each(function (i) {
		var href = $(this).attr("href");
		href = href+'?KeepThis=true&TB_iframe=true&height=450&width=400';
		$(this).attr("href",href);
		$(this).addClass("thickbox");
	});

	$("a[href*='/topic-outline/']").each(function (i) {
		var href = $(this).attr("href");
		href = href+'?KeepThis=true&TB_iframe=true&height=500&width=550';
		$(this).attr("href",href);
		$(this).addClass("thickbox");
	});

	tb_init(".thickbox");

	flowplayer(".flowplayer", "/_js/flowplayer/flowplayer-3.1.1.swf", {
			clip: { 
					autoPlay: false,  
					autoBuffering: true // <- do not place a comma here   
			}
	});

	flowplayer(".flowaudio", "/_js/flowplayer/flowplayer-3.1.1.swf", {
			clip: { 
					autoPlay: false,  
					autoBuffering: false // <- do not place a comma here   
			}
	});


});


