$(document).ready(function() {	
	
	if ($(".jqfancybox").length > 0){
	if ($("*").is(".jqfancybox")) { 
				$(".jqfancybox").fancybox({
					"padding": 0,
					"speedIn": 300,
					"speedOut": 300,
					"changeSpeed": 300,
					"transitionIn": "elastic",
					"transitionOut": "elastic",
					"titlePosition": "over",
					"titleShow": true,
					"easingIn": "swing",
					"easingOut": "swing",
					"showCloseButton": true,
					"showNavArrows": true,
					"enableEscapeButton": true,
					"overlayShow": true,
					"overlayOpacity": 0.4,
					"overlayColor": "#666",
					"centerOnScroll": false,
					"hideOnContentClick": false,
					"onComplete"		 :	function() {
												$("#fancybox-wrap").hover(function() {
													$("#fancybox-title").show();
												}, function() {
													$("#fancybox-title").hide();
												});
											},  "titleFormat": function(title, currentArray, currentIndex, currentOpts) { return '<span id="fancybox-title-over">' + title + '</span>';}
		});
	 }
	}
	 
	$("a[rel|=external]").attr('target', '_blank');
	//$("input.submit").replaceWith('<a href="#" class="sendit">' + $(this).attr('value') + '</a>');
	
	
	$("#content p img.left, #content p img.right").each(function() {
		$(this).parents("p").addClass("clearFix");														  
	});
	
	$(".sendit").click(function(event) {
		event.preventDefault();
		$(this).parents('form').submit();
	});
	
	
	if($("#sponsors").children().length==0){}
		//$("#sponsors").hide();
	else{
document.getElementById('sponsors').style.display="block";
		$("#sponsors .sponsors_carousel").sponsorsCarousel(6000);
	
}
	if(  $("a.jqfancybox").length)
	{
		$("a.jqfancybox").each(function(){
			if( $("a.jqfancybox img").attr("title") )
			{
				var imgWidth = $(this).children("img").attr("width")+5;
				var addStyle = 'style="width:' + $(this).children("img").attr("width") + 'px;"';
				if( $(this).children("img").hasClass("left") ){ 
					var caption = 'caption'; 
					$(this).append('<span class="clickEnlarge" style="left:6px; top:8px;"></span>');
					$(this).css({"float":"left","display":"block","width":imgWidth });
				}
				else 
				{
					var caption = 'captionright';
					$(this).css({"float":"right","width":imgWidth});
					$(this).append('<span class="clickEnlarge" style="left:11px; top:8px;"></span>');
					
				}
				$(this).after("<span class='" + caption + "' " + addStyle + ">"+$(this).children("img").attr("title")+"</span>");
				
				
			}
		})
	}
	
	$("a.jqfancybox").hover(function(){
		$(this).children('.clickEnlarge').show();
									 
	},function(){
		$(this).children('.clickEnlarge').hide();
		}
	);
	
	$("div#buttons ul li a").slideshow({repeat:true, timer:7000});
	
	$(".bottom_navigation_fce > div").wrapAll("<ul class='mycarousel'></ul>");
	//$(".bottom_navigation_fce div div.category").wrap("<li></li>");
	$(".bottom_navigation_fce ul.mycarousel > div").wrap("<li></li>");
	
	//$(".bottom_navigation ul.carousel > div").wrap("<li></li>");
	$("ul.mycarousel li:even").addClass("even");
	$("div.committee:odd").addClass("whiteeven");
        $("#content .two_collumn ul li:even").addClass("even");
	$("ul.mycarousel li:last-child").addClass("last");
	
	//$("div#pods div:last-child div.pod:last-child").css('padding-right', '0px');
	$("div#sponsors ul li:last-child").css('padding-right', '0px');
	if ($(".pod form.validate").length > 0) {
		$(".pod form.validate, .press form.validate").validate( {errorLabelContainer: ".errorContainer", errorClass: "error", onfocusout: false });
	}
	if ($(".press form.validate").length > 0) {
		$(".press form.validate").validate( {errorLabelContainer: ".errorContainer", errorClass: "error", onfocusout: false });
	}
	$("a.submit").click(function() {
		$(this).closest("form").submit();
	});
	
	$("table tbody tr:odd").addClass("odd");
	
	if( $('.year_select select').length)
        $(".year_select select").selectbox();

	$("div#content div").not(".category").children(".slide").each(function(){ $(this).slide(); });

	if( $(".news_item").length){
		$(".news_item").mouseenter(function() {
			$(this).addClass("active");	
		});
		$(".news_item").mouseleave(function() {
			$(this).removeClass("active");													   
		});
	}
	else if( $("#nomineeVoting:not(.deactivated) .nominee").length )
	{
		$(".nominee").mouseenter(function() {
			$(this).addClass("active");	
		});
		$(".nominee").mouseleave(function() {
			$(this).removeClass("active");													   
		});
		
		$("#nomineeVoting .nominee").bind('click',function(e){
			e.preventDefault();
			e.stopPropagation();
			
			$(this).addClass('clicked').siblings('.nominee').removeClass('clicked');
			$(this).children('input:hidden')[0].checked = true;
			
			$(this).parent('.voteCategory').addClass('checkedCat');
		});
		
	}
	
	$("#award_categories h3").click(function(){
		if($(this).parent().hasClass("active"))
			$(this).siblings("div.details").slideUp().parent().removeClass("active");

		else {
			$("#award_categories .award.active").removeClass("active").children(".details").slideUp();
			$(this).siblings("div.details").slideDown().parent().addClass("active");
			Cufon.replace('#content .award h3', {fontFamily: 'PFAgoraSlabPro', hover: true} );
		}
	});
	
	if($('#tickets_admission_2').length)
	{
		var action = $('#tickets_admission_2').attr('action');
		//$('#tickets_admission_2').submit(function(){
		//		if( $(this).attr('action') == action )
		//			return false;
		//});

		$('#submit').bind('click',function(e){
			e.preventDefault();
			e.stopPropagation();

			var frm = $('#tickets_admission_2');
			frm.attr('action', action );
			
			document.forms["tickets_admission_2"].submit();
		});
		
		$('#tickets_admission_2 .change').bind('click',function(e){
			e.preventDefault();
			var frm = $('#tickets_admission_2');
			frm.attr('action', ($(this).attr('href') + '#' + $(this).attr('id') ) );
			
			document.forms["tickets_admission_2"].submit();
		});
	}
	
	
	$(".bottom_navigation_fce .category").each(function(){ 
		$(this).children(".slide").children("a").attr("href", $(this).children("a.more").attr("href") );
	});
	//console.log('link');
	
	//$("#categories .category:not(.news)").each(function(){ 
	//	$(this).children("a.more").attr("alt", $(this).children("a.more").attr("href") );
	//});
	
	if($(".lifetime_spacer").length)
	{
		var myIndex;
		
		if($(".lifetime_spacer a").hasClass("active")){
			myIndex = $(".lifetime_spacer a.active").index();
			
			if(myIndex==0)
			{
				$("#content .content .lifetime_photos").fadeIn();															
			}
			else
			{
				$("#content .content .biography").fadeIn();														  
			}

		}
		$(".lifetime_spacer a").click(function() {
			
			$(this).addClass("active").siblings("a").removeClass("active");								   
			//var ind2 = $(".tabs_navigation ul.mycarousel .selected-active").closest("li").index();
			
			myIndex = $(this).index();
			if(myIndex==0)
			{
				$("#content .content .biography").fadeOut("fast", function(){
	 
				
					$(this).siblings(".lifetime_photos").fadeIn("fast");
					$(this).css('display', 'none');
				});
				
			}
			else
			{
				$("#content .content .lifetime_photos").fadeOut("fast", function(){
					$(this).siblings(".biography").fadeIn("fast");	
					$(this).css('display', 'none');
				});
			}
		});
	}
	
	if($(".tabHeader").length)
	{
		var myIndex;
		
		if($(".tabHeader a").hasClass("active")){
			myIndex = $(".tabHeader a.active").index();

			$("#content .tabContent:eq("+myIndex+")").show();
			$("#content .tabContent:eq("+myIndex+")").siblings('.tabContent').hide();			
		}
		$(".tabHeader a").click(function() {	
			$(this).addClass("active").siblings("a").removeClass("active");								   

			myIndex = $(this).index();

			$("#content .tabContent:eq("+myIndex+")").show();
			$("#content .tabContent:eq("+myIndex+")").siblings('.tabContent').hide();
		});
	}	
	

	
	$("#interviews .news_item:eq(0)").addClass('first');
	
	$(".news_item").click(function(){
		//$(this).children("a:first").trigger('click');
		var url = $(this).children("a:first").attr("href");
		buf = ""; //getAbsolutePath();
			 
		window.location = url;
	});
	function getAbsolutePath() {
		var loc = window.location;
		var pathName = loc.pathname.substring(0, loc.pathname.indexOf('/') +1 );
		return loc.href.substring(0, loc.href.length - ((loc.pathname + loc.search + loc.hash).length - pathName.length));
}

	
	$('a.bio').unbind("click").click(function(e) {
		if( $(this).hasClass("open") )
		{
			$(this).parents("div.content").find("div.bio").slideUp();
			$(this).removeClass("open");
		}
		else
		{
			$(this).addClass("open");
			$(this).parents("div.content").find("div.bio").slideDown();
		}
	});
	
	$("a.expand").unbind("click").click(function(e) {
		if( $(this).hasClass("open") )
		{
			$(this).parent().next(".bio").slideUp();
			$(this).removeClass("open");
		}
		else
		{
			$(this).addClass("open");
			$(this).parent().next(".bio").slideDown();
		}									 
	});
	
	
	// For IE6
	//if ($.browser.msie && ($.browser.version == "6.0")) {}

	$('.video_gallery .content').jScrollPane({showArrows:true, 			
	verticalDragMinHeight: 80,
			verticalDragMaxHeight: 80,
			horizontalDragMinWidth: 80,
			horizontalDragMaxWidth: 80
});
	
	if($(".bottom_navigation .category").length>3){
    jQuery('.bottom_navigation .mycarousel').jcarousel({
		scroll: 1,
		buttonPrevHTML: '<a href="javascript: void(0);" class="previous_item">Previous</a>',
        buttonNextHTML: '<a href="javascript: void(0);" class="next_item">Next</a>'
    });
	}
	else{
    jQuery('.bottom_navigation .mycarousel').jcarousel({
		scroll: 1,
		buttonPrevHTML: '',
        buttonNextHTML: ''
    });
	}


	if($(".bottom_navigation_fce .category").length>3){
    jQuery('.bottom_navigation_fce .mycarousel').jcarousel({
		scroll: 1,
		buttonPrevHTML: '<a href="javascript: void(0);" class="previous_item">Previous</a>',
        buttonNextHTML: '<a href="javascript: void(0);" class="next_item">Next</a>'
    });
	}
	else{
    jQuery('.bottom_navigation_fce .mycarousel').jcarousel({
		scroll: 1,
		buttonPrevHTML: '',
        buttonNextHTML: ''
    });
	}
	

    jQuery('.gallery_navigation .mycarousel').jcarousel({
		scroll: 4,
		buttonPrevHTML: '<a href="javascript: void(0);" class="previous_item">Previous</a>',
        buttonNextHTML: '<a href="javascript: void(0);" class="next_item">Next</a>'
    });
	
	
	jQuery('ul.tweet_carousel').jcarousel({
		scroll: 1,
		auto: 8,
		//itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { $('ul.tweet_carousel li:last').remove();  }},
		//vertical: true,
		wrap: 'circular',
		animation: 1100,
		buttonPrevHTML: null,
		buttonNextHTML: null,
		initCallback: mycarousel_initCallback
	});
	function mycarousel_initCallback(carousel)
	{
		carousel.clip.hover(function() {
			carousel.stopAuto();
		}, function() {
			carousel.startAuto();
		});
	};

	$('body').pngFix();
	
	$(".category").each(function() {
		$(this).singleElementViewSlideshow();
	});
	
	// Guide text into input fields, remove onfocus
	$(".guide").each(function() {
		$(this).attr("value", $(this).attr("alt"));
		$(this).focusin(function() {
			if ($(this).attr("value") == $(this).attr("alt")) {
				$(this).attr("value", "");
			}
			$(this).addClass("focused");
		}).focusout(function(eventObject) {
			if ($(this).attr("value") == "") {
				$(this).attr("value", $(this).attr("alt"));
			}
			$(this).removeClass("focused");
		});
	});
	
	$("div#quicklinks ul li.last").stop(true, true).mouseenter(function() {
		$("ul li.last .dropdown").stop(true, true).slideDown('fast');
		$("div#quicklinks ul li.last").addClass("blackBg");	
		}).mouseleave(function() {
		$(this).removeClass('blackBg');
		$("ul li.last .dropdown").hide();
	});
	
	//alert($("div#account ul li.user").outerWidth(true));
	var w = $("div#account ul li.user span").innerWidth();
	$("div#account ul li.user").stop(true, true).mouseenter(function() {
		$("ul li.user .dropdown").stop(true, true).slideDown('fast');
		$("div#account ul li.user").addClass("blackBg");
		$("div#account ul li.user span").addClass("active");
	}).mouseleave(function() {
			$(this).removeClass('blackBg');
			$("div#account ul li.user span").removeClass("active");
			$("div#account ul li.user .dropdown").hide();
	});
	
	if($("div#content").length && $("div#sponsorsPlan").length==0)
		$("div.tabs_navigation ul.mycarousel").tabs({content:"#content div.content"});
	else {
	if($("div#sponsorsPlan").length) {
		$("div.tabs_navigation ul.mycarousel").tabs({content:"#sponsorsPlan div.content"});	
	}
		$("a.goToFirst").click(function(){ $("ul.mycarousel li:first .category").trigger("click"); });
		$("a.showDefault").click(function(){
			$("div#sponsorsPlan .content").addClass("hide").fadeOut(0, function(){$("div#sponsorsPlan .content:last").addClass("default-message").removeClass("hide").fadeIn(0);});										 			
			$("ul.mycarousel li .selected-active").removeClass("selected-active");});
	}
	$(".tabs_navigation .category a.winnerLink").attr("href", "javascript: void(0);");
	
	$('.tabs_navigation .mycarousel .category').mouseenter(function() {
		$(this).addClass("selected");	
	});
	$('.tabs_navigation .mycarousel .category').mouseleave(function() {
		$(this).removeClass("selected");													   
	});
	$('.tabs_navigation .mycarousel .category').click(function() {
		$('.tabs_navigation .mycarousel .category').removeClass("selected-active");													   
		$(this).addClass("selected-active");												   
	});
	
	$("#categories .news a.more").attr("href", $("#categories .news .active a").attr("href")  );
	//console.log('link');

		$("#categories .news .nav").click(function(){ $(this).parent(".news").children("a.more").attr("href", $(this).parent(".news").children(".active").next(".slide").children("a").attr("href")  ); });

if($('div form.validate input').length && $('div.pod form.validate input').length<=0 && $('div.press form.validate input').length<=0) {
	// Submit form when you click Enter on input field
	$('form.validate input').keydown(function(e){
		if (e.keyCode == 13) {
			$(this).parents('form').submit();
			return false;
		}
	});
	
	// Form validation [START]
	$(".validate").each(function() {
		$(this).validate({
			focusInvalid: false,
			rules: {
				email_address: {
					email: true
				}
			},
			messages: {
				email_address: "Please enter a valid email address."
			},
			errorLabelContainer: $(this).find('.errorLog'),
			onfocusout: false,
			onkeyup: false,
			onclick: false,
			errorPlacement: function(error, element) {
				if ($(element).is('input[type="radio"]'))
				{
					$(element).each(function() {
					if (element.parent().parent().hasClass('pagevalidation')) {
						var ulel = element.parent().parent().parent();
						
						var ep = ulel.find('div.errorPlacement:first');
						error.appendTo(ep);						
					} else if(element.parent().parent().hasClass('artworkvalidation')) { 
					
						var ulel = element.closest('dl');
						var ep = ulel.nextAll('div.errorPlacement:first');
						error.appendTo(ep);			
					} else if(element.parent().parent().parent().parent().parent().hasClass('donationInfo')) { 
						var ulel = element.parent().parent().parent().parent().parent();	
						error.appendTo(ulel);
					} else if(element.parents("#creditCardInfo")) { 
						var ulel = element.parent().parent().parent();
						error.appendTo(ulel);
					} else {
						
						var ulel = element.parent().parent().parent().parent().parent();
						//var ep = ulel.nextAll('div.errorPlacement:first');
						error.appendTo(ulel);
					}
											 });
				}
				else if ($(element).attr("id") == "other_amount"){
						var ulel = element.parent().parent();
						error.appendTo(ulel);						
				}
				else if ($(element).is('select')) {
					var ulel = element.parent().parent();
					error.appendTo(ulel);
				}
				else{
					error.insertAfter(element);
				}
				//var ind = element.index(this);
				//error.appendTo(element.parent().parent().next('li'));
			}
		});
	});	
	
	
	if( $('#orderSummary').length ){
		$('select.required').each(function(){
			$(this).rules('add', {fselect_required: true});				 
		}); 
		
		$('.fourthCollumn input').each(function(){ $(this).rules("add", {messages: { digits: "Please enter a valid amount"}} ); });
		$("#phone").rules("add", {messages: { digits: "Please enter a valid number"}} );
		
		$('.fourthCollumn input').bind('click',function(){
			if( $(this).val()==0 )
			{
				$(this).attr("value",'');	
			}
		});
		$('.fourthCollumn input').bind('focusout',function(){
			if( $(this).val().length==0 )
			{
				$(this).attr("value",'0');	
			}
		});
		

		
		$('form.validate').submit(function(){
			var keepOn = false;
			
			$('form.validate dl').each(function(){
				if( $(this).find('label.error').length > 1 )
					$(this).find('label.error:eq(1)').remove();
			});

			
			$('.fourthCollumn input').each(function(){
				if( parseInt($(this).val())>0 )
				{
					keepOn=true;	
				}
			});
			if(keepOn) return true;
			else{ 
				$('.tickets_table').after('<label class="error" style="margin-top:-12px;">Please enter a ticket quantity.</label>');
				//window.location.hash="orderSummary";
				return false;
			}
			
		});
	}
	
	// hide/show credit card imformation
	if ($('#paymentType').length > 0) {
		creditValidation(true);
		$('#checkInfo').hide();
		$('#paymentType').change(function() {
			if ($('#paymentType').val() == 'CreditCard') {
				$('#creditCardInfo').show();
				$('#checkInfo').hide();
				creditValidation(true);
			} else {
				$('#creditCardInfo').hide();
				$('#checkInfo').show();
				creditValidation(false);
			}
		});
	}
	
	// hide/show Tribute imformation
	if ($('#tributetype').length > 0) {
		$('#tributetypeContent').html($("p#"+$('#tributetype').val() ).html());
		$('#tributetype').change(function() {
			$('#tributetypeContent').html($("p#"+$('#tributetype').val() ).html());
		});
	}
	
	// hide/show sposnsorship type imformation
	if ($('#sponsorshipType').length > 0) {
		sponsorshipValidation($('#sponsorshipType').val());
		$('#programBookFormInfo').hide();
		if ($('#sponsorshipType').val() == 'Sponsorship') {
			$('#sponsorFormInfo').show();
			$('#programBookFormInfo').hide();
			sponsorshipValidation($('#sponsorshipType').val());
		} else if($('#sponsorshipType').val() == 'ProgramBook') {
			$('#sponsorFormInfo, #programBookFormInfo .tablehost').hide();	
			$('#programBookFormInfo, #programBookFormInfo .fullpage, #programBookFormInfo .halfpage').show();
			sponsorshipValidation($('#sponsorshipType').val());
		} else {
			$('#sponsorFormInfo, #programBookFormInfo .fullpage, #programBookFormInfo .halfpage').hide();	
			$('#programBookFormInfo, #programBookFormInfo .tablehost').show();
			sponsorshipValidation($('#sponsorshipType').val());			
		}
		$('#sponsorshipType').change(function() {					  
			if ($('#sponsorshipType').val() == 'Sponsorship') {

				sponsorshipValidation($('#sponsorshipType').val());
			} else if($('#sponsorshipType').val() == 'ProgramBook') {

				sponsorshipValidation($('#sponsorshipType').val());
			} else {

				sponsorshipValidation($('#sponsorshipType').val());			
			}

		});
	}

	// From styling 
	$("form input[type='radio']").jqTransRadio();
	$("form input[type='checkbox']").jqTransCheckBox();
	$('form input:submit,form input:reset,form input[type="button"]').jqTransInputButton();	
	$("form select").jqTransSelect();
	
	// Donation Form
	if ($('#other_amount').length > 0 ) {
		donateOtherAmount();
		$('#other_amount').focus(function() {
			$(this).parents().find("#other").prev().click();
		});
	
		$("input[name='tx_gafdonation_pi1[amount]']").change(function(){ 
			donateOtherAmount();
		});
	}
	
}

if($('.tx-felogin-pi1').length > 0 || $('.tx-mmforum-pi1').length > 0 || $('.tx-mmforum-pi4').length > 0){
	// Forum/Form styling 
	$(".tx-felogin-pi1 form input[type='radio'], .tx-mmforum-pi4 form input[type='radio']").jqTransRadio();
	$(".tx-felogin-pi1 form input[type='checkbox'], .tx-mmforum-pi4 form input[type='checkbox']").jqTransCheckBox();
	$('.tx-felogin-pi1 form input:submit,.tx-mmforum-pi4 form input.submit,form input:reset,form input[type="button"],.tx-mmforum-pi4 form input:submit').jqTransInputButton();	
	$(".tx-felogin-pi1 form select,.tx-mmforum-pi1 form select, .tx-mmforum-pi4 form select, #quick_mm_nav").jqTransSelect();
	
	//MM Forum Favorites
	$('#orderbyForm select').change(function(){
		$("#orderbyForm").submit();
	});
	$('#quick_mm_nav').change(function(){
		window.location.href= $(this).val();
	});
	
	//$("input[name^='tx_mmforum_pi4[submit]'").attr("value","Search");										 
	$("#Search_Box").focus(function(){
		if($(this).attr("value") == $(this).attr("alt")) $(this).attr("value", "");
	});
	$("#Search_Box").blur(function(){				   
		if($(this).attr("value") == "") $(this).attr("value", $(this).attr("alt") );	
	});
		//$("input[name^='tx_mmforum_pi4[submit]'").attr("value","Search");										 
	$("#Search_Box").focus(function(){
		if($(this).attr("value") == $(this).attr("alt")) $(this).attr("value", "");
	});
	$("#Search_Box").blur(function(){				   
		if($(this).attr("value") == "") $(this).attr("value", $(this).attr("alt") );	
	});
}

//Updating submit buttons functionality
if( $("#tx_mmforum_editor").length){
	$("#tx_mmforum_editor").markItUp(mySettings);
	//$("#tx-mmforum-submit-topic .jqTransformButton:eq(0)").attr("value","Send Nommination/Topic");
	//$("#tx-mmforum-submit-topic .jqTransformButton:eq(1)").attr("value","Preview");
	//$("#tx-mmforum-submit-topic .jqTransformButton:eq(2)").attr("value","Reset");

}
if ($.browser.msie && ($.browser.version <= "7.0")) { }
else{
	$(".jqTransformButton[name^='tx_mmforum_pi4']").attr("value","Search");
	$("#tx-mmforum-submit-post .jqTransformButton").attr("value","Send Comment/Reply");
	$("#tx-mmforum-submit-topic .jqTransformButton").attr("value","Send Nommination/Topic");
}
$('.mm_menu ul li:last').addClass('last');
	
	$.validator.addMethod("comfirm_email_address", function(value, element) {
		var mail = document.getElementById('email_address').value;
		if (mail) {
			return (($(element).val().length > 0) && $(element).val() == mail);
		} else {
			return ($(element).val().length > 0);
		}
	}, "The email addresses do not match. Please re-enter the same email address in both fields.");

	$.validator.addMethod("zipcodevalid", function(value, element) {
		if ($(element).val().length > 0) {
			var strValue = $(element).val();
			var objRegExp = /(^\d{5}$)|(^\d{5}-\d{4})$/
				if(!objRegExp.test(strValue)) {
					return false;
				} else {
					return true;
				}
		} else {
			return true;
		}
	}, "Please enter a valid Zip Code");
	
	$.validator.addMethod("fselect_required", function(value, element) {
		return ($(element).val().length > 0 && $(element).val() != 0); 
	}, "This field is required");	
	
	$.validator.addMethod("datevalid", function(value, element) {
		if ($(element).val().length > 0) {
			var strValue = $(element).val();
			var objRegExp = /^\d{1,2}(\/)\d{1,2}\1\d{4}$/
			  if(!objRegExp.test(strValue))
			    return false;
			  else{
			    var strSeparator = strValue.substring(2,3) 
			    var arrayDate = strValue.split(strSeparator); 
			    var arrayLookup = { '01' : 31,'03' : 31, 
			                        '04' : 30,'05' : 31,
			                        '06' : 30,'07' : 31,
			                        '08' : 31,'09' : 30,
			                        '10' : 31,'11' : 30,'12' : 31}
			    var intDay = parseInt(arrayDate[1],10); 
			    if(arrayLookup[arrayDate[0]] != null) {
			      if(intDay <= arrayLookup[arrayDate[0]] && intDay != 0)
			        return true;
			    }
			    var intMonth = parseInt(arrayDate[0],10);
			    if (intMonth == 2) { 
			       var intYear = parseInt(arrayDate[2]);
			       if (intDay > 0 && intDay < 29) {
			           return true;
			       }
			       else if (intDay == 29) {
			         if ((intYear % 4 == 0) && (intYear % 100 != 0) || 
			             (intYear % 400 == 0)) {
			             return true;
			         }   
			       }
			    }
			  }  
			  return false;
		} else {
			return true;
		}
	}, "Please enter a valid Date (mm/dd/yyyy)");

	// Form validation [END]	
	
	// faqs accordion
	$('#faqsAccordion').accordion({
		autoHeight: false,
		active: '.open'
	});
	

	$("#awards_categories").accordion({
		autoHeight: false,
		active: '.open'							  
	});

	
	// Submit form on select box change
	$(".gabbysYear").change(function () {
		$("select option:selected").each(function () {
			$("#gabbysYearForm").attr("action", $(this).attr("class"));
			$("#gabbysYearForm").submit();
		});
	});

	if( $("#thumbs").length ) {
		
		// Initially set opacity on thumbs and add
		// additional styling for hover effect on thumbs
		var onMouseOutOpacity = 0.47;
		$('#thumbs ul.thumbs li').opacityrollover({
			mouseOutOpacity:   onMouseOutOpacity,
			mouseOverOpacity:  1.0,
			fadeSpeed:         'fast',
			exemptionSelector: '.selected'
		});
				
		var gallery = $('#thumbs').galleriffic({
		    maxWidth:                  542,
		    maxHeight:                 362,										   
	        delay:                     3000, // in milliseconds
	        numThumbs:                 6, // The number of thumbnails to show page
	        preloadAhead:              -1, // Set to -1 to preload all images
	        enableTopPager:            false,
	        enableBottomPager:         false,
	        maxPagesToShow:            7,  // The maximum number of pages to display in either the top or bottom pager
	        imageContainerSel:         '#imageslideshow',
	        controlsContainerSel:      '#controls',
			slideshowControlsContainerSel:      '#slideshowcontrols',
	        captionContainerSel:       '#caption',
	        loadingContainerSel:       '#loading',
	        renderSSControls:          true, // Specifies whether the slideshow's Play and Pause links should be rendered
	        renderNavControls:         true, // Specifies whether the slideshow's Next and Previous links should be rendered
	        playLinkText:              'play slideshow',
	        pauseLinkText:             'pause slideshow',
	        prevLinkText:              'Previous',
	        nextLinkText:              'Next',
	        nextPageLinkText:          'Next &rsaquo;',
	        prevPageLinkText:          '&lsaquo; Prev',
			hideThumbText:			   'hide thumbnails',
			showThumbText:			   'show thumbnails',
	        enableHistory:             true, // Specifies whether the url's hash and the browser's history cache should update when the current slideshow image changes
	        enableKeyboardNavigation:  true, // Specifies whether keyboard navigation is enabled
	        autoStart:                 false, // Specifies whether the slideshow should be playing or paused when the page first loads
	        syncTransitions:           true, // Specifies whether the out and in transitions occur simultaneously or distinctly
	        defaultTransitionDuration: 1500, // If using the default transitions, specifies the duration of the transitions
			onSlideChange:             function(prevIndex, nextIndex) {
											// 'this' refers to the gallery, which is an extension of $('#thumbs')
											this.find('ul.thumbs').children()
												.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
												.eq(nextIndex).fadeTo('fast', 1.0);
									
											// Update the photo index display
											$('#galleryInfo').find('span.photo-index')
												.html(' ('+ (nextIndex+1) +'/'+ this.data.length + ')');
										},
	        onTransitionOut:           undefined, // accepts a delegate like such: function(slide, caption, isSync, callback) { ... }
	        onTransitionIn:            undefined, // accepts a delegate like such: function(slide, caption, isSync) { ... }
	        onPageTransitionOut:       undefined, // accepts a delegate like such: function(callback) { ... }
			onPageTransitionIn:        function() {
											var prevPageLink = this.find('a.prevpage').css('visibility', 'hidden');
											var nextPageLink = this.find('a.nextpage').css('visibility', 'hidden');
											
											// Show appropriate next / prev page links
											if (this.displayedPage > 0)
												prevPageLink.css('visibility', 'visible');
					
											var lastPage = this.getNumPages() - 1;
											if (this.displayedPage < lastPage)
												nextPageLink.css('visibility', 'visible');
					
											//this.fadeTo('fast', 1.0);
										},
	        onImageAdded:              undefined, // accepts a delegate like such: function(imageData, $li) { ... }
	        onImageRemoved:            undefined  // accepts a delegate like such: function(imageData, $li) { ... }
	    });	
		
		// Initialize history plugin.
		// The callback is called at once by present location.hash. 
		//$.historyInit(pageload, "advanced.html");
		$.historyInit(pageload);
		
		gallery.find('a.prevpage').click(function(e) {
	
			gallery.previousPage();
			e.preventDefault();
		});
	
		gallery.find('a.nextpage').click(function(e) {
			gallery.nextPage();
			e.preventDefault();
		});
		
/*		$('#content div#shareLinks').hover(function() {
			$('#sharePhotoLinksContainer').stop(true, true).show("slide", { direction: "up" }, 400);
		}, function() {
			$('#sharePhotoLinksContainer').stop(true, true).hide("slide", { direction: "up" }, 400);
		});*/
		
		$("#content div#shareLinks").stop(true, true).mouseenter(function() {
				$('#sharePhotoLinksContainer').stop(true, true).slideDown('fast');
			}).mouseleave(function() {
				//$('#sharePhotoLinksContainer').hide();
				$('#sharePhotoLinksContainer').slideUp('fast');
		});		

	}

});

// enable/disable validation for cc infromation
function creditValidation(enable) {
	if (typeof enable == "undefined") {
		enable = true;
	}	
	if (enable) {	
		$('#cc_number').rules('add', {creditcard: true});			
		$('#creditCardInfo input, #creditCardInfo select').each(function() {
			$(this).rules('add', {required: true});										 
		});
		$('#creditCardInfo dl.cc_expir_year select, #creditCardInfo dl.cc_expir_year select').each(function() {
			$(this).rules('add', {fselect_required: true});										 
		});		
	} else {
		$('#creditCardInfo input, #creditCardInfo select').each(function() {
			$(this).rules('remove');					 
		});		
	}
}

// enable/disable sponsorship validation
function sponsorshipValidation(value) {
	if (typeof value == "undefined") {
		value = 'Sponsorship';
	}	
	
	switch (value) {
		case 'ProgramBook':
			$('#programBookFormInfo, #programBookFormInfo .fullpage, #programBookFormInfo .halfpage').show();		
			$('input[name="tx_gafsponsors_pi2[amount]"]:first').rules('remove');
			$('input[name="tx_gafsponsors_pi2[pagetype]"]:first').rules('add', {required: true});	
			$('input[name="tx_gafsponsors_pi2[artwork]"]:first').rules('add', {required: true});	
			$('#sponsorFormInfo, #programBookFormInfo .tablehost').hide();	
		break;
		case 'TableHost':
			$('#programBookFormInfo, #programBookFormInfo .tablehost').show();		
			$('input[name="tx_gafsponsors_pi2[amount]"]:first').rules('remove');
			$('input[name="tx_gafsponsors_pi2[pagetype]"]:first').rules('remove');	
			$('input[name="tx_gafsponsors_pi2[artwork]"]:first').rules('add', {required: true});		
			$('#sponsorFormInfo, #programBookFormInfo .fullpage, #programBookFormInfo .halfpage').hide();	
		break;
		default:
			$('#sponsorFormInfo').show();
			$('input[name="tx_gafsponsors_pi2[amount]"]:first').rules('add', {required: true});	
			$('input[name="tx_gafsponsors_pi2[pagetype]"]:first').rules('remove');	
			$('input[name="tx_gafsponsors_pi2[artwork]"]:first').rules('remove');	
			$('#programBookFormInfo').hide();	
		break;
	}

if ($.browser.msie && ($.browser.version <= "7.0")) {
$('h1').fadeOut(30,function(){ $('h1').fadeIn(30) });
	Cufon.replace('h1', {	
	fontFamily: 'PFAgoraSlabPro',
	hover: true
});

}

}

function donateOtherAmount(){
	if ($("#other").attr('checked')){ 
		$('#other_amount').rules('add', {required: true});
	} else {
		$('#other_amount').rules('remove', 'required');
		$('#other_amount').val('');
	}
}

function getFlashMovie(movieName) {   
	var isIE = navigator.appName.indexOf("Microsoft") != -1;   
	return (isIE) ? window[movieName] : document[movieName];  
} 

function stopHomePageFlash() { 
	if($('videoplayer')){ 
		if( $.browser.msie ) { 
			getFlashMovie('videoplayer').stopVideo(); 
		} 
	}  
} 

function playHomePageFlash() { 
	if($('videoplayer')){ 
		//alert( getFlashMovie('videoplayer') ); 
		getFlashMovie('videoplayer').playVideo(); 
	} 
} 

// PageLoad function
// This function is called when:
// 1. after calling $.historyInit();
// 2. after calling $.historyLoad();
// 3. after pushing "Go Back" button of a browser
function pageload(hash) {
	// alert("pageload: " + hash);
	// hash doesn't contain the first # character.
	if(hash) {
		$.galleriffic.gotoImage(hash);
	} else {
		gallery.gotoIndex(0);
	}
}

// set onlick event for buttons using the jQuery 1.3 live method
$("a[rel='history']").live('click', function(e) {
	if (e.button != 0) return true;

	var hash = this.href;
	hash = hash.replace(/^.*#/, '');

	// moves to a new page. 
	// pageload is called at once. 
	// hash don't contain "#", "?"
	$.historyLoad(hash);

	return false;
});

/*
CSS Browser Selector v0.3.5 (Feb 05, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);

(function($){jQuery.fn.pngFix=function(settings){settings=jQuery.extend({blankgif:'http://gabbyawards.com/fileadmin/templates/images/design/blank.gif'},settings);var ie55=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 5.5")!=-1);var ie6=(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)==4&&navigator.appVersion.indexOf("MSIE 6.0")!=-1);if(jQuery.browser.msie&&(ie55||ie6)){jQuery(this).find('img[src$=".png"]').each(function(){jQuery(this).attr('width',jQuery(this).width());jQuery(this).attr('height',jQuery(this).height());var prevStyle='';var strNewHTML='';var imgId=(jQuery(this).attr('id'))?'id="'+jQuery(this).attr('id')+'" ':'';var imgClass=(jQuery(this).attr('class'))?'class="'+jQuery(this).attr('class')+'" ':'';var imgTitle=(jQuery(this).attr('title'))?'title="'+jQuery(this).attr('title')+'" ':'';var imgAlt=(jQuery(this).attr('alt'))?'alt="'+jQuery(this).attr('alt')+'" ':'';var imgAlign=(jQuery(this).attr('align'))?'float:'+jQuery(this).attr('align')+';':'';var imgHand=(jQuery(this).parent().attr('href'))?'cursor:hand;':'';if(this.style.border){prevStyle+='border:'+this.style.border+';';this.style.border='';}
if(this.style.padding){prevStyle+='padding:'+this.style.padding+';';this.style.padding='';}
if(this.style.margin){prevStyle+='margin:'+this.style.margin+';';this.style.margin='';}
var imgStyle=(this.style.cssText);strNewHTML+='<span '+imgId+imgClass+imgTitle+imgAlt;strNewHTML+='style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;strNewHTML+='width:'+jQuery(this).width()+'px;'+'height:'+jQuery(this).height()+'px;';strNewHTML+='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader'+'(src=\''+jQuery(this).attr('src')+'\', sizingMethod=\'crop\');';strNewHTML+=imgStyle+'"></span>';if(prevStyle!=''){strNewHTML='<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:'+jQuery(this).width()+'px;'+'height:'+jQuery(this).height()+'px;'+'">'+strNewHTML+'</span>';}
jQuery(this).hide();jQuery(this).after(strNewHTML);});jQuery(this).find("*").each(function(){var bgIMG=jQuery(this).css('background-image');if(bgIMG.indexOf(".png")!=-1){var iebg=bgIMG.split('url("')[1].split('")')[0];jQuery(this).css('background-image','none');jQuery(this).get(0).runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+iebg+"',sizingMethod='scale')";}});jQuery(this).find('input[src$=".png"]').each(function(){var bgIMG=jQuery(this).attr('src');jQuery(this).get(0).runtimeStyle.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader'+'(src=\''+bgIMG+'\', sizingMethod=\'scale\');';jQuery(this).attr('src',settings.blankgif)});}
return jQuery;};})(jQuery);

/*!
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(i){var q={vertical:false,rtl:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,beforeAnimationHandler:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null, itemFallbackDimension:null},r=false;i(window).bind("load.jcarousel",function(){r=true});i.jcarousel=function(a,c){this.options=i.extend({},q,c||{});this.autoStopped=this.locked=false;this.buttonPrevState=this.buttonNextState=this.buttonPrev=this.buttonNext=this.list=this.clip=this.container=null;if(!c||c.rtl===undefined)this.options.rtl=(i(a).attr("dir")||i("html").attr("dir")||"").toLowerCase()=="rtl";this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical?this.options.rtl? "right":"left":"top";for(var b="",d=a.className.split(" "),f=0;f<d.length;f++)if(d[f].indexOf("jcarousel-skin")!=-1){i(a).removeClass(d[f]);b=d[f];break}if(a.nodeName.toUpperCase()=="UL"||a.nodeName.toUpperCase()=="OL"){this.list=i(a);this.container=this.list.parent();if(this.container.hasClass("jcarousel-clip")){if(!this.container.parent().hasClass("jcarousel-container"))this.container=this.container.wrap("<div></div>");this.container=this.container.parent()}else if(!this.container.hasClass("jcarousel-container"))this.container= this.list.wrap("<div></div>").parent()}else{this.container=i(a);this.list=this.container.find("ul,ol").eq(0)}b!==""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1&&this.container.wrap('<div class=" '+b+'"></div>');this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass("jcarousel-clip"))this.clip=this.list.wrap("<div></div>").parent();this.buttonNext=i(".jcarousel-next",this.container);if(this.buttonNext.size()===0&&this.options.buttonNextHTML!==null)this.buttonNext= this.clip.after(this.options.buttonNextHTML).next();this.buttonNext.addClass(this.className("jcarousel-next"));this.buttonPrev=i(".jcarousel-prev",this.container);if(this.buttonPrev.size()===0&&this.options.buttonPrevHTML!==null)this.buttonPrev=this.clip.after(this.options.buttonPrevHTML).next();this.buttonPrev.addClass(this.className("jcarousel-prev"));this.clip.addClass(this.className("jcarousel-clip")).css({overflow:"hidden",position:"relative"});this.list.addClass(this.className("jcarousel-list")).css({overflow:"hidden", position:"relative",top:0,margin:0,padding:0}).css(this.options.rtl?"right":"left",0);this.container.addClass(this.className("jcarousel-container")).css({position:"relative"});!this.options.vertical&&this.options.rtl&&this.container.addClass("jcarousel-direction-rtl").attr("dir","rtl");var j=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;b=this.list.children("li");var e=this;if(b.size()>0){var g=0,k=this.options.offset;b.each(function(){e.format(this,k++);g+=e.dimension(this, j)});this.list.css(this.wh,g+100+"px");if(!c||c.size===undefined)this.options.size=b.size()}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display","block");this.funcNext=function(){e.next()};this.funcPrev=function(){e.prev()};this.funcResize=function(){e.reload()};this.options.initCallback!==null&&this.options.initCallback(this,"init");if(!r&&i.browser.safari){this.buttons(false,false);i(window).bind("load.jcarousel",function(){e.setup()})}else this.setup()}; var h=i.jcarousel;h.fn=h.prototype={jcarousel:"0.2.7"};h.fn.extend=h.extend=i.extend;h.fn.extend({setup:function(){this.prevLast=this.prevFirst=this.last=this.first=null;this.animating=false;this.tail=this.timer=null;this.inTail=false;if(!this.locked){this.list.css(this.lt,this.pos(this.options.offset)+"px");var a=this.pos(this.options.start,true);this.prevFirst=this.prevLast=null;this.animate(a,false);i(window).unbind("resize.jcarousel",this.funcResize).bind("resize.jcarousel",this.funcResize)}}, reset:function(){this.list.empty();this.list.css(this.lt,"0px");this.list.css(this.wh,"10px");this.options.initCallback!==null&&this.options.initCallback(this,"reset");this.setup()},reload:function(){this.tail!==null&&this.inTail&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+this.tail);this.tail=null;this.inTail=false;this.options.reloadCallback!==null&&this.options.reloadCallback(this);if(this.options.visible!==null){var a=this,c=Math.ceil(this.clipping()/this.options.visible),b=0,d=0; this.list.children("li").each(function(f){b+=a.dimension(this,c);if(f+1<a.first)d=b});this.list.css(this.wh,b+"px");this.list.css(this.lt,-d+"px")}this.scroll(this.first,false)},lock:function(){this.locked=true;this.buttons()},unlock:function(){this.locked=false;this.buttons()},size:function(a){if(a!==undefined){this.options.size=a;this.locked||this.buttons()}return this.options.size},has:function(a,c){if(c===undefined||!c)c=a;if(this.options.size!==null&&c>this.options.size)c=this.options.size;for(var b= a;b<=c;b++){var d=this.get(b);if(!d.length||d.hasClass("jcarousel-item-placeholder"))return false}return true},get:function(a){return i(".jcarousel-item-"+a,this.list)},add:function(a,c){var b=this.get(a),d=0,f=i(c);if(b.length===0){var j,e=h.intval(a);for(b=this.create(a);;){j=this.get(--e);if(e<=0||j.length){e<=0?this.list.prepend(b):j.after(b);break}}}else d=this.dimension(b);if(f.get(0).nodeName.toUpperCase()=="LI"){b.replaceWith(f);b=f}else b.empty().append(c);this.format(b.removeClass(this.className("jcarousel-item-placeholder")), a);f=this.options.visible!==null?Math.ceil(this.clipping()/this.options.visible):null;d=this.dimension(b,f)-d;a>0&&a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))-d+"px");this.list.css(this.wh,h.intval(this.list.css(this.wh))+d+"px");return b},remove:function(a){var c=this.get(a);if(!(!c.length||a>=this.first&&a<=this.last)){var b=this.dimension(c);a<this.first&&this.list.css(this.lt,h.intval(this.list.css(this.lt))+b+"px");c.remove();this.list.css(this.wh,h.intval(this.list.css(this.wh))- b+"px")}},next:function(){this.tail!==null&&!this.inTail?this.scrollTail(false):this.scroll((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!==null&&this.last==this.options.size?1:this.first+this.options.scroll)},prev:function(){this.tail!==null&&this.inTail?this.scrollTail(true):this.scroll((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!==null&&this.first==1?this.options.size:this.first-this.options.scroll)},scrollTail:function(a){if(!(this.locked|| this.animating||!this.tail)){this.pauseAuto();var c=h.intval(this.list.css(this.lt));c=!a?c-this.tail:c+this.tail;this.inTail=!a;this.prevFirst=this.first;this.prevLast=this.last;this.animate(c)}},scroll:function(a,c){if(!(this.locked||this.animating)){this.pauseAuto();this.animate(this.pos(a),c)}},pos:function(a,c){var b=h.intval(this.list.css(this.lt));if(this.locked||this.animating)return b;if(this.options.wrap!="circular")a=a<1?1:this.options.size&&a>this.options.size?this.options.size:a;for(var d= this.first>a,f=this.options.wrap!="circular"&&this.first<=1?1:this.first,j=d?this.get(f):this.get(this.last),e=d?f:f-1,g=null,k=0,l=false,m=0;d?--e>=a:++e<a;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g=this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(l)k+= m;if(this.first!==null&&(this.options.wrap=="circular"||e>=1&&(this.options.size===null||e<=this.options.size)))b=d?b+m:b-m}f=this.clipping();var p=[],o=0,n=0;j=this.get(a-1);for(e=a;++o;){g=this.get(e);l=!g.length;if(g.length===0){g=this.create(e).addClass(this.className("jcarousel-item-placeholder"));j.length===0?this.list.prepend(g):j[d?"before":"after"](g);if(this.first!==null&&this.options.wrap=="circular"&&this.options.size!==null&&(e<=0||e>this.options.size)){j=this.get(this.index(e));if(j.length)g= this.add(e,j.clone(true))}}j=g;m=this.dimension(g);if(m===0)throw Error("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...");if(this.options.wrap!="circular"&&this.options.size!==null&&e>this.options.size)p.push(g);else if(l)k+=m;n+=m;if(n>=f)break;e++}for(g=0;g<p.length;g++)p[g].remove();if(k>0){this.list.css(this.wh,this.dimension(this.list)+k+"px");if(d){b-=k;this.list.css(this.lt,h.intval(this.list.css(this.lt))-k+"px")}}k=a+o-1;if(this.options.wrap!="circular"&& this.options.size&&k>this.options.size)k=this.options.size;if(e>k){o=0;e=k;for(n=0;++o;){g=this.get(e--);if(!g.length)break;n+=this.dimension(g);if(n>=f)break}}e=k-o+1;if(this.options.wrap!="circular"&&e<1)e=1;if(this.inTail&&d){b+=this.tail;this.inTail=false}this.tail=null;if(this.options.wrap!="circular"&&k==this.options.size&&k-o+1>=1){d=h.margin(this.get(k),!this.options.vertical?"marginRight":"marginBottom");if(n-d>f)this.tail=n-f-d}if(c&&a===this.options.size&&this.tail){b-=this.tail;this.inTail= true}for(;a-- >e;)b+=this.dimension(this.get(a));this.prevFirst=this.first;this.prevLast=this.last;this.first=e;this.last=k;return b},animate:function(a,c){if(!(this.locked||this.animating)){this.animating=true;var b=this,d=function(){b.animating=false;a===0&&b.list.css(b.lt,0);if(!b.autoStopped&&(b.options.wrap=="circular"||b.options.wrap=="both"||b.options.wrap=="last"||b.options.size===null||b.last<b.options.size||b.last==b.options.size&&b.tail!==null&&!b.inTail))b.startAuto();b.buttons();b.notify("onAfterAnimation"); if(b.options.wrap=="circular"&&b.options.size!==null)for(var f=b.prevFirst;f<=b.prevLast;f++)if(f!==null&&!(f>=b.first&&f<=b.last)&&(f<1||f>b.options.size))b.remove(f)};this.notify("onBeforeAnimation");if(!this.options.animation||c===false){this.list.css(this.lt,a+"px");d()}else this.list.animate(!this.options.vertical?this.options.rtl?{right:a}:{left:a}:{top:a},this.options.animation,this.options.easing,d)}},startAuto:function(a){if(a!==undefined)this.options.auto=a;if(this.options.auto===0)return this.stopAuto(); if(this.timer===null){this.autoStopped=false;var c=this;this.timer=window.setTimeout(function(){c.next()},this.options.auto*1E3)}},stopAuto:function(){this.pauseAuto();this.autoStopped=true},pauseAuto:function(){if(this.timer!==null){window.clearTimeout(this.timer);this.timer=null}},buttons:function(a,c){if(a==null){a=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="first"||this.options.size===null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap== "first")&&this.options.size!==null&&this.last>=this.options.size)a=this.tail!==null&&!this.inTail}if(c==null){c=!this.locked&&this.options.size!==0&&(this.options.wrap&&this.options.wrap!="last"||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!==null&&this.first==1)c=this.tail!==null&&this.inTail}var b=this;if(this.buttonNext.size()>0){this.buttonNext.unbind(this.options.buttonNextEvent+".jcarousel",this.funcNext);a&&this.buttonNext.bind(this.options.buttonNextEvent+ ".jcarousel",this.funcNext);this.buttonNext[a?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",a?false:true);this.options.buttonNextCallback!==null&&this.buttonNext.data("jcarouselstate")!=a&&this.buttonNext.each(function(){b.options.buttonNextCallback(b,this,a)}).data("jcarouselstate",a)}else this.options.buttonNextCallback!==null&&this.buttonNextState!=a&&this.options.buttonNextCallback(b,null,a);if(this.buttonPrev.size()>0){this.buttonPrev.unbind(this.options.buttonPrevEvent+ ".jcarousel",this.funcPrev);c&&this.buttonPrev.bind(this.options.buttonPrevEvent+".jcarousel",this.funcPrev);this.buttonPrev[c?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",c?false:true);this.options.buttonPrevCallback!==null&&this.buttonPrev.data("jcarouselstate")!=c&&this.buttonPrev.each(function(){b.options.buttonPrevCallback(b,this,c)}).data("jcarouselstate",c)}else this.options.buttonPrevCallback!==null&&this.buttonPrevState!=c&&this.options.buttonPrevCallback(b, null,c);this.buttonNextState=a;this.buttonPrevState=c},notify:function(a){var c=this.prevFirst===null?"init":this.prevFirst<this.first?"next":"prev";this.callback("itemLoadCallback",a,c);if(this.prevFirst!==this.first){this.callback("itemFirstInCallback",a,c,this.first);this.callback("itemFirstOutCallback",a,c,this.prevFirst)}if(this.prevLast!==this.last){this.callback("itemLastInCallback",a,c,this.last);this.callback("itemLastOutCallback",a,c,this.prevLast)}this.callback("itemVisibleInCallback", a,c,this.first,this.last,this.prevFirst,this.prevLast);this.callback("itemVisibleOutCallback",a,c,this.prevFirst,this.prevLast,this.first,this.last)},callback:function(a,c,b,d,f,j,e){if(!(this.options[a]==null||typeof this.options[a]!="object"&&c!="onAfterAnimation")){var g=typeof this.options[a]=="object"?this.options[a][c]:this.options[a];if(i.isFunction(g)){var k=this;if(d===undefined)g(k,b,c);else if(f===undefined)this.get(d).each(function(){g(k,this,d,b,c)});else{a=function(m){k.get(m).each(function(){g(k, this,m,b,c)})};for(var l=d;l<=f;l++)l!==null&&!(l>=j&&l<=e)&&a(l)}}}},create:function(a){return this.format("<li></li>",a)},format:function(a,c){a=i(a);for(var b=a.get(0).className.split(" "),d=0;d<b.length;d++)b[d].indexOf("jcarousel-")!=-1&&a.removeClass(b[d]);a.addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+c)).css({"float":this.options.rtl?"right":"left","list-style":"none"}).attr("jcarouselindex",c);return a},className:function(a){return a+" "+a+(!this.options.vertical? "-horizontal":"-vertical")},dimension:function(a,c){var b=a.jquery!==undefined?a[0]:a,d=!this.options.vertical?(b.offsetWidth||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginLeft")+h.margin(b,"marginRight"):(b.offsetHeight||h.intval(this.options.itemFallbackDimension))+h.margin(b,"marginTop")+h.margin(b,"marginBottom");if(c==null||d==c)return d;d=!this.options.vertical?c-h.margin(b,"marginLeft")-h.margin(b,"marginRight"):c-h.margin(b,"marginTop")-h.margin(b,"marginBottom");i(b).css(this.wh, d+"px");return this.dimension(b)},clipping:function(){return!this.options.vertical?this.clip[0].offsetWidth-h.intval(this.clip.css("borderLeftWidth"))-h.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-h.intval(this.clip.css("borderTopWidth"))-h.intval(this.clip.css("borderBottomWidth"))},index:function(a,c){if(c==null)c=this.options.size;return Math.round(((a-1)/c-Math.floor((a-1)/c))*c)+1}});h.extend({defaults:function(a){return i.extend(q,a||{})},margin:function(a,c){if(!a)return 0; var b=a.jquery!==undefined?a[0]:a;if(c=="marginRight"&&i.browser.safari){var d={display:"block","float":"none",width:"auto"},f,j;i.swap(b,d,function(){f=b.offsetWidth});d.marginRight=0;i.swap(b,d,function(){j=b.offsetWidth});return j-f}return h.intval(i.css(b,c))},intval:function(a){a=parseInt(a,10);return isNaN(a)?0:a}});i.fn.jcarousel=function(a){if(typeof a=="string"){var c=i(this).data("jcarousel"),b=Array.prototype.slice.call(arguments,1);return c[a].apply(c,b)}else return this.each(function(){i(this).data("jcarousel", new h(this,a))})}})(jQuery);

/*
 * jScrollPane - v2.0.0beta6 - 2010-10-28
 * http://jscrollpane.kelvinluck.com/
 *
 * Copyright (c) 2010 Kelvin Luck
 * Dual licensed under the MIT and GPL licenses.
 */
(function(b,a,c){b.fn.jScrollPane=function(f){function d(C,L){var au,N=this,V,ah,v,aj,Q,W,y,q,av,aB,ap,i,H,h,j,X,R,al,U,t,A,am,ac,ak,F,l,ao,at,x,aq,aE,g,aA,ag=true,M=true,aD=false,k=false,Z=b.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";aE=C.css("paddingTop")+" "+C.css("paddingRight")+" "+C.css("paddingBottom")+" "+C.css("paddingLeft");g=(parseInt(C.css("paddingLeft"))||0)+(parseInt(C.css("paddingRight"))||0);an(L);function an(aH){var aL,aK,aJ,aG,aF,aI;au=aH;if(V==c){C.css({overflow:"hidden",padding:0});ah=C.innerWidth()+g;v=C.innerHeight();C.width(ah);V=b('<div class="jspPane" />').wrap(b('<div class="jspContainer" />').css({width:ah+"px",height:v+"px"}));C.wrapInner(V.parent());aj=C.find(">.jspContainer");V=aj.find(">.jspPane");V.css("padding",0)}else{C.css("width","");aI=C.outerWidth()+g!=ah||C.outerHeight()!=v;if(aI){ah=C.innerWidth()+g;v=C.innerHeight();aj.css({width:ah+"px",height:v+"px"})}aA=V.innerWidth();if(!aI&&V.outerWidth()==Q&&V.outerHeight()==W){if(aB||av){V.css("width",aA+"px");C.css("width",(aA+g)+"px")}return}V.css("width","");C.css("width",(ah)+"px");aj.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}aL=V.clone().css("position","absolute");aK=b('<div style="width:1px; position: relative;" />').append(aL);b("body").append(aK);Q=Math.max(V.outerWidth(),aL.outerWidth());aK.remove();W=V.outerHeight();y=Q/ah;q=W/v;av=q>1;aB=y>1;if(!(aB||av)){C.removeClass("jspScrollable");V.css({top:0,width:aj.width()-g});n();D();O();w();af()}else{C.addClass("jspScrollable");aJ=au.maintainPosition&&(H||X);if(aJ){aG=ay();aF=aw()}aC();z();E();if(aJ){K(aG);J(aF)}I();ad();if(au.enableKeyboardNavigation){P()}if(au.clickOnTrack){p()}B();if(au.hijackInternalLinks){m()}}if(au.autoReinitialise&&!aq){aq=setInterval(function(){an(au)},au.autoReinitialiseDelay)}else{if(!au.autoReinitialise&&aq){clearInterval(aq)}}C.trigger("jsp-initialised",[aB||av])}function aC(){if(av){aj.append(b('<div class="jspVerticalBar" />').append(b('<div class="jspCap jspCapTop" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragTop" />'),b('<div class="jspDragBottom" />'))),b('<div class="jspCap jspCapBottom" />')));R=aj.find(">.jspVerticalBar");al=R.find(">.jspTrack");ap=al.find(">.jspDrag");if(au.showArrows){am=b('<a class="jspArrow jspArrowUp" />').bind("mousedown.jsp",az(0,-1)).bind("click.jsp",ax);ac=b('<a class="jspArrow jspArrowDown" />').bind("mousedown.jsp",az(0,1)).bind("click.jsp",ax);if(au.arrowScrollOnHover){am.bind("mouseover.jsp",az(0,-1,am));ac.bind("mouseover.jsp",az(0,1,ac))}ai(al,au.verticalArrowPositions,am,ac)}t=v;aj.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){t-=b(this).outerHeight()});ap.hover(function(){ap.addClass("jspHover")},function(){ap.removeClass("jspHover")}).bind("mousedown.jsp",function(aF){b("html").bind("dragstart.jsp selectstart.jsp",function(){return false});ap.addClass("jspActive");var s=aF.pageY-ap.position().top;b("html").bind("mousemove.jsp",function(aG){S(aG.pageY-s,false)}).bind("mouseup.jsp mouseleave.jsp",ar);return false});o()}}function o(){al.height(t+"px");H=0;U=au.verticalGutter+al.outerWidth();V.width(ah-U-g);if(R.position().left==0){V.css("margin-left",U+"px")}}function z(){if(aB){aj.append(b('<div class="jspHorizontalBar" />').append(b('<div class="jspCap jspCapLeft" />'),b('<div class="jspTrack" />').append(b('<div class="jspDrag" />').append(b('<div class="jspDragLeft" />'),b('<div class="jspDragRight" />'))),b('<div class="jspCap jspCapRight" />')));ak=aj.find(">.jspHorizontalBar");F=ak.find(">.jspTrack");h=F.find(">.jspDrag");if(au.showArrows){at=b('<a class="jspArrow jspArrowLeft" />').bind("mousedown.jsp",az(-1,0)).bind("click.jsp",ax);x=b('<a class="jspArrow jspArrowRight" />').bind("mousedown.jsp",az(1,0)).bind("click.jsp",ax);if(au.arrowScrollOnHover){at.bind("mouseover.jsp",az(-1,0,at));
x.bind("mouseover.jsp",az(1,0,x))}ai(F,au.horizontalArrowPositions,at,x)}h.hover(function(){h.addClass("jspHover")},function(){h.removeClass("jspHover")}).bind("mousedown.jsp",function(aF){b("html").bind("dragstart.jsp selectstart.jsp",function(){return false});h.addClass("jspActive");var s=aF.pageX-h.position().left;b("html").bind("mousemove.jsp",function(aG){T(aG.pageX-s,false)}).bind("mouseup.jsp mouseleave.jsp",ar);return false});l=aj.innerWidth();ae()}else{}}function ae(){aj.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){l-=b(this).outerWidth()});F.width(l+"px");X=0}function E(){if(aB&&av){var aF=F.outerHeight(),s=al.outerWidth();t-=aF;b(ak).find(">.jspCap:visible,>.jspArrow").each(function(){l+=b(this).outerWidth()});l-=s;v-=s;ah-=aF;F.parent().append(b('<div class="jspCorner" />').css("width",aF+"px"));o();ae()}if(aB){V.width((aj.outerWidth()-g)+"px")}W=V.outerHeight();q=W/v;if(aB){ao=1/y*l;if(ao>au.horizontalDragMaxWidth){ao=au.horizontalDragMaxWidth}else{if(ao<au.horizontalDragMinWidth){ao=au.horizontalDragMinWidth}}h.width(ao+"px");j=l-ao;ab(X)}if(av){A=1/q*t;if(A>au.verticalDragMaxHeight){A=au.verticalDragMaxHeight}else{if(A<au.verticalDragMinHeight){A=au.verticalDragMinHeight}}ap.height(A+"px");i=t-A;aa(H)}}function ai(aG,aI,aF,s){var aK="before",aH="after",aJ;if(aI=="os"){aI=/Mac/.test(navigator.platform)?"after":"split"}if(aI==aK){aH=aI}else{if(aI==aH){aK=aI;aJ=aF;aF=s;s=aJ}}aG[aK](aF)[aH](s)}function az(aF,s,aG){return function(){G(aF,s,this,aG);this.blur();return false}}function G(aH,aF,aK,aJ){aK=b(aK).addClass("jspActive");var aI,s=function(){if(aH!=0){T(X+aH*au.arrowButtonSpeed,false)}if(aF!=0){S(H+aF*au.arrowButtonSpeed,false)}},aG=setInterval(s,au.arrowRepeatFreq);s();aI=aJ==c?"mouseup.jsp":"mouseout.jsp";aJ=aJ||b("html");aJ.bind(aI,function(){aK.removeClass("jspActive");clearInterval(aG);aJ.unbind(aI)})}function p(){w();if(av){al.bind("mousedown.jsp",function(aH){if(aH.originalTarget==c||aH.originalTarget==aH.currentTarget){var aG=b(this),s=setInterval(function(){var aI=aG.offset(),aJ=aH.pageY-aI.top;if(H+A<aJ){S(H+au.trackClickSpeed)}else{if(aJ<H){S(H-au.trackClickSpeed)}else{aF()}}},au.trackClickRepeatFreq),aF=function(){s&&clearInterval(s);s=null;b(document).unbind("mouseup.jsp",aF)};b(document).bind("mouseup.jsp",aF);return false}})}if(aB){F.bind("mousedown.jsp",function(aH){if(aH.originalTarget==c||aH.originalTarget==aH.currentTarget){var aG=b(this),s=setInterval(function(){var aI=aG.offset(),aJ=aH.pageX-aI.left;if(X+ao<aJ){T(X+au.trackClickSpeed)}else{if(aJ<X){T(X-au.trackClickSpeed)}else{aF()}}},au.trackClickRepeatFreq),aF=function(){s&&clearInterval(s);s=null;b(document).unbind("mouseup.jsp",aF)};b(document).bind("mouseup.jsp",aF);return false}})}}function w(){F&&F.unbind("mousedown.jsp");al&&al.unbind("mousedown.jsp")}function ar(){b("html").unbind("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp");ap&&ap.removeClass("jspActive");h&&h.removeClass("jspActive")}function S(s,aF){if(!av){return}if(s<0){s=0}else{if(s>i){s=i}}if(aF==c){aF=au.animateScroll}if(aF){N.animate(ap,"top",s,aa)}else{ap.css("top",s);aa(s)}}function aa(aF){if(aF==c){aF=ap.position().top}aj.scrollTop(0);H=aF;var aI=H==0,aG=H==i,aH=aF/i,s=-aH*(W-v);if(ag!=aI||aD!=aG){ag=aI;aD=aG;C.trigger("jsp-arrow-change",[ag,aD,M,k])}u(aI,aG);V.css("top",s);C.trigger("jsp-scroll-y",[-s,aI,aG])}function T(aF,s){if(!aB){return}if(aF<0){aF=0}else{if(aF>j){aF=j}}if(s==c){s=au.animateScroll}if(s){N.animate(h,"left",aF,ab)}else{h.css("left",aF);ab(aF)}}function ab(aF){if(aF==c){aF=h.position().left}aj.scrollTop(0);X=aF;var aI=X==0,aH=X==j,aG=aF/j,s=-aG*(Q-ah);if(M!=aI||k!=aH){M=aI;k=aH;C.trigger("jsp-arrow-change",[ag,aD,M,k])}r(aI,aH);V.css("left",s);C.trigger("jsp-scroll-x",[-s,aI,aH])}function u(aF,s){if(au.showArrows){am[aF?"addClass":"removeClass"]("jspDisabled");ac[s?"addClass":"removeClass"]("jspDisabled")}}function r(aF,s){if(au.showArrows){at[aF?"addClass":"removeClass"]("jspDisabled");
x[s?"addClass":"removeClass"]("jspDisabled")}}function J(s,aF){var aG=s/(W-v);S(aG*i,aF)}function K(aF,s){var aG=aF/(Q-ah);T(aG*j,s)}function Y(aR,aM,aG){var aK,aH,aI,s=0,aQ=0,aF,aL,aO,aN,aP;try{aK=b(aR)}catch(aJ){return}aH=aK.outerHeight();aI=aK.outerWidth();aj.scrollTop(0);aj.scrollLeft(0);while(!aK.is(".jspPane")){s+=aK.position().top;aQ+=aK.position().left;aK=aK.offsetParent();if(/^body|html$/i.test(aK[0].nodeName)){return}}aF=aw();aL=aF+v;if(s<aF||aM){aN=s-au.verticalGutter}else{if(s+aH>aL){aN=s-v+aH+au.verticalGutter}}if(aN){J(aN,aG)}viewportLeft=ay();aO=viewportLeft+ah;if(aQ<viewportLeft||aM){aP=aQ-au.horizontalGutter}else{if(aQ+aI>aO){aP=aQ-ah+aI+au.horizontalGutter}}if(aP){K(aP,aG)}}function ay(){return -V.position().left}function aw(){return -V.position().top}function ad(){aj.unbind(Z).bind(Z,function(aI,aJ,aH,aF){var aG=X,s=H;T(X+aH*au.mouseWheelSpeed,false);S(H-aF*au.mouseWheelSpeed,false);return aG==X&&s==H})}function n(){aj.unbind(Z)}function ax(){return false}function I(){V.unbind("focusin.jsp").bind("focusin.jsp",function(s){if(s.target===V[0]){return}Y(s.target,false)})}function D(){V.unbind("focusin.jsp")}function P(){var aF,s;C.attr("tabindex",0).unbind("keydown.jsp").bind("keydown.jsp",function(aJ){if(aJ.target!==C[0]){return}var aH=X,aG=H,aI=aF?2:16;switch(aJ.keyCode){case 40:S(H+aI,false);break;case 38:S(H-aI,false);break;case 34:case 32:J(aw()+Math.max(32,v)-16);break;case 33:J(aw()-v+16);break;case 35:J(W-v);break;case 36:J(0);break;case 39:T(X+aI,false);break;case 37:T(X-aI,false);break}if(!(aH==X&&aG==H)){aF=true;clearTimeout(s);s=setTimeout(function(){aF=false},260);return false}});if(au.hideFocus){C.css("outline","none");if("hideFocus" in aj[0]){C.attr("hideFocus",true)}}else{C.css("outline","");if("hideFocus" in aj[0]){C.attr("hideFocus",false)}}}function O(){C.attr("tabindex","-1").removeAttr("tabindex").unbind("keydown.jsp")}function B(){if(location.hash&&location.hash.length>1){var aG,aF;try{aG=b(location.hash)}catch(s){return}if(aG.length&&V.find(aG)){if(aj.scrollTop()==0){aF=setInterval(function(){if(aj.scrollTop()>0){Y(location.hash,true);b(document).scrollTop(aj.position().top);clearInterval(aF)}},50)}else{Y(location.hash,true);b(document).scrollTop(aj.position().top)}}}}function af(){b("a.jspHijack").unbind("click.jsp-hijack").removeClass("jspHijack")}function m(){af();b("a[href^=#]").addClass("jspHijack").bind("click.jsp-hijack",function(){var s=this.href.split("#"),aF;if(s.length>1){aF=s[1];if(aF.length>0&&V.find("#"+aF).length>0){Y("#"+aF,true);return false}}})}b.extend(N,{reinitialise:function(aF){aF=b.extend({},aF,au);an(aF)},scrollToElement:function(aG,aF,s){Y(aG,aF,s)},scrollTo:function(aG,s,aF){K(aG,aF);J(s,aF)},scrollToX:function(aF,s){K(aF,s)},scrollToY:function(s,aF){J(s,aF)},scrollBy:function(aF,s,aG){N.scrollByX(aF,aG);N.scrollByY(s,aG)},scrollByX:function(s,aG){var aF=ay()+s,aH=aF/(Q-ah);T(aH*j,aG)},scrollByY:function(s,aG){var aF=aw()+s,aH=aF/(W-v);S(aH*i,aG)},animate:function(aF,aI,s,aH){var aG={};aG[aI]=s;aF.animate(aG,{duration:au.animateDuration,ease:au.animateEase,queue:false,step:aH})},getContentPositionX:function(){return ay()},getContentPositionY:function(){return aw()},getIsScrollableH:function(){return aB},getIsScrollableV:function(){return av},getContentPane:function(){return V},scrollToBottom:function(s){S(i,s)},hijackInternalLinks:function(){m()}})}f=b.extend({},b.fn.jScrollPane.defaults,f);var e;this.each(function(){var g=b(this),h=g.data("jsp");if(h){h.reinitialise(f)}else{h=new d(g,f);g.data("jsp",h)}e=e?e.add(g):g});return e};b.fn.jScrollPane.defaults={showArrows:false,maintainPosition:true,clickOnTrack:true,autoReinitialise:false,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,animateScroll:false,animateDuration:300,animateEase:"linear",hijackInternalLinks:false,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:10,arrowButtonSpeed:10,arrowRepeatFreq:100,arrowScrollOnHover:false,trackClickSpeed:30,trackClickRepeatFreq:100,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:true,hideFocus:false}
})(jQuery,this);



/*!
 * jQuery UI 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.6",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
 * jQuery UI Widget 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*
 * jQuery UI Accordion 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var f=d.closest(".ui-accordion-header");a.active=f.length?f:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion",
function(g){return a._keydown(g)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(g){a._clickHandler.call(a,g,this);g.preventDefault()})},_createIcons:function(){var a=this.options;if(a.icons){c("<span></span>").addClass("ui-icon "+
a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex");
this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons();
b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,f=this.headers.index(a.target),g=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:g=this.headers[(f+1)%d];break;case b.LEFT:case b.UP:g=this.headers[(f-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target);
a.preventDefault()}if(g){c(a.target).attr("tabIndex",-1);c(g).attr("tabIndex",0);g.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+
c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options;
if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);
a.next().addClass("ui-accordion-content-active")}h=a.next();f=this.active.next();g={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):h,oldContent:f};d=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(h,f,g,b,d)}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
this.active.next().addClass("ui-accordion-content-active");var f=this.active.next(),g={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:f},h=this.active=c([]);this._toggle(h,f,g)}},_toggle:function(a,b,d,f,g){var h=this,e=h.options;h.toShow=a;h.toHide=b;h.data=d;var j=function(){if(h)return h._completed.apply(h,arguments)};h._trigger("changestart",null,h.data);h.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&f?{toShow:c([]),toHide:b,complete:j,
down:g,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:g,autoHeight:e.autoHeight||e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;f=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!f[k]&&!c.easing[k])k="slide";f[k]||(f[k]=function(l){this.slide(l,{easing:k,duration:i||700})});
f[k](d)}else{if(e.collapsible&&f)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.6",animations:{slide:function(a,
b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),f=0,g={},h={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){h[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/);g[i]={value:j[1],
unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(h,{step:function(j,i){if(i.prop=="height")f=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=f*g[i.prop].value+g[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide",paddingTop:"hide",
paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
;


/*
 * jQuery UI Effects 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/
 */
jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:f.fx.speeds[b]||f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor",
"borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,
0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],
lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,d){if(f.isFunction(b)){d=
b;b=null}return this.each(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("className");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("className",v);e.animate(u(h,r),a,b,function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)})})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?
f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,
[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.6",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=
0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,
{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=
k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=
k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,
a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*
(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,
a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,
a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+
d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==
j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*
(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
;/*
 * jQuery UI Effects Fade 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Fade
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Slide 1.8.6
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Slide
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","left"],e=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(e=="show")a.css(f,b=="pos"?-g:g);var i={};i[f]=(e=="show"?b=="pos"?
"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;


/////////////////////////////////////////////////////////////////////////// SMALL SLIDES ///////
(function($){  
	$.fn.singleElementViewSlideshow = function() {
		var itemContainer = this;
		var itemCounter = 0;
		$(itemContainer).children(".slide").each(function() {
			$(this).attr("index", ++itemCounter);
		});
		$(itemContainer).children(".slide:not(.active)").fadeOut('normal');
		$(itemContainer).children(".slide:first").addClass("active").fadeIn();
		if (itemCounter > 1) {
			$(itemContainer).find("div.nav").children().click(function(el) {
				el.preventDefault();
				itemCounter = this;
				$(itemContainer).children(".slide.active").cycle({direction: $(itemCounter).attr("class")}).fadeIn(0);
				$(itemContainer).children(".slide.active").stop(true,true).fadeOut(300, function()
				{
					$(this).removeClass('active');
					$(this).cycle({direction: $(itemCounter).attr("class")}).addClass('active');
					$(this).siblings('.more').attr('href', $(this).siblings('.active').children('a').attr('href') );
				});
			});
		}
		else
		{
			$(itemContainer).find("div.nav").hide();	
		}
	};
})(jQuery);

(function($){  
	$.fn.cycle = function(options) {
		var opts = $.extend({}, $.fn.cycle.defaults, options);
		if (opts.direction == 'next') {
			if ($(this).next(".slide").length > 0) return $(this).next(".slide"); else { return $(this).siblings('.slide:first'); }
		} else if (opts.direction == 'previous') {
			if ($(this).prev(".slide").length > 0) return $(this).prev(".slide"); else return $(this).siblings('.slide:last');
		}
	};
})(jQuery);
// END OF SMALL SLIDES //

//HOME PAGE BIG SLIDE //
(function($){
	$.fn.slideshow = function(options) {
		
         var  defaults = {  
			 repeat: true,
			 timer: 4500
           },  
          opts = $.extend({}, defaults, options); 
		
         $(".button a", "#slideshow_wrapper").each(function(){
             
           	if( $(this).html().length <=  5) $(this).parent().remove();
           });
         
		$("div#buttons ul li:eq(0) a").addClass("active");
			$(".scontainer:eq(0)").fadeIn(0);
			var myIndex = 0;
			
	    if ($.browser.msie && ($.browser.version >= "8.0")) {
			$(".scontainer img").css('filter','inherit');
			
		if(opts.repeat) {
			repeat = setInterval(function(){
						$("div#buttons ul li:eq("+myIndex+") a").removeClass("active");
						$(".scontainer:eq("+myIndex+") .content_outer").fadeOut(0);
						$(".scontainer:eq("+myIndex+"):not(.content_outer)").fadeOut(660, function(){  $(this).children(".content_outer").css("display","table"); });
						myIndex++;
						if(myIndex>=3){myIndex=0; clearInterval(repeat); }
						$("div#buttons ul li:eq("+myIndex+") a").addClass("active");
						$(".scontainer:eq("+myIndex+"):not(.content_outer)").fadeIn(240);	
			}, opts.timer);
		}
		
			$(this).click( function() {		
				if(opts.repeat) clearInterval(repeat);
				if( myIndex != $(this).closest("li").index() )
				{
					$("div#buttons ul li:eq("+myIndex+") a").removeClass("active");
					$(this).addClass("active");
					$(".scontainer:eq("+myIndex+") .content_outer").fadeOut(0);
					$(".scontainer:eq("+myIndex+"):not(.content_outer)").fadeOut(660, function(){  $(this).children(".content_outer").css("display","table"); });
					
					myIndex = $(this).closest("li").index();
					$(".scontainer:eq("+myIndex+"):not(.content_outer)").fadeIn(240);
				}
			});
			
		}

		else{
		if(opts.repeat) {	
			repeat = setInterval(function(){
						$("div#buttons ul li:eq("+myIndex+") a").removeClass("active");
						$(".scontainer:eq("+myIndex+")").fadeOut(700);
						myIndex++;
						if(myIndex>=3){myIndex=0; clearInterval(repeat); }
						$("div#buttons ul li:eq("+myIndex+") a").addClass("active");
						$(".scontainer:eq("+myIndex+")").fadeIn(330);	
						
			}, opts.timer);
		}
			
			$(this).click( function() {	
				if(opts.repeat) clearInterval(repeat);
				if( myIndex != $(this).closest("li").index() )
				{
					$("div#buttons ul li:eq("+myIndex+") a").removeClass("active");
					$(this).addClass("active");
					$(".scontainer:eq("+myIndex+")").fadeOut(700);
					
					//$(".scontainer:eq("+myIndex+")").animate({/*'margin-left':-10,*/'opacity':'0'},1000/*,'swing'*/);
					myIndex = $(this).closest("li").index();
					$(".scontainer:eq("+myIndex+")").fadeIn(330);
				}
			});
		}
	};
})(jQuery);


// Inner Page Slide (to be turned into a modular script soon
(function($){
	$.fn.slide = function() {
		var myIndex = 0;
		var Container = this;
		var who;
		var who2;
		var clickEd;
		who = $(Container).children("div.slide_item:eq(0)");
		$(who).addClass("current").fadeIn(0);	
		if($(who).html()!=null){
		if( $(who).children("p").children("span").html().length>3)
		$(who).children("p").animate({"height":'0'}, 950).fadeIn(0, function(){$(this).animate({"height":"44"});});
		else
		$(who).children("p").animate({"height":'0'}, 0).fadeIn(0); 
		}
		who2 = $(Container).children("div.slide_item");
		if( $(who2).length<=1 )
			$(Container).children(".nav").hide();
		
		who = $(Container).children("div.slide_item:eq("+myIndex+")");
		$(this).find("div.nav").children().click(function(el) {
			el.preventDefault();
			var clickEd = this;
			
			if( $(who).removeClass("current").children("p").children("span").html().length<=3) {
			$(who).fadeOut(400);
				if($(clickEd).attr("class") == "previous")
				{
					if(myIndex==0) myIndex = $(who2).length-1; else myIndex--;
				}
				if($(clickEd).attr("class") == "next")
				{
					if( myIndex==$(who2).length-1 ) myIndex = 0; else myIndex++;
				}
				who = $(Container).children("div.slide_item:eq("+myIndex+")");
				$(who).addClass("current").stop(true,true).fadeIn(400, function(){ $(this).children("p").animate({"height":"0"}, 0, function(){ 
																	if($(this).children("span").html().length>3)									 
																	$(this).animate({"height":"44"}); });						 
			}); }
			else
			$(who).removeClass("current").children("p").stop(true,true).animate({"height":"0"}, function(){ $(this).parent().fadeOut(400);
				if($(clickEd).attr("class") == "previous")
				{
					if(myIndex==0) myIndex = $(who2).length-1; else myIndex--;
				}
				if($(clickEd).attr("class") == "next")
				{
					if( myIndex==$(who2).length-1 ) myIndex = 0; else myIndex++;

				}
				who = $(Container).children("div.slide_item:eq("+myIndex+")");
				
				$(who).children("p").css({"height":"0"});
				$(who).addClass("current").stop(true,true).fadeIn(400, function(){ $(this).children("p").animate({"height":"0"}, 0, function(){ 
																	if($(this).children("span").html().length>3)									 
																	$(this).animate({"height":"44"}); }); }).siblings('.current').removeClass('current').hide();	
			});																
		});
	};
})(jQuery);

(function($){
	$.fn.tabs = function(options) {
		var opts = $.extend({}, $.fn.tabs.defaults, options);
		var myIndex=-1;
		var Container = this;
		if( $(".tabs_navigation").length){
			$(".tabs_navigation li div.category").each( function(){							  
				if( $(this).hasClass("selected-active") )
				{
					myIndex = $(this).closest("li").index();
					$(opts.content+":eq("+myIndex+")").show().removeClass("hide");
				}
			});
			
			if(myIndex==-1) {
				Container = 1;
				if( $(opts.content).hasClass("default-message")==true )
				{ }
				else {
				$(opts.content+":eq(0)").show().removeClass("hide");
				$(".tabs_navigation  ul.mycarousel li:eq(0) div.category").addClass("selected-active"); }
			}
			Container = myIndex+1;
			jQuery('.tabs_navigation .mycarousel').jcarousel({
				scroll: 3,
				start: Container,
				buttonPrevHTML: '<a href="javascript: void(0);" class="previous_item">Previous</a>',
				buttonNextHTML: '<a href="javascript: void(0);" class="next_item">Next</a>'
			});
		}
		
		Container = this;
		$(".getPlan:last").css("display","block");
		$(".getPlan p.button").css("display","none");
		$(".tabs_navigation li .category").click( function() {	
			if($(opts.content).hasClass("default-message")) {							   
				$(opts.content).removeClass("default-message").fadeOut(0);
				myIndex = -1;	
			}
			
			if($(this).closest("li").index()!=myIndex)
			{ 
			$(opts.content).removeClass("default-message").fadeOut(0);
				Container = this;
				if( myIndex==-1 )
				{
					myIndex = $(Container).closest("li").index();
					$(opts.content+":eq("+myIndex+")").fadeIn(function(){ $(this).find(".getPlan").fadeIn(700, function(){ $(this).children("p.button").fadeIn(230); }); }).removeClass("hide");
				}
				else
				{
				$(opts.content+":eq("+myIndex+")").fadeOut(180, function() {
					if ($(this).find('.videoplayer').length > 0) {
						if( $.browser.msie ) { 
							getFlashMovie($(this).find('object:first').attr('id')).stopVideo(); 
						} 
					}																		 
					myIndex = $(Container).closest("li").index();
					$(this).find(".getPlan").css("display","none").children("p.button").css("display","none");
					
					$(opts.content+":eq("+myIndex+")").fadeIn(function(){ $(this).find(".getPlan").fadeIn(700, function(){ $(this).children("p.button").fadeIn(230); }); }).removeClass("hide");													 
				}).addClass("hide");
				}
			
			}
		});
	};
})(jQuery);




/*SELECT BOX*/
jQuery.fn.selectbox = function(options){
	
	/*if( $(".continentSelect option").length ) {
	
	if( $(".continentSelect option").val() == 0)
	{ }
	else {
	

			if( $(".continentSelect option").attr("selected")==false ) {
				$(".continentSelect").prepend('<option value="0">Select Location...</option>'); 
				}
			else {
				$(".continentSelect").prepend('<option value="0" selected="selected">Select Location...</option>');
				$("select.continentSelect").attr('selectedIndex', 0);
			}
		}
	}*/
	var L = 0;
	/* Default settings */
	var settings = {
		className: 'jquery-selectbox',
		animationSpeed: "normal",
		listboxMaxSize: 10,
		replaceInvisible: false
	};
	var commonClass = 'jquery-custom-selectboxes-replaced';
	var listOpen = false;
	var thisListElement;
	var cc = $(this).children("option").length;

	var myItemSize = $(".jquery-custom-selectboxes-replaced-list:eq(0)").find(".jquery-selectbox-item").length;
	
	if( cc<=1 )
	{
		$("form.year_select").fadeTo(0, 0.4);
	}

	/*    $("."+settings.className+":eq(0)").attr("tabindex", 1);
	    	if( $("#jTextbox").length > 0 ) {
			$("#jTextbox2").val( $("#jTextbox option:eq(0)").val() );	           
		}
    
    $("."+settings.className+":eq(0)").keypress(function(e) {
          if ((e.keyCode || e.which) == 40)  {
             L++;
             if(L>myItemSize-1 ) L=myItemSize-1;
             else {
              		$('.item-'+L+":eq(0)").trigger("click");
            $(".jquery-selectbox-list").slideUp(0);
            }
          }
          if ((e.keyCode || e.which) == 38)  {
             L--;
             if(L<0) L=0;
             else {
              	$('.item-'+L+":eq(0)").trigger("click");
            $(".jquery-selectbox-list").slideUp(0);
          }
          }
    });	*/
	var showList = function(listObj) {
		var selectbox = listObj.parents('.' + settings.className + '');
		if(cc>1) {
		listObj.slideDown(settings.animationSpeed, function(){
			listOpen = true;
		});
		selectbox.addClass('selecthover');
		jQuery(document).bind('click', onBlurList);
		}
		//listObj.append("<div class='xClose'><a href='javascript:' onclick='hideItDude()'></a></div>");
		
		return listObj;
	}
	var hideList = function(listObj) {
		var selectbox = listObj.parents('.' + settings.className + '');
		
		listObj.slideUp(settings.animationSpeed, function(){
			//$("div.xClose").remove();
			listOpen = false;
			jQuery(this).parents('.' + settings.className + '').removeClass('selecthover');
		});
		jQuery(document).unbind('click', onBlurList);
		return listObj;
	}
	var onBlurList = function(e) {
		var trgt = e.target;
		var currentListElements = jQuery('.' + settings.className + '-list:visible').parent().find('*').andSelf();
		if(jQuery.inArray(trgt, currentListElements)<0 && listOpen) {
			hideList( jQuery('.' + commonClass + '-list') );
		}
		return false;
	}
	
	/* Processing settings */
	settings = jQuery.extend(settings, options || {});
	
	/* Wrapping all passed elements */
	return this.each(function() {
		var _this = jQuery(this);
		if(_this.filter(':visible').length == 0 && !settings.replaceInvisible)
			return;

		var replacement = jQuery(
			'<div class="' + settings.className + ' ' + commonClass + '">' +
				'<div class="' + settings.className + '-moreButton" />' +
				'<div class="' + settings.className + '-list ' + commonClass + '-list " />' +
				'<span class="' + settings.className + '-currentItem" />' +
			'</div>'
		);
		
		jQuery('option', _this).each(function(k,v){

										  
			var v = jQuery(v);				  
			var listElement =  jQuery('<span class="' + settings.className + '-item value-'+v.val()+' item-'+k+'">' + v.text() + '</span>');	
			listElement.click(function(){
			
			if( $("#jTextbox").length > 0 ) {
			$("#jTextbox2").val( $("#jTextbox option:eq("+listElement.index()+")").val() );	   
			}

									   L=k;
				thisListElement = jQuery(this);
				var thisReplacment = thisListElement.parents('.'+settings.className);
				var thisIndex = thisListElement[0].className.split(' ');
				for( k1 in thisIndex ) {
					if(/^item-[0-9]+$/.test(thisIndex[k1])) {
						thisIndex = parseInt(thisIndex[k1].replace('item-',''), 10);
						break;
					}
				};
				var thisValue = thisListElement[0].className.split(' ');
				for( k1 in thisValue ) {
					if(/^value-.+$/.test(thisValue[k1])) {
						thisValue = thisValue[k1].replace('value-','');
						break;
					}
				};
				thisReplacment
					.find('.' + settings.className + '-currentItem')
					.text(thisListElement.text());
				thisReplacment
					.find('select')
					.val(thisValue)
					.triggerHandler('change');
				var thisSublist = thisReplacment.find('.' + settings.className + '-list');
				if(thisSublist.filter(":visible").length > 0) {


					hideList( thisSublist );
				}else{
					showList( thisSublist );
				}
			}).bind('mouseenter',function(){
				jQuery(this).addClass('listelementhover');
			}).bind('mouseleave',function(){
				jQuery(this).removeClass('listelementhover');
			});
			jQuery('.' + settings.className + '-list', replacement).append(listElement);
			if(v.filter(':selected').length > 0) {
				jQuery('.'+settings.className + '-currentItem', replacement).text(v.text());
			}
		});
		
			replacement.find('.' + settings.className + '-moreButton').click(function(){
																				  

			
			var thisMoreButton = jQuery(this);
			var otherLists = jQuery('.' + settings.className + '-list')
				.not(thisMoreButton.siblings('.' + settings.className + '-list'));
			hideList( otherLists );
			var thisList = thisMoreButton.siblings('.' + settings.className + '-list');
			if(thisList.filter(":visible").length > 0) {
				hideList( thisList );
			}else{
				showList( thisList );
			}
			
		}).bind('mouseenter',function(){
			jQuery(this).addClass('morebuttonhover');
		}).bind('mouseleave',function(){

			jQuery(this).removeClass('morebuttonhover');
		});
		_this.hide().replaceWith(replacement).appendTo(replacement);
		if( cc<=1 )
		{
		 if ($.browser.msie && ($.browser.version >= "8.0")) { $("form.year_select").fadeTo(0, 0.4);
			$(".jquery-selectbox").fadeTo(0, 0.4); }
		else
			$("form.year_select").fadeTo(0, 0.4);
		}

		var thisListBox = replacement.find('.' + settings.className + '-list');
		var thisListBoxSize = thisListBox.find('.' + settings.className + '-item').length;
		if(thisListBoxSize > settings.listboxMaxSize)
			thisListBoxSize = settings.listboxMaxSize;
		if(thisListBoxSize == 0)
			thisListBoxSize = 1;	
		var thisListBoxWidth = 54; //Math.round(_this.width() + 5);
		if(jQuery.browser.safari)
			thisListBoxWidth = thisListBoxWidth;
		if ($.browser.msie && ($.browser.version == "6.0")) 
			thisListBoxWidth = 62;
		replacement.css('width', thisListBoxWidth + 'px');
		thisListBox.css({
			width: Math.round(thisListBoxWidth-4) + 'px',
			height:  thisListBoxSize*21+'px'
		});
	});
}
jQuery.fn.unselectbox = function(){
	var commonClass = 'jquery-custom-selectboxes-replaced';
	return this.each(function() {
		var selectToRemove = jQuery(this).filter('.' + commonClass);
		selectToRemove.replaceWith(selectToRemove.find('select').show());		
	});
}


$.jCarouselFade = function()
{
	// the number of milliseconds to spend fading in:
	var fadeInTime = 1000;
	// the number of milliseconds to spend fading out:
	var fadeOutTime = 1000;
	
	return {
		beforeAnimationHandler : function(carousel, first, last, prevFirst, prevLast, size)
		{
			if (prevFirst == 0) {
				// first time this is called, set the opacity of all above the field of view to none.
				for (var i=last+1; i<=size; i++) {
					carousel.get(i).css({opacity:.01});
				}
			}
			if (first < prevFirst) {
				for (var i=first; i<prevFirst; i++) {
					carousel.get(i).animate({opacity:1}, fadeInTime);
				}
			} else {
				for (var i=prevFirst; i<first; i++) {
					carousel.get(i).animate({opacity:.01}, fadeOutTime);
				}
			}
			if (last < prevLast) {
				for (var i=last+1; i<=prevLast; i++) {
					carousel.get(i).animate({opacity:.01}, fadeOutTime);
				}
			} else {
				for (var i=prevLast+1; i<=last; i++) {
					carousel.get(i).animate({opacity:1}, fadeInTime);
				}
			}
			return;
		}
	}
}();
$.fn.jCarouselFade = function(configObject)
{
	if (configObject.beforeAnimationHandler) {
		// preserve existing handler
		var oldBeforeAnimationHandler = configObject.beforeAnimationHandler;
		configObject.beforeAnimationHandler = function()
		{
			oldBeforeAnimationHandler();
			$.jCarouselFade.beforeAnimationHandler();
		};
	} else {
		configObject.beforeAnimationHandler = $.jCarouselFade.beforeAnimationHandler;
	}
	
	return this.each(function() {
		var jc = new jQuery.jcarousel(this, configObject);
    });
}

//Sponsors Carousel
$.fn.sponsorsCarousel = function(time){
	var icounterC=1;
	//$childCount = $("#sponsors .sponsors_carousel li").length;
	if ($.browser.msie && ($.browser.version <= "8.0"))
		setInterval("nextLevel(90)", time);        
	else
		setInterval("nextLevel(78)", time); 
}
function nextLevel(hmm){
	
	$this = $("#sponsors .sponsors_carousel");
	var mHeight=82;
	
	if( $this.children("li:eq(0)").height() >= 120)
	{
		//if(icounterC==undefined){icounterC=1;}
		if( $this.children("li:eq(0)").height()<=((icounterC)*hmm) )
		{
			if ($.browser.msie && ($.browser.version >= "6.0")) {
				//$this.children("li:eq(1)").fadeTo(0,0).children("h3").fadeTo(0,0);
				$this.children(":eq(0)").fadeTo(2000,0).children("h3").fadeTo(2000,0);
				$this.animate({"top":(-1)*$this.children("li:eq(0)").outerHeight()},3000, function(){ $(this).animate({"top":0},0, function(){$(this).children("li:eq(0)").appendTo($(this));}) });
				$this.children(":eq(1)").fadeTo(2900,1).children("h3").fadeTo(3000,1);
			}
			else{
				//$this.children("li:eq(1)").fadeOut(0);
				$this.children(":eq(0)").fadeOut(3100);
				$this.animate({"top":(-1*$this.children("li:eq(0)").outerHeight()) },3000, function(){ $(this).animate({"top":0},0, function(){$(this).children("li:eq(0)").appendTo($(this));}) });
				
				$this.children(":eq(1)").fadeIn(2900);
			}	
			icounterC=1;
		}
		else {
			if ($.browser.msie) {
				if($.browser.version >= "8.0" )
				{
					$this.children("li:eq(1)").fadeTo(0,0).children("h3").fadeTo(0,0);
					//$this.children(":eq(0)").fadeTo(2000,0).children("h3").fadeTo(2000,0);
					$this.children(":eq(0)").find('ul').animate({"top":(-1)*60*icounterC},3000);
					$this.find("ul:not(:eq(0))").animate({"top":0},0);
					//$this.children(":eq(1)").fadeTo(2800,1).children("h3").fadeTo(3000,1);
				}
				else
				{
					$this.children("li:eq(1)").fadeTo(0,0).children("h3").fadeTo(0,0);
					//$this.children(":eq(0)").fadeTo(2000,0).children("h3").fadeTo(2000,0);
					$this.children(":eq(0)").find('ul').animate({"top":(-1)*80*icounterC},3000);
					$this.find("ul:not(:eq(0))").animate({"top":0},0);
					//$this.children(":eq(1)").fadeTo(2800,1).children("h3").fadeTo(3000,1);
					
				}
			}
			else{
				$this.children("li:eq(1)").fadeOut(0);
				//$this.children(":eq(0)").fadeOut(3100);
				$this.children(":eq(0)").find('ul').animate({"top":(-1)*66*icounterC},3000);
				$this.find("ul:not(:eq(0))").animate({"top":0},0);
				//$this.children(":eq(1)").fadeIn(2900);
			}
			icounterC++;
		}
		
		
	}
	else
	{	icounterC=1;
		if ($.browser.msie && ($.browser.version >= "6.0")) {
			$this.children("li:eq(1)").fadeTo(0,0).children("h3").fadeTo(0,0);
			$this.children(":eq(0)").fadeTo(2000,0).children("h3").fadeTo(2000,0);
			$this.animate({"top":(-1)*mHeight},3000, function(){ $(this).animate({"top":0},0, function(){$(this).children("li:eq(0)").appendTo($(this));}) });
			$this.children(":eq(1)").fadeTo(2800,1).children("h3").fadeTo(3000,1);
			$this.children("li:eq(0)").fadeTo(400,1);
		}
		else{
			$this.children("li:eq(1)").fadeOut(0);
			$this.children(":eq(0)").fadeOut(3100);
			$this.animate({"top":(-1*$this.children("li:eq(0)").outerHeight())},3000, function(){ $(this).animate({"top":0},0, function(){$(this).children("li:eq(0)").appendTo($(this));}) });
			$this.children(":eq(1)").fadeIn(2900);
			$this.children("li:eq(0)").fadeTo(400,1);
		}
	}
}
