Cufon.replace('.biocontent a, .member-name', { fontFamily: 'vegur' });
Cufon.replace('.context h1,.context h2,.context h3,.context h4,.context h5,.context h6,.title, .sidebar-title, .accolades-title, .name-title', { fontFamily: 'warnockpro', fontWeight: 'bold' });
Cufon.replace('.testi', { fontFamily: 'warnockpro', fontStyle: 'italic' });
Cufon.replace('.menu li .dd a', {
	hover: {
		color:'white'
	}
});
Cufon.replace('.menu li a', {
	hover: {
		color:'black'
	}
});
Cufon.replace('.footnav li a', {
	hover: {
		color:'#655639'
	}
});

Cufon.now();

var qsParm = new Array();
$.noConflict();

jQuery(document).ready(function($) {
function mycarousel_initCallback(carousel) {
	$('.next').bind('click', function() { carousel.next(); return false; });
	$('.prev').bind('click', function() { carousel.prev(); return false; });
};

function switchStylestyle(styleName)
{
	$('link[rel*=style][title]').each(function(i) 
	{
		this.disabled = true;
		if (this.getAttribute('title') == styleName) this.disabled = false;
	});
}

function qs() {
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i < parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0) {
			var key = parms[i].substring(0, pos);
			var val = parms[i].substring(pos + 1);
			qsParm[key] = val;
			switchStylestyle(qsParm[key]);
			$(".carousel").remove();
			$(".slider").remove();
			$(".forprint").find('a').attr('href', 'javascript:window.print();');
			$(".header").append('<a class="sitelink" href="http://www.pollockbegg.com">www.pollockbegg.com</a>');
			$(".text").show();
			$(".print").find('span').append('<a id="printnow" href="javascript:window.print();">Print Complete Biography</a>');
			$(".forprint").remove();
		}
	}
}
	qs();
	$('.forprint').click(function() {
		window.open(document.location.href + '?mode=print_preview');
		//switchStylestyle(this.getAttribute("rel"));
		//$(this).find('a').attr('href', 'javascript:window.print();');
		//$(".carousel").remove();
		//$(".header").append('<a class="sitelink" href="http://www.pollockbegg.com">www.pollockbegg.com</a>');
		//$(".text").show();
		//$(".print").find('span').append('<a id="printnow" href="javascript:window.print();">Print Complete Biography</a>');
		//$(this).remove();
		return false;
	});

	
	$(".menubar").load("mainmenu.html", function() { //Loade mainmenu.html
		$(this).append('<div class="dropshadow"></div>');
		//Re initialize Cufon
		Cufon.replace('.menu li .dd a', {
			hover: {
				color:'white'
			}
		});
		Cufon.replace('.menu li a', {
			hover: {
				color:'black'
			}
		});
		function megaHoverOver(){
			$(this).find(".dd").stop().fadeTo('fast', 1).show();
			
			$(this).find(".row:last").css({'margin':'0'});
		}
		function megaHoverOut(){ 
		  $(this).find(".dd").stop().fadeTo('fast', 0, function() {
			  $(this).hide(); 
		  });
		}
		// initialize the menu
		$(".menu li").each( function() {
			// add a drop down arrow symbol
			if ($(this).find(".dd").length !== 0) {
				$(this).children('a:first').append('<span class="droparrow"></span>');
				$(this).find(".dd").css({
					 'display': 'none',
					 'visibility': 'visible'
				});
			}
		});
		var config = {    
			 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
			 interval: 100, // number = milliseconds for onMouseOver polling interval    
			 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
			 timeout: 500, // number = milliseconds delay before onMouseOut    
			 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
		};
		$(".menu li .dd").css({'opacity':'0'});
		$(".menu li").hoverIntent(config);
	}); //End process on mainmenu.html

	//Carousel ini
	if ($(".slider").length) {
		$(".slider").jcarousel({
			scroll: 1,
			visible: 5,
			initCallback: mycarousel_initCallback,
			buttonNextHTML: null,
			buttonPrevHTML: null
		});
		//Minisite Tabs
		$(".text").hide();//
		$(".bio-nav li:first").addClass("active").show(); //Activate first tab
		$(".text:first").show(); //Show first tab content
		$(".bio-nav li").click(function() {
			if($(this).attr("class")!="active") {
				$(".bio-nav li").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //Add "active" class to selected tab
				$(".text").hide(); //Hide all tab content

				var activeTab = $(this).find("a").attr("rel"); //Find the href attribute value to identify the active tab + content
				$("."+activeTab).show(); //Fade in the active ID content
			}
			return false;
		});
	}
});
