// prevent console.log casuign errors in browser without firebug.
if(typeof(console) === 'undefined') {
    var console = {}
    console.log = console.error = console.info = console.debug = console.warn = console.trace = console.dir = console.dirxml = console.group = console.groupEnd = console.time = console.timeEnd = console.assert = console.profile = function() {};
}

function sbAlert(msg,type,title){
	var bodyClass = $('body').attr('class');
	if(bodyClass != "ajaxed"){ $('body').addClass('ajaxed').append('<div id="ajax"></div>'); }
	// type : warning(red), success(green), alert(yellow), ''(grey)
	if(type==undefined){ type=''; }
	if(title==undefined){ title='Warning'; }
	if(msg==undefined){ msg='This is a message placeholder.'; }
	$('#ajax').append('<div id="innerPopup" class="ajax-alert"><div id="alert" class="plugin '+type+'"><h2 class="title">'+title+'<a href="#" class="ajax-close AJAXCLOSEjs">x</a></h2><div class="inner-wrapper"><div class="block-wrapper">'+msg+'</div></div></div></div>');
}
function sbPopup(rel,loadType){
		// determine if ajax isset
		var bodyClass = $('body').attr('class');
		if(bodyClass != "ajaxed"){ $('body').addClass('ajaxed').append('<div id="ajax"></div>'); }
		//empty the ajax div beofre loading anything else into it
		$("#ajax").html('');
		$('body').append('<div id="loading">');
		
		if(navigator.appName.search('Explorer') == 0 || navigator.appName.search('Explorer') == 'undefined') { // ie(6) needs a scroll up
			scroll(0,0);
		}

		if(loadType == "href"){
			$('#ajax').fadeIn().load(''+rel+'',
			function(){
				$('#ajax h2.title').append('<a href="#" class="ajax-close AJAXCLOSEjs">x</a>');
				$('#loading').remove();
			});
		} else {
			$('#ajax').show().append('<div id="'+loadType+'" class="ajax-'+rel+'"></div>');
			$('.ajax-'+rel+'').fadeIn().load(''+parent.location.protocol+'//'+window.location.hostname+'/en/index/plug-'+rel+'',
			function(){
				$('.ajax-'+rel+' .plugin h2.title').append('<a href="#" class="ajax-close AJAXCLOSEjs">x</a>');
				$('#loading').remove();
			});
		}
	}
	
	function limitText(limitField, limitCount, limitNum) {
// this is for limiting the input length of input and text boxes
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	} else {
		$("#"+limitCount).html(limitNum - limitField.value.length);
	}
	return false;
}
	
$(function() {	
/////////////////////////////////////////////////////
/// vouchers basic ///
/////////////////////////////////////////////////////
	$('.vouchers .quantity').live('focus', function(){ 
		this.value = '';
	});
	$('.vouchers .quantity').live('blur', function(){ 
		var parentID = $(this).parent().parent().attr("id");
		var voucherQuantity = $("#"+parentID+" .quantity").val();									   
		if(voucherQuantity==""){ this.value = '1'; }
	});
	$('.vouchers button').live('click', function() {
		var parentID = $(this).parent().parent().parent().attr("id");
		var voucherQuantity = $("#"+parentID+" .quantity").val();
		var voucherPrice = $("#"+parentID+" .VOUCHERPRICEjs").val();
		var voucherTotal = Number(voucherPrice)*Number(voucherQuantity);
		$("#"+parentID+" .voucher-total").empty().append('<input type="hidden" value="'+voucherTotal+'" name="subtotal"/><input type="hidden" value="'+voucherTotal+'.00" name="total"/>');
	});
/////////////////////////////////////////////////////
/// venues select ///
/////////////////////////////////////////////////////
	$('.venues-list-select select').live('change', function() {
		var href = $("option:selected", $('.venues-list-select select') ).val();
		if(href!=""){ location.href = href ; }
		return false;			  
	});
/////////////////////////////////////////////////////
/// build info ///
/////////////////////////////////////////////////////
	$('#venue-prices-basic .formats-list-basic .block-wrapper').hide(0);
	$('#venue-prices-basic .formats-menu li a').live('click', function() {
		var rel = $(this).attr('rel');
		$('#venue-prices-basic .formats-menu li').removeClass('current');
		$(this).parent().addClass('current');
		$('#venue-prices-basic .formats-list-basic .block-wrapper').hide();
		$('#venue-prices-basic #'+rel+'').show();
		$('#venue-prices-basic #'+rel+' .block-wrapper').show().attr('id','');
		$('#venue-prices-basic #'+rel+' .READMORECONTENTjs').hide();
		return false;
	});
/////////////////////////////////////////////////////
/// build info ///
/////////////////////////////////////////////////////
	$('#build-menu li a').live('click', function() {
		var li = $(this).parent();
		var liValue = $(this).attr('rev');
		var ul = $(this).parent().parent();
		var tab = (ul).children();
		var wrapper = $(this).parent().parent().parent().attr('id');
		var wrapperClass = $(this).parent().parent().parent().attr('class');
		var rel = $(this).attr('rel');
		var container = '#'+wrapper+' .'+rel;
		var href = $(this).attr('href');
		var node = '#'+wrapper+' '+href+'';
		var selected = $(this).parent().attr('class');
		if(selected=="tab-selected"){
		} else {
			if(wrapperClass=="build-hide"){
				$('#build-info').attr('class','build-show');	
				$('#build-info .control').empty().append('Hide');
			}
			// this identifies any links not part of the tab structure
			$(container).hide(0).removeClass('tabs-selected');
			$(tab).removeClass('tab-selected');
			$(li).addClass('tab-selected');
			if(rel == "tabs-ajax-container"){
				$(node).show(0).addClass('tabs-selected').load('http://'+window.location.hostname+'/en/index/plug-'+liValue+'');
			} else {
				$(node).show(0).addClass('tabs-selected');
			}	
		}
		return false;
	});
	$('#build-info .control').live('click', function() {
		var wrapperClass = $(this).parent().attr('class');	
		if(wrapperClass=="build-hide"){
			$('#build-info').attr('class','build-show');	
			$('#build-info .control').empty().append('Hide');
		} else {
			$('#build-info').attr('class','build-hide');	
			$('#build-info .control').empty().append('Expand');
		}
		return false;
	});											
/////////////////////////////////////////////////////
/// select menu ///
/////////////////////////////////////////////////////
	$('.select-menu-container').hide();
	$('.select-menu-selected').show();
	$('.select-menu li a').live('click', function() {
		if (typeof unsavedChanges != 'undefined' && unsavedChanges==true){
			if(confirm('You have unsaved changes. Are you sure you want to proceed without saving?')!=true){
				return false;
			}else{
				unsavedChanges=false;
			}
		}
		var parentClass = $(this).parent().attr('class');	
		var href = $(this).attr('href');
		var containerID = $(this).parent().parent().parent().attr('id');
		if(parentClass=="current"){
		} else {
			$('#'+containerID+' .select-menu-container').hide();
			$('#'+containerID+' .select-menu li').removeClass('current');
			$(this).parent().addClass('current');
			$('#'+containerID+' '+href+'').show();
		}
		return false;
	});	
/////////////////////////////////////////////////////
/// format selector ///
/////////////////////////////////////////////////////
	$('#format-selector .activity a').live('click', function() {
		var rel = $(this).attr('rel');
		var activity = $(this).text();
		$('#format-selector .tabs-menu li')
		$('#activity-tab').addClass('active');
		$('#activity-tab a').empty().append(activity);
		$('#format-tab').addClass('active');
		$('#format-tab a').attr('rel','tabs-container').trigger('click').empty().append('Select a Package');
		// reset locations and packages
		$('#format-selector .locationJS').empty();
		$('#location-tab').removeClass('active');
		$('#location-tab a').attr('rel','').empty().append('Select a Location');
		$('#format-selector .packageJS').empty();
		$('#package-tab').removeClass('active');
		$('#package-tab a').attr('rel','');
		// set formats
		$('#format-selector .formatJS').empty().addClass('loading').load('http://'+window.location.hostname+'/en/index/plug-contentformatsListAdvanced_oAct-'+rel+'_type-1_width-200_height-200', 
			function(){
				$('#format-selector .formatJS').removeClass('loading');
			}
		);
		return false;
	});
	$('#format-selector .formats-list-advanced a').live('click', function() {
		var rel = $(this).attr('rel');
		var format = $(this).text();
		$('#format-tab a').empty().append(format);
		$('#format-selector #select_a_format .block-wrapper').removeClass('selected');
		$(this).parents('.block-wrapper').addClass('selected');
		$('#location-tab').addClass('active');
		$('#location-tab a').attr('rel','tabs-container').trigger('click');
		// reset locations and packages
		$('#location-tab a').empty().append('Select a Location');
		$('#format-selector .packageJS').empty();
		$('#package-tab').removeClass('active');
		$('#package-tab a').attr('rel','');
		// set locations
		$('#format-selector .locationJS').empty().addClass('loading').load('http://'+window.location.hostname+'/en/index/plug-formatLocationsBasic_forID-'+rel+'',
			function(){
				$('#format-selector .locationJS').removeClass('loading');
			}															   
		 );
		return false;
	});
	$('#format-selector .venues-list-advanced .button a').live('click', function() {
		var rel = $(this).attr('rel');
		var arr = rel.split('|');
		var forID = arr[0];
		var oVenue = arr[1];
		var oVenAct = arr[2];
		var loc = $(this).text();
		var location = loc.split('From');
		$('#location-tab a').empty().append(location[0]);
		$('#format-selector #select_a_location .block-wrapper').removeClass('selected');
		$(this).parents('.block-wrapper').addClass('selected');
		$('#package-tab').addClass('active');
		$('#package-tab a').attr('rel','tabs-container').trigger('click');
		
		$('#format-selector .packageJS').empty().addClass('loading').load('http://'+window.location.hostname+'/en/index/plug-contentvenuePackages_forID-'+forID+'_oVenue-'+oVenue+'_oVenAct-'+oVenAct+'',
			function(){
				$('#format-selector .packageJS').removeClass('loading');
			}											  
		);
		return false;
	});
/////////////////////////////////////////////////////
/// drop menu ///
/////////////////////////////////////////////////////
	$('.scrollto').live('click', function() {
		var targetHref = $(this).attr('href');
		$(targetHref).scrollTo();
		return false;
	});
/////////////////////////////////////////////////////
/// drop menu ///
/////////////////////////////////////////////////////
	$('#menuJS li ul').hide();
	$('#menuJS li').hover(
		// Over
		function() {
		$(this).parent().find("ul").hide();
		$(this).contents("ul").show();
		return false;
		},
		// Out
		function(){
		$(this).contents("ul").hide();
		return false;
	});
	// this hides all menus when cursor is over content
	$('#content').live('mouseover', function() {
		$('#menuJS li ul').hide();					
		return false;			  
	});											
/////////////////////////////////////////////////////
/// format locations ///
/////////////////////////////////////////////////////
	$('.LOCATIONjs select').live('change', function() {
		var region = $("option:selected", $('.LOCATIONjs select') ).val();
		$('li.location').hide();
		$('li.'+region+'').show();
		if(region == "all"){
			$('li.location').show();
		}
		return false;			  
	});
/////////////////////////////////////////////////////
	$('.format-locations li ul').hide();
	$('.format-locations li a.price-from').live('click', function() {
		var venue= $(this).parent().attr('id');
		var span = "#"+venue+" .price-from span";
		var status = $(span).attr('class');
		if(status == "show"){
			$(this).next().show();
			$(span).attr("class","hide");
		} else {
			$(this).next().hide();
			$(span).attr("class","show");
		}
		return false;			  
	});
/////////////////////////////////////////////////////
/// packages ///
/////////////////////////////////////////////////////
	$('#venue-packages li ul').hide();
	$('#venue-packages li ul.open').show();
	$('#venue-packages li .package-link').live('click', function() {
		var parentID = $(this).parent().attr('id');
		var ul = '#'+parentID+' ul';
		var ulClass = $(ul).attr('class');
		$('#venue-packages li ul').slideUp();
		if(ulClass == "open reset"){
			$(ul).removeClass('open');
		} else {
			$('#venue-packages li ul').removeClass('open');
			$(ul).addClass('open').slideDown();
		}
		return false;
	});															 
/////////////////////////////////////////////////////
/// formats ///
/////////////////////////////////////////////////////
	$('#formats-preview .formats-list-advanced li').hide();
	$('#formats-preview .formats-list-advanced li.current').show();
	$('#formats-preview .formats-list li a').live('mouseover', function() {
		var rel=$(this).attr('rel');
		$('#formats-preview .formats-list-advanced li').hide().removeClass('current');
		$('#formats-preview .formats-list-advanced #'+rel+'').show().addClass('current');
		$('.formats-list li').removeClass('current');
		$(this).parent().addClass('current');
		return false;			  
	});
/////////////////////////////////////////////////////
	$('#formats-advanced .formats-list li a').live('click', function() {
		var rel=$(this).attr('rel');
		$('.formats-list li').removeClass('current');
		$(this).parent().addClass('current');
		$('#formats-advanced .wrapper').empty().append('<div class="loader">loading</div>');
		$.post('http://'+window.location.hostname+'/en/index/plug-'+rel+'', { ajax:'1' },
		function(result){
			$('#formats-advanced .wrapper').html(result);
		});
		return false;			  
	});
/////////////////////////////////////////////////////
	$('.VENUEFORMATjs').live('click', function() {
		var rel = $(this).attr('rel');
		var linkClass = $(this).attr('class');
		var parentID = '#'+$(this).parent().attr('id');
		var ulClass = $(this).parent().parent().attr('class');
		$('.formats-list .packagesListJS').remove();
		$('.formats-list li a').removeClass('open');
		$(this).addClass('open');
		if(linkClass == "format-link VENUEFORMATjs open"){
			$(this).removeClass('open');
			$(''+parentID+' .packagesListJS').remove();
		} else {
			$(parentID).append('<div class="packagesListJS inner-wrapper"></div>');
			$.post('http://'+window.location.hostname+'/en/index/plug-'+rel+'', { ajax:'1' },
			function(result){
				$(''+parentID+' .packagesListJS').html(result);
			});
		}
		return false;
	});
/////////////////////////////////////////////////////
	$('.VENUEPACKAGEjs').live('click', function() {
		var rel = $(this).attr('rel');
		var linkClass = $(this).attr('class');
		var parentID = '#'+$(this).parent().attr('id');
		var ulClass = $(this).parent().parent().attr('class');
		
		$('.packageDetailsJS').remove();
		if(linkClass == "package-link VENUEPACKAGEjs open"){
			$(this).parent().removeClass('selected');
			$(this).removeClass('open');
			$(''+parentID+' .packageDetailsJS').remove();
		} else {
			$(this).parent().addClass('selected');
			$(this).addClass('open');
			$(parentID).append('<div class="packageDetailsJS"></div>');
			$.post('http://'+window.location.hostname+'/en/index/plug-'+rel+'',
			function(result){
				$(''+parentID+' .packageDetailsJS').html(result);
			});
		}
		return false;
	});
/////////////////////////////////////////////////////
/// venue popup ///
/////////////////////////////////////////////////////
	$('.venuePopup').live('click', function() {
		var rel=$(this).attr('rel');
		$('body').append('<div id="loading"></div><div id="popup"></div>');
		$('#popup').fadeIn().load('http://'+window.location.hostname+'/en/index/plug-'+rel+'', function(){ $('#popup #venue-header h2.title').append('<a href="#" class="ajax-close AJAXCLOSEjs">x</a>') } );
		return false;			  
	});
	$('#venue-header h2 a').live('click',function() {
		$('#loading').remove();
		$('#popup').remove();
		return false;
	});
/////////////////////////////////////////////////////
/// ajax link ///
/////////////////////////////////////////////////////
	function close_ajax(){
		// check for any unsaved changes first
		if (typeof unsavedChanges != 'undefined' && unsavedChanges==true){
			if(confirm('You have unsaved changes are your sure you want to close without saving?')!=true){
				return false;
			}
		}
		$('body').removeClass('ajaxed');
		$('#overlay').remove();
		$('#ajax').remove();
		unsavedChanges=false;
		return false;
	}
	// by applying the class monitor change to a form
	// it will monitor changes in popups so that it warns before closing popup or swapping tabs
	$('form.monitorChange').live('change',function(){
		unsavedChanges=true;
	});
	
/////////////////////////////////////////////////////
	$('.ajax').live('click', function() {
		var rel = $(this).attr('rel');
		var loadType = $(this).attr('name');
		var message = '';
		var bodyClass = $('body').attr('class');
		if(bodyClass != "ajaxed"){
			$('body').append('<div id="overlay"></div>');
		}
		// loads ajax
		sbPopup(rel,loadType,message);
		return false;			  
	});
	// popup acts the same as ajaxed, but without the 'overlay'
	$('.popup').live('click', function() {
		if (typeof unsavedChanges != 'undefined' && unsavedChanges==true){
			if(confirm('You have unsaved changes. Are you sure you want to proceed without saving?')!=true){
				return false;
			}else{
				unsavedChanges=false;
			}
		}
		var rel=$(this).attr('rel');
		var loadType=$(this).attr('name');
		var message = '';
		// loads ajax
		sbPopup(rel,loadType,message);
		return false;			  
	});
	$('.linkajax').live('click', function() {
		var rel=$(this).attr('rel');
		var loadType=$(this).attr('name');
		// determine if ajax isset
		var thisClass = $(this).attr('class');
		$('#ajax').remove();
		$('.linkajax').attr('class','linkajax');
		$(this).addClass('loading');
		if(thisClass != "linkajax expanded"){
			$(this).parent().append('<div id="ajax"></div>');
			$('#ajax').fadeIn().load('http://'+window.location.hostname+'/en/index/plug-'+rel+'',
			function(){
				$(this).prev().attr('class','linkajax expanded');	
			});
		} else {
			$(this).attr('class','linkajax');
		}
		return false;			  
	});
/////////////////////////////////////////////////////
	// this closes the specific ajax div
	$('.AJAXCLOSEjs').live('click',function() {
		close_ajax();
		return false; //djanes 290511 stop scroll up on ajax popup close
	});
	// commented out as lines 422 - 436 are stopping the close button working on act booker terms popup
	//$('.AJAXCLOSEjs').live('click',function() {
		////if admin calendar open - refresh cal
		//if(app == 'availability' && $('#datepicker-inline').length && $('#admin-wizard-availability').length){
			//var	dateMonth = $('.ui-datepicker-month').html();
			//var	dateYear = $('.ui-datepicker-year').html();
			//updateCalendar($.datepicker.formatDate('dd-mm-yy', $.datepicker.parseDate('dd-MM-yy', '01-'+dateMonth+'-'+dateYear)));
		//}
		// if this is groupM8 then quote may well need refreshing
		//if(app=='groupM8'){
			//$(".QUOTEjs").html('<img src="http://img.activitychooser.co.uk/ajax-loader.gif">');
			//$.post('http://'+window.location.hostname+'/en/action_query/quote_edit/inlineEditReturnHTML/iq-'+iqREF,
					//function(html){
						//$(".QUOTEjs").html(html);
					//}
		//);	
		//}
		//var parentClass = $(this).parent().parent().parent().attr('class');
		//var parentID = $(this).parent().parent().parent().attr('id');
		//if(parentID == "innerPopup"){
			//$('.'+parentClass+'').remove();
		//} else {
			//$('body').removeClass('ajaxed');
			//$('#overlay').remove();
			//$('#ajax').remove();
		//}
		//return false;
	//});
	// this closes all ajax related divs
	$('#overlay').live('click',function() {
		close_ajax();
	});
///////////////////////////////////////////////////////
/// venue gallery ///
///////////////////////////////////////////////////////
	$('.gallery .thumbnails a').live('click', function() {
		var rel = $(this).attr('rel');
		var activityImage = 'background-image:url('+rel+');';
		$('.gallery .preview .img').attr('style',''+activityImage+'');
		//if(venueID!=""){
		//	$('.gallery .preview .img span').attr('style',''+venueImage+'');
		//}
		return false;
	});
/////////////////////////////////////////////////////
/// package selector ///
/////////////////////////////////////////////////////	
	$('#package-selector .packageListJS').live('change', function() {
		// retreive all form values
		var packageList = $("#package-selector .packageListJS").val();
		if(packageList!=""){ 
			var arr = packageList.split('|');
			var packageID = arr[0];
			var packageName = arr[1];
			var location = arr[2];
			var locationID = arr[3];
			var activity = arr[4];
			var activityID = arr[5];
			var price = arr[6];
		}
		// if required inputs aren't empty - proceed
		$('body').append('<div id="loading" style="z-index:5000;"></div>');
		if(packageList!=""){ 
			$('#bookOnlinePkgSelectorButton').load('http://'+window.location.hostname+'/en/index/pdID-'+arr[0]+'_oVenue-'+arr[3]+'_oVenAct-'+arr[5]+'_plug-contentbookOnline',
				function(data){
					$('#loading').remove();
			});
		}
		return false;
	});
	$('#package-selector .button button').live('click', function() {
		var packageID = $('.packageIDJS').val();
		if(packageID == ""){
			alert('Please select a package.');
			return false;
		}
	});														  
/////////////////////////////////////////////////////
/// Captcha ///
/////////////////////////////////////////////////////
	$('.captcha li a').live('click', function() {
		var captchaClass = $(this).parent().attr('class');
		var captchaColor = $('.captcha p span').attr('class');
		if(captchaColor == "red"){ var matchClass = "re"; }
		if(captchaColor == "green"){ var matchClass = "gr"; }
		if(captchaColor == "blue"){ var matchClass = "bl"; }
		if(captchaColor == "yellow"){ var matchClass = "ye"; }
		if(captchaColor == "pink"){ var matchClass = "pi"; }
		if(captchaClass == matchClass){
			$(this).parent().parent().parent().parent().attr('id','captchad');
			$('.captcha p').removeClass();
			$('.'+captchaClass+'').addClass('selected');
		}
	});		
/////////////////////////////////////////////////////
/// SUBSCRIBEjs ///
/////////////////////////////////////////////////////	
	$('.SUBSCRIBEjs').live('click', function() {
		var brand = $(".subsribeBrandJS").val();
		var email = $(".subscribeEmailJS").val();
		if(email=="" || email=="Email:"){ $(".subscribeEmailJS").parent().addClass('value-required'); }
		if(brand!="" && email!="" && email!="Email:"){ 
			// append loading div 
			$('body').append('<div id="loading"><h2>Subscribing...</h2></div>');
			// post to database
			$.post('http://venues.activityiq.com.au/maillist', { brand:brand, email:email},
			// database has been updated, email sent
			
			function(){
			document.location = "http://venues.activityiq.com.au/maillist";
			});
		}
		return false;
	
	});									  
/////////////////////////////////////////////////////
/// CONTACTjs ///
/////////////////////////////////////////////////////	
	function email_sent(){
		$('.required').removeClass('value-required');
		$('.required').removeClass('validated');
		// email sent message
		$('#loading').empty().append('<h2>Email Sent.</h2>');
		// remove loading div
		setTimeout( function() { $('#loading').fadeOut().remove(); }, 1000);
		// empty form
		//$('.CONTACTFORMjs')[ 0 ].reset();
		$('.CONTACTFORMjs').empty().append('<p>Thank you for your enquiry. An interactive quote from ActivityIQ will be emailed to you shortly, you will be notified via sms when it has been sent.</p><p>If you do not receive a quote from us within 24hrs please check your spam folder, or call us</p>');
	}
/////////////////////////////////////////////////////
	$('.CONTACTjs').live('click', function() {
		// retreive all form values
		var name = $(".contactNameJS").val();
		var email = $(".contactEmailJS").val();
		var telephone = $(".contactTelephoneJS").val();
		var subscribe = $(".contactSubscribeJS").val();
		var website = $(".contactWebsiteJS").val();
		var websiteID = $(".contactWebsiteIDJS").val();
		var activityID = $(".contactActivityIDJS").val();
		var locationID = $(".contactLocationIDJS").val();
		var type = $(".contactTypeJS").val();	
		var comment = $(".contactCommentJS").val();
		var venueEmail = $(".contactVenueEmailJS").val();
		var submit='yes';
		// reset form
		$('.value-required').removeClass('value-required');
		$('.validated').removeClass('validated');
		// if input is empty on required field prompt
		if(name==""){ 
			$(".contactNameJS").parent().addClass('value-required');
			submit='no';
		} else {
			$(".contactNameJS").parent().addClass('validated'); 
		}
		if(email=="" && telephone.length<6){ 
			$(".contactEmailJS").parent().addClass('value-required');
			submit='no';
		} else {
			if (isValidEmail(email) || telephone.length>5){
				$(".contactEmailJS").parent().addClass('validated'); 
			}else{
				$(".contactEmailJS").parent().addClass('value-required');
				submit='no';
			}
		}
		if (telephone.length<6 && !isValidEmail(email)){
			$(".contactTelephoneJS").parent().addClass('value-required');
			submit='no';
		} else {
			$(".contactTelephoneJS").parent().addClass('validated'); 
		}
		if(comment==""){ 
			$(".contactCommentJS").parent().addClass('value-required');
			submit='no'; 
		} else {
			$(".contactCommentJS").parent().addClass('validated'); 
		}
		// if required inputs aren't empty and email is valid - proceed
		if(submit=='yes' && submitting!=1){
			// the submitting variable helps prevent double submits
			// by preventing submits whilst another submit is in process
			submitting=1;
			// append loading div 
			$('body').append('<div id="loading"><h2>Sending Email...</h2></div>');
			// post to database
			if(venueEmail =="undefined" || venueEmail ==""){ // if form posts to external email address
				$.post('http://'+window.location.hostname+'/en/action_query/sbmod/contact_submit', { name:name, email:email, telephone:telephone, comment:comment, subscribe:subscribe, website:website, websiteID:websiteID, activityID:activityID, locationID:locationID, type:type},
				// database has been updated, email sent
				function(data){
					submitting=0;
					if (data=='success'){
						email_sent();
					}else{
						setTimeout( function() { $('#loading').fadeOut().remove(); }, 1000);
						if (data=='spam'){
							alert ('The message has some Spam triggers in it and cannot be submitted. If this is a genuine enquiry please try and reword it!');
						}else{
							alert (data.replace('FAILURE:','Submit failure>>'));	
						}
					}
				});
			} else {
				$.post('http://'+window.location.hostname+'/en/action_query/sbmod/contact_submit', { name:name, email:email, telephone:telephone, comment:comment, subscribe:subscribe, website:website, websiteID:websiteID, activityID:activityID, locationID:locationID, type:type, venueEmail:venueEmail},
				// database has been updated, email sent
				function(data){
					email_sent();
					submitting=0;
				});
			}
		}
		return false;
	});		
/////////////////////////////////////////////////////
/// REDEEMjs ///
/////////////////////////////////////////////////////	
	$('.REDEEMjs').live('click', function() {
		// retreive all form values
		var redeemType = $(this).val();
		var voucherExpiry = $(".redeemVoucherExpiryJS").val();	
		var voucherID = $(".redeemVoucherIDJS").val();	
		var date = $(".redeemDateJS").val();
		var name = $(".redeemNameJS").val();
		var email = $(".redeemEmailJS").val();
		var telephone = $(".redeemTelephoneJS").val();
		var subscribe = '';
		var website = $(".redeemWebsiteJS").val();
		var websiteID = $(".redeemWebsiteIDJS").val();
		var type = $(".redeemTypeJS").val();	
		var comment = "";
		var packageList = "";
		if(redeemType == "rrv"){
			var packageList = $("option:selected", $('.experienceJS select') ).val();
			if(packageList!=""){ 
				var comment = name+' would like to redeem a experience voucher. VOUCHER ID:'+voucherID+'. VOUCHER EXPIRY:'+voucherExpiry+'. Experience:'+packageList+'. DATE:'+date+'.';
			}
			if(packageList==""){ $(".experienceJS").parent().addClass('value-required'); }
		} else {
			var packageList = $(".packageListJS").val();
			if(packageList!=""){ 
				var arr = packageList.split('|');
				var packageID = arr[0];
				var packageName = arr[1];
				var location = arr[2];
				var locationID = arr[3];
				var activity = arr[4];
				var activityID = arr[5];
				var comment = name+' would like to redeem a voucher. VOUCHER ID:'+voucherID+'. VOUCHER EXPIRY:'+voucherExpiry+'. PACKAGE:'+packageName+'. LOCATION:'+location+'. ACTIVITY:'+activity+'. DATE:'+date+'.';
			}
			if(packageList==""){ $(".packageListJS").parent().addClass('value-required'); }
		}
		
		// reset form
		$('.required').removeClass('value-required');
		// if input is empty on required field prompt
		if(name==""){ $(".redeemNameJS").parent().addClass('value-required'); }
		if(email==""){ $(".redeemEmailJS").parent().addClass('value-required'); }
		if(telephone==""){ $(".redeemTelephoneJS").parent().addClass('value-required'); }
		if(voucherExpiry==""){ $(".redeemVoucherExpiryJS").parent().addClass('value-required'); }
		if(voucherID==""){ $(".redeemVoucherIDJS").parent().addClass('value-required'); }
		if(date==""){ $(".redeemDateJS").parent().addClass('value-required'); }
		
		// if required inputs aren't empty - proceed
		if(name!="" && email!="" && telephone!="" && voucherExpiry!="" && voucherID!="" && date!="" && packageList!=""){ 
			// append loading div 
			$('body').append('<div id="loading"><h2>Sending Email...</h2></div>');
			// post to database
			$.post('http://'+window.location.hostname+'/en/action_query/sbmod/contact_submit', { name:name, email:email, telephone:telephone, comment:comment, subscribe:subscribe, website:website, websiteID:websiteID, activityID:activityID, locationID:locationID, type:type},
			// database has been updated, email sent
			function(data){
				// email sent message
				$('#loading').empty().append('<h2>Email Sent.</h2>');
				// remove loading div
				setTimeout( function() { $('#loading').fadeOut().remove(); }, 1000);
				// empty form
				//$('.REDEEMFORMjs')[ 0 ].reset();
				$('.REDEEMFORMjs').empty().append('<p>Your voucher redemption has been sent. One of our sales team will be in touch with you shortly.</p>');
			});
		}
		return false;
	});	
/////////////////////////////////////////////////////
/// CALLBACKjs ///
/////////////////////////////////////////////////////	
	$('.CALLBACKjs').live('click', function() {
		// retreive all form values
		var name = $(".callbackNameJS").val();
		var telephone = $(".callbackTelephoneJS").val();
		var website = $(".callbackWebsiteJS").val();
		var time = $(".callbackTimeJS").val();
		// reset form
		$('.required').removeClass('value-required');
		// if input is empty on required field prompt
		if(name=="" || name.length<2){ 
		$(".callbackNameJS").parent().addClass('value-required'); }
		if(telephone=="" || telephone.length<6){ $(".callbackTelephoneJS").parent().addClass('value-required'); }
		// if required inputs aren't empty - proceed
		if(name!="" && name.length>=2 && telephone!="" && telephone.length>5 && callbackSubmitting!=1){
			callbackSubmitting=1;
			// append loading div 
			$('body').append('<div id="loading"><h2>Sending Email...</h2></div>');
			// send email
			$.post('http://'+window.location.hostname+'/en/action_query/sbmod/contactCallback', { name:name, telephone:telephone, website:website, time:time},
			function(data){
				callbackSubmitting=0;
				// email sent message
				$('#loading').empty().append('<h2>Email Sent.</h2>');
				// remove loading div
				setTimeout( function() { $('#loading').fadeOut().remove(); }, 1000);
				// empty form
				$('.CALLBACKFORMjs').empty().append('<p>Thank you for your callback request. One of our sales team will be in touch with you shortly.</p>');
			});
		}
		return false;
	});	
/////////////////////////////////////////////////////
/// TELLAFRIENDjs ///
/////////////////////////////////////////////////////	
	$('.TELLAFRIENDjs').live('click', function() {
		// retreive all form values
		var formID = $(this).parent().parent().attr('id');
		var name = $(".tellafriendNameJS").val();
		var email = $(".tellafriendEmailJS").val();
		var friendsEmail = $(".tellafriendFriendsEmailJS").val();
		var message = $(".tellafriendMessageJS").val();
		var brand = $(".tellafriendBrandJS").val();
		var url = $(".tellafriendUrlJS").val();
		// reset form
		$('.value-required').removeClass('value-required');
		// if input is empty on required field prompt
		if(name==""){ $('.tellafriendNameJS').parent().addClass('value-required'); }
		if(!isValidEmail(email)){ $('.tellafriendEmailJS').parent().addClass('value-required'); }
		if(!isValidEmail(friendsEmail)){ $('.tellafriendFriendsEmailJS').parent().addClass('value-required'); }
		if(formID!="captchad"){ $('.TELLAFRIENDFORMjs .captcha p').addClass('value-required'); }
		// if required inputs aren't empty - proceed
		if(name!="" && isValidEmail(email) && isValidEmail(friendsEmail) && formID == "captchad"){ 
			// append loading div 
			$('body').append('<div id="loading"><h2>Sending Email...</h2></div>');
			// send email
			$.post('http://'+window.location.hostname+'/en/action_query/sbmod/tellaFriend', { name:name, email:email, friendsEmail:friendsEmail, message:message, brand:brand, url:url},
			function(data){
				// close ajax
				close_ajax();
				// email sent message
				$('#loading').empty().append('<h2>Email Sent.</h2>');
				// remove loading div
				setTimeout( function() { $('#loading').fadeOut().remove(); }, 1000);
			});
		}
		return false;
	});	
/////////////////////////////////////////////////////
/// EMAILjs ///
/////////////////////////////////////////////////////	
$('.EMAILjs').live('click', function() {
		// retreive all form values
		var formID = $(this).parent().parent().attr('id');
		var name = $(".emailNameJS").val();
		var email = $(".emailEmailJS").val();
		var company = $(".emailCompanyJS").val();
		var website = $(".emailWebsiteJS").val();
		var message = $(".emailCommentJS").val();
		var url = $(".emailOriginJS").val();
		// reset form
		$('.value-required').removeClass('value-required');
		// if input is empty on required field prompt
		if(name==""){ $('.emailNameJS').parent().addClass('value-required'); }
		if(company==""){ $('.emailCompanyJS').parent().addClass('value-required'); }
		if(message==""){ $('.emailMessageJS').parent().addClass('value-required'); }
		if(!isValidEmail(email)){ $('.emailEmailJS').parent().addClass('value-required'); }
		// if required inputs aren't empty - proceed
		if(name!="" && isValidEmail(email) && company!="" && message!=""){
			$(".EMAILFORMjs").hide('<img src="http://img.activitychooser.co.uk/ajax-loader.gif">');
			$(".emailFormSubmitting").html('<img src="http://img.activitychooser.co.uk/ajax-loader.gif">'); 
			// append loading div 
			$('body').append('<div id="loading"><h2>Sending Email...</h2></div>');
			// send email
			$.post('http://'+window.location.hostname+'/en/action_query/sbmod/emailEnquiry', { name:name, email:email, company:company, website:website, message:message, origin:url},
			function(data){
				// email sent message
				$('#loading').empty().append('<h2>Email Sent.</h2>');
				$(".emailFormSubmitting").html('<p>Thanks for your Enquiry.</p><p>We\'ll be in touch.</p>')
				// remove loading div
				setTimeout( function() { $('#loading').fadeOut().remove(); }, 1000);
			});
		}
		return false;
	});	
/////////////////////////////////////////////////////
/// search select ///
/////////////////////////////////////////////////////
	function search_select(){
		$('.search-select').change(function(){	
			var pageContainer = $(this).parent().parent().attr('id');
			var container = $(this).parent().next();
			var selectID = $(this).attr('id');
			$('body').append('<div id="loading" style="z-index:5000;"></div>');
			if(selectID == "activity-select"){
				var activityID = $('#activity-select').val();
				if(pageContainer == "multi-activity-wrapper"){ // load in venue list
					$(container).empty().load('http://'+window.location.hostname+'/en/index/plug-contentvenuesListSelect_listNr-1000_oAct-'+activityID+'',
					function(data){
						$('#loading').remove();
					});
				} else { // load in venue list, which then loads in packages list
					$(container).empty().load('http://'+window.location.hostname+'/en/index/plug-contentsearchSelectVenue_listNr-1000_oAct-'+activityID+'',
					function(data){
						$('#loading').remove();
					});
				}
			} else if(selectID == "venue-select"){
				var locationID = $(this).val();
				var arr = locationID.split(',');
				$(container).empty().load('http://'+window.location.hostname+'/en/index/plug-contentsearchSelectPackage_oVenue-'+arr[0]+'_oVenAct-'+arr[1]+'',
					function(data){
						$('#loading').remove();
				});
			}									
		});
	}
	$('.search-select').live('change', function() {
		var pageContainer = $(this).parent().parent().attr('id');
			var container = $(this).parent().next();
			var selectID = $(this).attr('id');
			$('body').append('<div id="loading" style="z-index:5000;"></div>');
			if(selectID == "activity-select"){
				var activityID = $('#activity-select').val();
				if(pageContainer == "multi-activity-wrapper"){ // load in venue list
					$(container).empty().load('http://'+window.location.hostname+'/en/index/plug-contentvenuesListSelect_listNr-1000_oAct-'+activityID+'',
					function(data){
						$('#loading').remove();
					});
				} else { // load in venue list, which then loads in packages list
					$(container).empty().load('http://'+window.location.hostname+'/en/index/plug-contentsearchSelectVenue_listNr-1000_oAct-'+activityID+'',
					function(data){
						$('#loading').remove();
				});
				}
			} else if(selectID == "venue-select"){
				var locationID = $(this).val();
				var arr = locationID.split(',');
				var parentID = $(this).parents('.plugin').attr('id');
				if(arr[0]!=""){
console.log('BLAH'+parentID);
					if(parentID == "availability-advanced"){
						$('#availability-advanced .inner-wrapper').empty().load('http://'+window.location.hostname+'/en/index/plug-contentavailability_oVenue-'+arr[0]+'_oVenAct-'+arr[1], function(data){
							$('#loading').remove();
						});
					} else {
					$(container).empty().load('http://'+window.location.hostname+'/en/index/plug-contentsearchSelectPackage_oVenue-'+arr[0]+'_oVenAct-'+arr[1]+'', function(data){
						$('#loading').remove();
					});
					}
				}
			}
	});
/////////////////////////////////////////////////////
/// venues map ///
/////////////////////////////////////////////////////
	$('.map li').hide();
	$('.map .hover').live('hover', function(){ 
		var area=$(this).attr('alt');
		var id=$(this).attr('id');
		$('.map img').attr('src',resourceImages+'maps/'+area+'.png');
		$('.map li').hide();
		$('.map .'+id+'').show();
		return false;
	});
/////////////////////////////////////////////////////
// view filter //
/////////////////////////////////////////////////////
	$('.view-filter li ul li a').live('click', function() {
		var rel = $(this).attr('rel');
		var parent=$(this).parent().parent().parent().parent().parent();
		$('.view-filter li ul li a').removeClass('selected');
		$(parent).attr('id',''+rel+'');
		$(this).addClass('selected');
		return false;
	});
/////////////////////////////////////////////////////
/// tab menu ///
/////////////////////////////////////////////////////
	$('.tabs-container').hide(0);
	$('.tabs-selected').show(0);
	$('.tabs-menu li a').live('click', function() {
		
		// the followign are for checking movement between the newQUote and addpackage tabs when creatign a quote
		var currentTab='';
		/*$('#'+$(this).parent().parent().parent().attr('id')+' li').each(function(){
			if($(this).attr('class').indexOf('tab-selected')>=0){
				currentTab =$(this).children("a:first").attr('href');
			};
		});*/
		if ($('[href=#packageSelect]').length>0 && $('[href=#packageSelect]').parent().attr('class').indexOf('tab-selected')>=0){
			currentTab = "#packageSelect";
		}
		if ($('[href=#newQuote]').length>0 && $('[href=#newQuote]').parent().attr('class').indexOf('tab-selected')>=0){
			currentTab = "#newQuote";
		}
		var destiTab =$(this).attr('href');

		var monitoring = true;
		if((currentTab=='#newQuote' && destiTab=='#packageSelect') || (destiTab=='#newQuote' && currentTab=='#packageSelect') || (destiTab.indexOf('venue_')>=0 && currentTab=='#packageSelect')){
			monitoring = false;
		}
		
		// alert user of any form changes prior to moving tabs
		// movement between add package and createQuote though is permitted
		if (typeof unsavedChanges != 'undefined' && unsavedChanges==true && monitoring==true){
			if(confirm('You have unsaved changes. Are you sure you want to proceed without saving?')!=true){
				return false;
			}else{
				unsavedChanges=false;
			}
		}
		if (monitoring==true){
			unsavedChanges = false;
		}
		//// The following lines are for activitybookers benefit enables validation to continue after
		// tab navigation which on their own do not trigger validation
		if ($(this).attr('href')=='#your_details'){
			$('form#booking').removeClass('step1').removeClass('step3').addClass('step2');
		}
		if ($(this).attr('href')=='#event_details'){
			$('form#booking').removeClass('step3').removeClass('step2').addClass('step1');
		}
		if ($(this).attr('href')=='#payment_details'){
			$('form#booking').removeClass('step1').removeClass('step2').addClass('step3');
		}
		
		var li = $(this).parent();
		var liValue = $(this).attr('rev');
		var ul = $(this).parent().parent();
		var tab = (ul).children();
		var wrapper = $(this).parent().parent().parent().attr('id');
		var rel = $(this).attr('rel');
		var container = '#'+wrapper+' .'+rel;
		var href = $(this).attr('href');
		var node = '#'+wrapper+' '+href+'';
		var selected = $(this).parent().attr('class');
		
		if(selected=="tab-selected"){
		} else {
			// this identifies any links not part of the tab structure
			if($(this).attr('target')=="_blank"){	
			} else {
				$(container).hide(0).removeClass('tabs-selected');
				$(tab).removeClass('tab-selected');
				$(li).addClass('tab-selected');
				if(rel == "tabs-ajax-container"){
					$(node).show(0).addClass('tabs-selected').load('http://'+window.location.hostname+'/en/index/plug-'+liValue+'');
				} else {
					$(node).show(0).addClass('tabs-selected'); 
				}
				return false;
			}
		}
	});
/////////////////////////////////////////////////////
/// tab link ///
/////////////////////////////////////////////////////
	$('.tab-link').live('click', function() {
		var href = $(this).attr('href');
		$(href).trigger('click');
		return false;
	});
/////////////////////////////////////////////////////
// activity menu //
/////////////////////////////////////////////////////
	$('.expandable-menu li ul').hide(0);
	$('.expandable-menu li ul.open').show(0);
	$('.expandable-menu h3 a').live('click', function() {
		var container = $(this).parent().parent();
		var next=$(this).parent().next();
		var expanded=$(this).parent().parent().attr('class');
		$('.expandable-menu li ul').slideUp('slow').removeClass('open');
		$('.expandable-menu li').removeClass('expanded');
		if(expanded=="expanded"){
			$(next).slideUp('slow').removeClass('open');
			$(container).removeClass('expanded');
		} else {
			$(next).slideDown('slow').addClass('open').show();
			$(container).addClass('expanded');
		}
		return false;
	});
/////////////////////////////////////////////////////
// experience view //
/////////////////////////////////////////////////////
	$('#experience-view li ul li a').live('click', function() {
		var id=$(this).parent().attr('id');
		var parent=$(this).parent().parent().parent().parent().parent();
		$('#experience-view li ul li a').removeClass('selected');
		if(id=="panel"){
			$(parent).removeClass().addClass('panel');
			$(this).addClass('selected');
		} else {
			$(parent).removeClass().addClass('list');
			$(this).addClass('selected');
		}
		return false;
	});
///////////////////////////////////////////////////////
/// read more ///
///////////////////////////////////////////////////////
	$('.READMOREjs .APPENDjs').append('... <a href="#" class="expand">Read More</a>');
	$('.READMOREjs').css('cursor', 'pointer');
	$('.READMOREjs').live('click', function() {
		var container = $(this).parent();
		var next = $(this).next();
		var expanded = $(this).parent().attr('id');
		$('.READMORECONTENTjs').hide();
		$('#open').attr('id','');
		if(expanded=="open"){
			$(container).attr('id','');
		} else {
			$(next).slideDown('slow').show();
			$(container).attr('id','open');
		}
		return false;
	});
///////////////////////////////////////////////////////
});
/////////////////////////////////////////////////////
/// clear form ///
/////////////////////////////////////////////////////
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}
/////////////////////////////////////////////////////
/// validate email address///
/////////////////////////////////////////////////////
function isValidEmail(emailAddress) {
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}
/////////////////////////////////////////////////////
// JQuery Cycle Plugin //
/////////////////////////////////////////////////////
/*
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://jquery.malsup.com/cycle/
 * Copyright (c) 2007-2009 M. Alsup
 * Version: 2.73 (04-NOV-2009)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.2.6 or later
 *
 * Originally based on the work of:
 *	1) Matt Oakes
 *	2) Torsten Baldes (http://medienfreunde.com/lab/innerfade/)
 *	3) Benjamin Sterling (http://www.benjaminsterling.com/experiments/jqShuffle/)
 */
(function(i){var l="2.73";if(i.support==undefined){i.support={opacity:!(i.browser.msie)}}function a(q){if(i.fn.cycle.debug){f(q)}}function f(){if(window.console&&window.console.log){window.console.log("[cycle] "+Array.prototype.join.call(arguments," "))}}i.fn.cycle=function(r,q){var s={s:this.selector,c:this.context};if(this.length===0&&r!="stop"){if(!i.isReady&&s.s){f("DOM not ready, queuing slideshow");i(function(){i(s.s,s.c).cycle(r,q)});return this}f("terminating; zero elements found by selector"+(i.isReady?"":" (DOM not ready)"));return this}return this.each(function(){var w=m(this,r,q);if(w===false){return}if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=this.cyclePause=0;var x=i(this);var y=w.slideExpr?i(w.slideExpr,this):x.children();var u=y.get();if(u.length<2){f("terminating; too few slides: "+u.length);return}var t=k(x,y,u,w,s);if(t===false){return}var v=t.continuous?10:h(t.currSlide,t.nextSlide,t,!t.rev);if(v){v+=(t.delay||0);if(v<10){v=10}a("first timeout: "+v);this.cycleTimeout=setTimeout(function(){e(u,t,0,!t.rev)},v)}})};function m(q,t,r){if(q.cycleStop==undefined){q.cycleStop=0}if(t===undefined||t===null){t={}}if(t.constructor==String){switch(t){case"stop":q.cycleStop++;if(q.cycleTimeout){clearTimeout(q.cycleTimeout)}q.cycleTimeout=0;i(q).removeData("cycle.opts");return false;case"pause":q.cyclePause=1;return false;case"resume":q.cyclePause=0;if(r===true){t=i(q).data("cycle.opts");if(!t){f("options not found, can not resume");return false}if(q.cycleTimeout){clearTimeout(q.cycleTimeout);q.cycleTimeout=0}e(t.elements,t,1,1)}return false;case"prev":case"next":var u=i(q).data("cycle.opts");if(!u){f('options not found, "prev/next" ignored');return false}i.fn.cycle[t](u);return false;default:t={fx:t}}return t}else{if(t.constructor==Number){var s=t;t=i(q).data("cycle.opts");if(!t){f("options not found, can not advance slide");return false}if(s<0||s>=t.elements.length){f("invalid slide index: "+s);return false}t.nextSlide=s;if(q.cycleTimeout){clearTimeout(q.cycleTimeout);q.cycleTimeout=0}if(typeof r=="string"){t.oneTimeFx=r}e(t.elements,t,1,s>=t.currSlide);return false}}return t}function b(q,r){if(!i.support.opacity&&r.cleartype&&q.style.filter){try{q.style.removeAttribute("filter")}catch(s){}}}function k(y,J,u,t,E){var C=i.extend({},i.fn.cycle.defaults,t||{},i.metadata?y.metadata():i.meta?y.data():{});if(C.autostop){C.countdown=C.autostopCount||u.length}var r=y[0];y.data("cycle.opts",C);C.$cont=y;C.stopCount=r.cycleStop;C.elements=u;C.before=C.before?[C.before]:[];C.after=C.after?[C.after]:[];C.after.unshift(function(){C.busy=0});if(!i.support.opacity&&C.cleartype){C.after.push(function(){b(this,C)})}if(C.continuous){C.after.push(function(){e(u,C,0,!C.rev)})}n(C);if(!i.support.opacity&&C.cleartype&&!C.cleartypeNoBg){g(J)}if(y.css("position")=="static"){y.css("position","relative")}if(C.width){y.width(C.width)}if(C.height&&C.height!="auto"){y.height(C.height)}if(C.startingSlide){C.startingSlide=parseInt(C.startingSlide)}if(C.random){C.randomMap=[];for(var H=0;H<u.length;H++){C.randomMap.push(H)}C.randomMap.sort(function(L,w){return Math.random()-0.5});C.randomIndex=0;C.startingSlide=C.randomMap[0]}else{if(C.startingSlide>=u.length){C.startingSlide=0}}C.currSlide=C.startingSlide=C.startingSlide||0;var x=C.startingSlide;J.css({position:"absolute",top:0,left:0}).hide().each(function(w){var L=x?w>=x?u.length-(w-x):x-w:u.length-w;i(this).css("z-index",L)});i(u[x]).css("opacity",1).show();b(u[x],C);if(C.fit&&C.width){J.width(C.width)}if(C.fit&&C.height&&C.height!="auto"){J.height(C.height)}var D=C.containerResize&&!y.innerHeight();if(D){var v=0,B=0;for(var F=0;F<u.length;F++){var q=i(u[F]),K=q[0],A=q.outerWidth(),I=q.outerHeight();if(!A){A=K.offsetWidth}if(!I){I=K.offsetHeight}v=A>v?A:v;B=I>B?I:B}if(v>0&&B>0){y.css({width:v+"px",height:B+"px"})}}if(C.pause){y.hover(function(){this.cyclePause++},function(){this.cyclePause--})}if(c(C)===false){return false}var s=false;t.requeueAttempts=t.requeueAttempts||0;J.each(function(){var N=i(this);this.cycleH=(C.fit&&C.height)?C.height:N.height();this.cycleW=(C.fit&&C.width)?C.width:N.width();if(N.is("img")){var L=(i.browser.msie&&this.cycleW==28&&this.cycleH==30&&!this.complete);var O=(i.browser.mozilla&&this.cycleW==34&&this.cycleH==19&&!this.complete);var M=(i.browser.opera&&((this.cycleW==42&&this.cycleH==19)||(this.cycleW==37&&this.cycleH==17))&&!this.complete);var w=(this.cycleH==0&&this.cycleW==0&&!this.complete);if(L||O||M||w){if(E.s&&C.requeueOnImageNotLoaded&&++t.requeueAttempts<100){f(t.requeueAttempts," - img slide not loaded, requeuing slideshow: ",this.src,this.cycleW,this.cycleH);setTimeout(function(){i(E.s,E.c).cycle(t)},C.requeueTimeout);s=true;return false}else{f("could not determine size of image: "+this.src,this.cycleW,this.cycleH)}}}return true});if(s){return false}C.cssBefore=C.cssBefore||{};C.animIn=C.animIn||{};C.animOut=C.animOut||{};J.not(":eq("+x+")").css(C.cssBefore);if(C.cssFirst){i(J[x]).css(C.cssFirst)}if(C.timeout){C.timeout=parseInt(C.timeout);if(C.speed.constructor==String){C.speed=i.fx.speeds[C.speed]||parseInt(C.speed)}if(!C.sync){C.speed=C.speed/2}while((C.timeout-C.speed)<250){C.timeout+=C.speed}}if(C.easing){C.easeIn=C.easeOut=C.easing}if(!C.speedIn){C.speedIn=C.speed}if(!C.speedOut){C.speedOut=C.speed}C.slideCount=u.length;C.currSlide=C.lastSlide=x;if(C.random){C.nextSlide=C.currSlide;if(++C.randomIndex==u.length){C.randomIndex=0}C.nextSlide=C.randomMap[C.randomIndex]}else{C.nextSlide=C.startingSlide>=(u.length-1)?0:C.startingSlide+1}if(!C.multiFx){var G=i.fn.cycle.transitions[C.fx];if(i.isFunction(G)){G(y,J,C)}else{if(C.fx!="custom"&&!C.multiFx){f("unknown transition: "+C.fx,"; slideshow terminating");return false}}}var z=J[x];if(C.before.length){C.before[0].apply(z,[z,z,C,true])}if(C.after.length>1){C.after[1].apply(z,[z,z,C,true])}if(C.next){i(C.next).bind(C.prevNextEvent,function(){return o(C,C.rev?-1:1)})}if(C.prev){i(C.prev).bind(C.prevNextEvent,function(){return o(C,C.rev?1:-1)})}if(C.pager){d(u,C)}j(C,u);return C}function n(q){q.original={before:[],after:[]};q.original.cssBefore=i.extend({},q.cssBefore);q.original.cssAfter=i.extend({},q.cssAfter);q.original.animIn=i.extend({},q.animIn);q.original.animOut=i.extend({},q.animOut);i.each(q.before,function(){q.original.before.push(this)});i.each(q.after,function(){q.original.after.push(this)})}function c(w){var u,s,r=i.fn.cycle.transitions;if(w.fx.indexOf(",")>0){w.multiFx=true;w.fxs=w.fx.replace(/\s*/g,"").split(",");for(u=0;u<w.fxs.length;u++){var v=w.fxs[u];s=r[v];if(!s||!r.hasOwnProperty(v)||!i.isFunction(s)){f("discarding unknown transition: ",v);w.fxs.splice(u,1);u--}}if(!w.fxs.length){f("No valid transitions named; slideshow terminating.");return false}}else{if(w.fx=="all"){w.multiFx=true;w.fxs=[];for(p in r){s=r[p];if(r.hasOwnProperty(p)&&i.isFunction(s)){w.fxs.push(p)}}}}if(w.multiFx&&w.randomizeEffects){var t=Math.floor(Math.random()*20)+30;for(u=0;u<t;u++){var q=Math.floor(Math.random()*w.fxs.length);w.fxs.push(w.fxs.splice(q,1)[0])}a("randomized fx sequence: ",w.fxs)}return true}function j(r,q){r.addSlide=function(u,v){var t=i(u),w=t[0];if(!r.autostopCount){r.countdown++}q[v?"unshift":"push"](w);if(r.els){r.els[v?"unshift":"push"](w)}r.slideCount=q.length;t.css("position","absolute");t[v?"prependTo":"appendTo"](r.$cont);if(v){r.currSlide++;r.nextSlide++}if(!i.support.opacity&&r.cleartype&&!r.cleartypeNoBg){g(t)}if(r.fit&&r.width){t.width(r.width)}if(r.fit&&r.height&&r.height!="auto"){$slides.height(r.height)}w.cycleH=(r.fit&&r.height)?r.height:t.height();w.cycleW=(r.fit&&r.width)?r.width:t.width();t.css(r.cssBefore);if(r.pager){i.fn.cycle.createPagerAnchor(q.length-1,w,i(r.pager),q,r)}if(i.isFunction(r.onAddSlide)){r.onAddSlide(t)}else{t.hide()}}}i.fn.cycle.resetState=function(r,q){q=q||r.fx;r.before=[];r.after=[];r.cssBefore=i.extend({},r.original.cssBefore);r.cssAfter=i.extend({},r.original.cssAfter);r.animIn=i.extend({},r.original.animIn);r.animOut=i.extend({},r.original.animOut);r.fxFn=null;i.each(r.original.before,function(){r.before.push(this)});i.each(r.original.after,function(){r.after.push(this)});var s=i.fn.cycle.transitions[q];if(i.isFunction(s)){s(r.$cont,i(r.elements),r)}};function e(x,q,w,y){if(w&&q.busy&&q.manualTrump){i(x).stop(true,true);q.busy=false}if(q.busy){return}var u=q.$cont[0],A=x[q.currSlide],z=x[q.nextSlide];if(u.cycleStop!=q.stopCount||u.cycleTimeout===0&&!w){return}if(!w&&!u.cyclePause&&((q.autostop&&(--q.countdown<=0))||(q.nowrap&&!q.random&&q.nextSlide<q.currSlide))){if(q.end){q.end(q)}return}if(w||!u.cyclePause){var v=q.fx;A.cycleH=A.cycleH||i(A).height();A.cycleW=A.cycleW||i(A).width();z.cycleH=z.cycleH||i(z).height();z.cycleW=z.cycleW||i(z).width();if(q.multiFx){if(q.lastFx==undefined||++q.lastFx>=q.fxs.length){q.lastFx=0}v=q.fxs[q.lastFx];q.currFx=v}if(q.oneTimeFx){v=q.oneTimeFx;q.oneTimeFx=null}i.fn.cycle.resetState(q,v);if(q.before.length){i.each(q.before,function(B,C){if(u.cycleStop!=q.stopCount){return}C.apply(z,[A,z,q,y])})}var s=function(){i.each(q.after,function(B,C){if(u.cycleStop!=q.stopCount){return}C.apply(z,[A,z,q,y])})};if(q.nextSlide!=q.currSlide){q.busy=1;if(q.fxFn){q.fxFn(A,z,q,s,y)}else{if(i.isFunction(i.fn.cycle[q.fx])){i.fn.cycle[q.fx](A,z,q,s)}else{i.fn.cycle.custom(A,z,q,s,w&&q.fastOnEvent)}}}q.lastSlide=q.currSlide;if(q.random){q.currSlide=q.nextSlide;if(++q.randomIndex==x.length){q.randomIndex=0}q.nextSlide=q.randomMap[q.randomIndex]}else{var t=(q.nextSlide+1)==x.length;q.nextSlide=t?0:q.nextSlide+1;q.currSlide=t?x.length-1:q.nextSlide-1}if(q.pager){i.fn.cycle.updateActivePagerLink(q.pager,q.currSlide)}}var r=0;if(q.timeout&&!q.continuous){r=h(A,z,q,y)}else{if(q.continuous&&u.cyclePause){r=10}}if(r>0){u.cycleTimeout=setTimeout(function(){e(x,q,0,!q.rev)},r)}}i.fn.cycle.updateActivePagerLink=function(q,r){i(q).each(function(){i(this).find("a").removeClass("activeSlide").filter("a:eq("+r+")").addClass("activeSlide")})};function h(v,s,u,r){if(u.timeoutFn){var q=u.timeoutFn(v,s,u,r);while((q-u.speed)<250){q+=u.speed}a("calculated timeout: "+q+"; speed: "+u.speed);if(q!==false){return q}}return u.timeout}i.fn.cycle.next=function(q){o(q,q.rev?-1:1)};i.fn.cycle.prev=function(q){o(q,q.rev?1:-1)};function o(r,u){var q=r.elements;var t=r.$cont[0],s=t.cycleTimeout;if(s){clearTimeout(s);t.cycleTimeout=0}if(r.random&&u<0){r.randomIndex--;if(--r.randomIndex==-2){r.randomIndex=q.length-2}else{if(r.randomIndex==-1){r.randomIndex=q.length-1}}r.nextSlide=r.randomMap[r.randomIndex]}else{if(r.random){if(++r.randomIndex==q.length){r.randomIndex=0}r.nextSlide=r.randomMap[r.randomIndex]}else{r.nextSlide=r.currSlide+u;if(r.nextSlide<0){if(r.nowrap){return false}r.nextSlide=q.length-1}else{if(r.nextSlide>=q.length){if(r.nowrap){return false}r.nextSlide=0}}}}if(i.isFunction(r.prevNextClick)){r.prevNextClick(u>0,r.nextSlide,q[r.nextSlide])}e(q,r,1,u>=0);return false}function d(r,s){var q=i(s.pager);i.each(r,function(t,u){i.fn.cycle.createPagerAnchor(t,u,q,r,s)});i.fn.cycle.updateActivePagerLink(s.pager,s.startingSlide)}i.fn.cycle.createPagerAnchor=function(u,v,s,t,w){var r;if(i.isFunction(w.pagerAnchorBuilder)){r=w.pagerAnchorBuilder(u,v)}else{r='<a href="#">'+(u+1)+"</a>"}if(!r){return}var x=i(r);if(x.parents("body").length===0){var q=[];if(s.length>1){s.each(function(){var y=x.clone(true);i(this).append(y);q.push(y[0])});x=i(q)}else{x.appendTo(s)}}x.bind(w.pagerEvent,function(A){A.preventDefault();w.nextSlide=u;var z=w.$cont[0],y=z.cycleTimeout;if(y){clearTimeout(y);z.cycleTimeout=0}if(i.isFunction(w.pagerClick)){w.pagerClick(w.nextSlide,t[w.nextSlide])}e(t,w,1,w.currSlide<u);return false});if(w.pagerEvent!="click"){x.click(function(){return false})}if(w.pauseOnPagerHover){x.hover(function(){w.$cont[0].cyclePause++},function(){w.$cont[0].cyclePause--})}};i.fn.cycle.hopsFromLast=function(t,s){var r,q=t.lastSlide,u=t.currSlide;if(s){r=u>q?u-q:t.slideCount-q}else{r=u<q?q-u:q+t.slideCount-u}return r};function g(s){function r(t){t=parseInt(t).toString(16);return t.length<2?"0"+t:t}function q(w){for(;w&&w.nodeName.toLowerCase()!="html";w=w.parentNode){var t=i.css(w,"background-color");if(t.indexOf("rgb")>=0){var u=t.match(/\d+/g);return"#"+r(u[0])+r(u[1])+r(u[2])}if(t&&t!="transparent"){return t}}return"#ffffff"}s.each(function(){i(this).css("background-color",q(this))})}i.fn.cycle.commonReset=function(v,t,u,r,s,q){i(u.elements).not(v).hide();u.cssBefore.opacity=1;u.cssBefore.display="block";if(r!==false&&t.cycleW>0){u.cssBefore.width=t.cycleW}if(s!==false&&t.cycleH>0){u.cssBefore.height=t.cycleH}u.cssAfter=u.cssAfter||{};u.cssAfter.display="none";i(v).css("zIndex",u.slideCount+(q===true?1:0));i(t).css("zIndex",u.slideCount+(q===true?0:1))};i.fn.cycle.custom=function(B,v,q,s,r){var A=i(B),w=i(v);var t=q.speedIn,z=q.speedOut,u=q.easeIn,y=q.easeOut;w.css(q.cssBefore);if(r){if(typeof r=="number"){t=z=r}else{t=z=1}u=y=null}var x=function(){w.animate(q.animIn,t,u,s)};A.animate(q.animOut,z,y,function(){if(q.cssAfter){A.css(q.cssAfter)}if(!q.sync){x()}});if(q.sync){x()}};i.fn.cycle.transitions={fade:function(r,s,q){s.not(":eq("+q.currSlide+")").css("opacity",0);q.before.push(function(v,t,u){i.fn.cycle.commonReset(v,t,u);u.cssBefore.opacity=0});q.animIn={opacity:1};q.animOut={opacity:0};q.cssBefore={top:0,left:0}}};i.fn.cycle.ver=function(){return l};i.fn.cycle.defaults={fx:"fade",timeout:4000,timeoutFn:null,continuous:0,speed:1000,speedIn:null,speedOut:null,next:null,prev:null,prevNextClick:null,prevNextEvent:"click",pager:null,pagerClick:null,pagerEvent:"click",pagerAnchorBuilder:null,before:null,after:null,end:null,easing:null,easeIn:null,easeOut:null,shuffle:null,animIn:null,animOut:null,cssBefore:null,cssAfter:null,fxFn:null,height:"auto",startingSlide:0,sync:1,random:0,fit:0,containerResize:1,pause:0,pauseOnPagerHover:0,autostop:0,autostopCount:0,delay:0,slideExpr:null,cleartype:!i.support.opacity,cleartypeNoBg:false,nowrap:0,fastOnEvent:0,randomizeEffects:1,rev:0,manualTrump:true,requeueOnImageNotLoaded:true,requeueTimeout:250}})(jQuery);
/*
 * jQuery Cycle Plugin Transition Definitions
 * This script is a plugin for the jQuery Cycle Plugin
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007-2008 M. Alsup
 * Version:	 2.72
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function(a){a.fn.cycle.transitions.none=function(c,d,b){b.fxFn=function(g,e,f,h){a(e).show();a(g).hide();h()}};a.fn.cycle.transitions.scrollUp=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.height();c.cssBefore={top:b,left:0};c.cssFirst={top:0};c.animIn={top:0};c.animOut={top:-b}};a.fn.cycle.transitions.scrollDown=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.height();c.cssFirst={top:0};c.cssBefore={top:-b,left:0};c.animIn={top:0};c.animOut={top:b}};a.fn.cycle.transitions.scrollLeft=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.width();c.cssFirst={left:0};c.cssBefore={left:b,top:0};c.animIn={left:0};c.animOut={left:0-b}};a.fn.cycle.transitions.scrollRight=function(d,e,c){d.css("overflow","hidden");c.before.push(a.fn.cycle.commonReset);var b=d.width();c.cssFirst={left:0};c.cssBefore={left:-b,top:0};c.animIn={left:0};c.animOut={left:b}};a.fn.cycle.transitions.scrollHorz=function(c,d,b){c.css("overflow","hidden").width();b.before.push(function(h,f,g,e){a.fn.cycle.commonReset(h,f,g);g.cssBefore.left=e?(f.cycleW-1):(1-f.cycleW);g.animOut.left=e?-h.cycleW:h.cycleW});b.cssFirst={left:0};b.cssBefore={top:0};b.animIn={left:0};b.animOut={top:0}};a.fn.cycle.transitions.scrollVert=function(c,d,b){c.css("overflow","hidden");b.before.push(function(h,f,g,e){a.fn.cycle.commonReset(h,f,g);g.cssBefore.top=e?(1-f.cycleH):(f.cycleH-1);g.animOut.top=e?h.cycleH:-h.cycleH});b.cssFirst={top:0};b.cssBefore={left:0};b.animIn={top:0};b.animOut={left:0}};a.fn.cycle.transitions.slideX=function(c,d,b){b.before.push(function(g,e,f){a(f.elements).not(g).hide();a.fn.cycle.commonReset(g,e,f,false,true);f.animIn.width=e.cycleW});b.cssBefore={left:0,top:0,width:0};b.animIn={width:"show"};b.animOut={width:0}};a.fn.cycle.transitions.slideY=function(c,d,b){b.before.push(function(g,e,f){a(f.elements).not(g).hide();a.fn.cycle.commonReset(g,e,f,true,false);f.animIn.height=e.cycleH});b.cssBefore={left:0,top:0,height:0};b.animIn={height:"show"};b.animOut={height:0}};a.fn.cycle.transitions.shuffle=function(e,f,d){var c,b=e.css("overflow","visible").width();f.css({left:0,top:0});d.before.push(function(i,g,h){a.fn.cycle.commonReset(i,g,h,true,true,true)});if(!d.speedAdjusted){d.speed=d.speed/2;d.speedAdjusted=true}d.random=0;d.shuffle=d.shuffle||{left:-b,top:15};d.els=[];for(c=0;c<f.length;c++){d.els.push(f[c])}for(c=0;c<d.currSlide;c++){d.els.push(d.els.shift())}d.fxFn=function(m,j,l,g,i){var h=i?a(m):a(j);a(j).css(l.cssBefore);var k=l.slideCount;h.animate(l.shuffle,l.speedIn,l.easeIn,function(){var o=a.fn.cycle.hopsFromLast(l,i);for(var q=0;q<o;q++){i?l.els.push(l.els.shift()):l.els.unshift(l.els.pop())}if(i){for(var r=0,n=l.els.length;r<n;r++){a(l.els[r]).css("z-index",n-r+k)}}else{var s=a(m).css("z-index");h.css("z-index",parseInt(s)+1+k)}h.animate({left:0,top:0},l.speedOut,l.easeOut,function(){a(i?this:m).hide();if(g){g()}})})};d.cssBefore={display:"block",opacity:1,top:0,left:0}};a.fn.cycle.transitions.turnUp=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false);f.cssBefore.top=e.cycleH;f.animIn.height=e.cycleH});b.cssFirst={top:0};b.cssBefore={left:0,height:0};b.animIn={top:0};b.animOut={height:0}};a.fn.cycle.transitions.turnDown=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false);f.animIn.height=e.cycleH;f.animOut.top=g.cycleH});b.cssFirst={top:0};b.cssBefore={left:0,top:0,height:0};b.animOut={height:0}};a.fn.cycle.transitions.turnLeft=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true);f.cssBefore.left=e.cycleW;f.animIn.width=e.cycleW});b.cssBefore={top:0,width:0};b.animIn={left:0};b.animOut={width:0}};a.fn.cycle.transitions.turnRight=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true);f.animIn.width=e.cycleW;f.animOut.left=g.cycleW});b.cssBefore={top:0,left:0,width:0};b.animIn={left:0};b.animOut={width:0}};a.fn.cycle.transitions.zoom=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,false,true);f.cssBefore.top=e.cycleH/2;f.cssBefore.left=e.cycleW/2;f.animIn={top:0,left:0,width:e.cycleW,height:e.cycleH};f.animOut={width:0,height:0,top:g.cycleH/2,left:g.cycleW/2}});b.cssFirst={top:0,left:0};b.cssBefore={width:0,height:0}};a.fn.cycle.transitions.fadeZoom=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,false);f.cssBefore.left=e.cycleW/2;f.cssBefore.top=e.cycleH/2;f.animIn={top:0,left:0,width:e.cycleW,height:e.cycleH}});b.cssBefore={width:0,height:0};b.animOut={opacity:0}};a.fn.cycle.transitions.blindX=function(d,e,c){var b=d.css("overflow","hidden").width();c.before.push(function(h,f,g){a.fn.cycle.commonReset(h,f,g);g.animIn.width=f.cycleW;g.animOut.left=h.cycleW});c.cssBefore={left:b,top:0};c.animIn={left:0};c.animOut={left:b}};a.fn.cycle.transitions.blindY=function(d,e,c){var b=d.css("overflow","hidden").height();c.before.push(function(h,f,g){a.fn.cycle.commonReset(h,f,g);g.animIn.height=f.cycleH;g.animOut.top=h.cycleH});c.cssBefore={top:b,left:0};c.animIn={top:0};c.animOut={top:b}};a.fn.cycle.transitions.blindZ=function(e,f,d){var c=e.css("overflow","hidden").height();var b=e.width();d.before.push(function(i,g,h){a.fn.cycle.commonReset(i,g,h);h.animIn.height=g.cycleH;h.animOut.top=i.cycleH});d.cssBefore={top:c,left:b};d.animIn={top:0,left:0};d.animOut={top:c,left:b}};a.fn.cycle.transitions.growX=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true);f.cssBefore.left=this.cycleW/2;f.animIn={left:0,width:this.cycleW};f.animOut={left:0}});b.cssBefore={width:0,top:0}};a.fn.cycle.transitions.growY=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false);f.cssBefore.top=this.cycleH/2;f.animIn={top:0,height:this.cycleH};f.animOut={top:0}});b.cssBefore={height:0,left:0}};a.fn.cycle.transitions.curtainX=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,false,true,true);f.cssBefore.left=e.cycleW/2;f.animIn={left:0,width:this.cycleW};f.animOut={left:g.cycleW/2,width:0}});b.cssBefore={top:0,width:0}};a.fn.cycle.transitions.curtainY=function(c,d,b){b.before.push(function(g,e,f){a.fn.cycle.commonReset(g,e,f,true,false,true);f.cssBefore.top=e.cycleH/2;f.animIn={top:0,height:e.cycleH};f.animOut={top:g.cycleH/2,height:0}});b.cssBefore={left:0,height:0}};a.fn.cycle.transitions.cover=function(f,g,e){var i=e.direction||"left";var b=f.css("overflow","hidden").width();var c=f.height();e.before.push(function(j,d,h){a.fn.cycle.commonReset(j,d,h);if(i=="right"){h.cssBefore.left=-b}else{if(i=="up"){h.cssBefore.top=c}else{if(i=="down"){h.cssBefore.top=-c}else{h.cssBefore.left=b}}}});e.animIn={left:0,top:0};e.animOut={opacity:1};e.cssBefore={top:0,left:0}};a.fn.cycle.transitions.uncover=function(f,g,e){var i=e.direction||"left";var b=f.css("overflow","hidden").width();var c=f.height();e.before.push(function(j,d,h){a.fn.cycle.commonReset(j,d,h,true,true,true);if(i=="right"){h.animOut.left=b}else{if(i=="up"){h.animOut.top=-c}else{if(i=="down"){h.animOut.top=c}else{h.animOut.left=-b}}}});e.animIn={left:0,top:0};e.animOut={opacity:1};e.cssBefore={top:0,left:0}};a.fn.cycle.transitions.toss=function(e,f,d){var b=e.css("overflow","visible").width();var c=e.height();d.before.push(function(i,g,h){a.fn.cycle.commonReset(i,g,h,true,true,true);if(!h.animOut.left&&!h.animOut.top){h.animOut={left:b*2,top:-c/2,opacity:0}}else{h.animOut.opacity=0}});d.cssBefore={left:0,top:0};d.animIn={left:0}};a.fn.cycle.transitions.wipe=function(s,m,e){var q=s.css("overflow","hidden").width();var j=s.height();e.cssBefore=e.cssBefore||{};var g;if(e.clip){if(/l2r/.test(e.clip)){g="rect(0px 0px "+j+"px 0px)"}else{if(/r2l/.test(e.clip)){g="rect(0px "+q+"px "+j+"px "+q+"px)"}else{if(/t2b/.test(e.clip)){g="rect(0px "+q+"px 0px 0px)"}else{if(/b2t/.test(e.clip)){g="rect("+j+"px "+q+"px "+j+"px 0px)"}else{if(/zoom/.test(e.clip)){var o=parseInt(j/2);var f=parseInt(q/2);g="rect("+o+"px "+f+"px "+o+"px "+f+"px)"}}}}}}e.cssBefore.clip=e.cssBefore.clip||g||"rect(0px 0px 0px 0px)";var k=e.cssBefore.clip.match(/(\d+)/g);var u=parseInt(k[0]),c=parseInt(k[1]),n=parseInt(k[2]),i=parseInt(k[3]);e.before.push(function(w,h,t){if(w==h){return}var d=a(w),b=a(h);a.fn.cycle.commonReset(w,h,t,true,true,false);t.cssAfter.display="block";var r=1,l=parseInt((t.speedIn/13))-1;(function v(){var y=u?u-parseInt(r*(u/l)):0;var z=i?i-parseInt(r*(i/l)):0;var A=n<j?n+parseInt(r*((j-n)/l||1)):j;var x=c<q?c+parseInt(r*((q-c)/l||1)):q;b.css({clip:"rect("+y+"px "+x+"px "+A+"px "+z+"px)"});(r++<=l)?setTimeout(v,13):d.css("display","none")})()});e.cssBefore={display:"block",opacity:1,top:0,left:0};e.animIn={left:0};e.animOut={left:0}}})(jQuery);
/////////////////////////////////////////////////////
$(document).ready(function() {
	$('.scrollup').cycle({fx: 'scrollUp'});
    $('.scrollleft').cycle({fx: 'scrollLeft'});
	$('.shuffle').cycle({fx: 'shuffle'});
	$('.fade').cycle({fx: 'fade'});
	$('.pager').before('<div id="nav">').cycle({
		fx: 'fade',
		speed: 'slow',
		timeout: '4000',
		pager: '#nav'
	});
	//$.fn.cycle.updateActivePagerLink = function(pager, currSlideIndex) { 
    //$(pager).find('li').removeClass('activeLI') 
    //.filter('li:eq('+currSlideIndex+')').addClass('activeLI'); 
	//};       
	//$('.pagerAdv').after('<ul class="nav reset">').cycle({ 
    //timeout: 3000, 
    //pager:  '.nav', 
    //pagerAnchorBuilder: function(idx, slide) { 
      //var xt = $('.pagerAdv #slide-'+idx+'').html();
      //if(idx == 0){ return '<li class="first">' + xt + '</li>'; }
      //else{ return '<li>' + xt + '</li>'; }
    //}
	//}); 
	//$('#pagerGallery').after('<ul class="nav reset">').cycle({ 
    //timeout: 3000, 
    //pager:  '.nav', 
    //pagerAnchorBuilder: function(idx, slide) { 
      //var xt = $('#pagerGallery #slide-'+idx+'').attr('style').replace('600x450','100x100').split(';');
      //if(idx == 0){ return '<li class="first"><span style="' + xt[0] + '"></span></li>'; }
      //else{ return '<li><span style="' + xt[0] + '"></span></li>'; }
    //}
	//});
});
/////////////////////////////////////////////////////
// JQuery Tooltip Plugin //
/////////////////////////////////////////////////////
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i))){
	// tooltips introduces double clicking on ipad / iphone: 1st click - tooltip, 2nd click - activate link
} else {
/*
 * jQuery Tooltip plugin 1.3
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 * Copyright (c) 2006 - 2008 Jörn Zaefferer
 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
	*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';(8($){j e={},9,m,B,A=$.2u.2g&&/29\\s(5\\.5|6\\.)/.1M(1H.2t),M=12;$.k={w:12,1h:{Z:25,r:12,1d:19,X:"",G:15,E:15,16:"k"},2s:8(){$.k.w=!$.k.w}};$.N.1v({k:8(a){a=$.1v({},$.k.1h,a);1q(a);g 2.F(8(){$.1j(2,"k",a);2.11=e.3.n("1g");2.13=2.m;$(2).24("m");2.22=""}).21(1e).1U(q).1S(q)},H:A?8(){g 2.F(8(){j b=$(2).n(\'Y\');4(b.1J(/^o\\(["\']?(.*\\.1I)["\']?\\)$/i)){b=1F.$1;$(2).n({\'Y\':\'1D\',\'1B\':"2r:2q.2m.2l(2j=19, 2i=2h, 1p=\'"+b+"\')"}).F(8(){j a=$(2).n(\'1o\');4(a!=\'2f\'&&a!=\'1u\')$(2).n(\'1o\',\'1u\')})}})}:8(){g 2},1l:A?8(){g 2.F(8(){$(2).n({\'1B\':\'\',Y:\'\'})})}:8(){g 2},1x:8(){g 2.F(8(){$(2)[$(2).D()?"l":"q"]()})},o:8(){g 2.1k(\'28\')||2.1k(\'1p\')}});8 1q(a){4(e.3)g;e.3=$(\'<t 16="\'+a.16+\'"><10></10><t 1i="f"></t><t 1i="o"></t></t>\').27(K.f).q();4($.N.L)e.3.L();e.m=$(\'10\',e.3);e.f=$(\'t.f\',e.3);e.o=$(\'t.o\',e.3)}8 7(a){g $.1j(a,"k")}8 1f(a){4(7(2).Z)B=26(l,7(2).Z);p l();M=!!7(2).M;$(K.f).23(\'W\',u);u(a)}8 1e(){4($.k.w||2==9||(!2.13&&!7(2).U))g;9=2;m=2.13;4(7(2).U){e.m.q();j a=7(2).U.1Z(2);4(a.1Y||a.1V){e.f.1c().T(a)}p{e.f.D(a)}e.f.l()}p 4(7(2).18){j b=m.1T(7(2).18);e.m.D(b.1R()).l();e.f.1c();1Q(j i=0,R;(R=b[i]);i++){4(i>0)e.f.T("<1P/>");e.f.T(R)}e.f.1x()}p{e.m.D(m).l();e.f.q()}4(7(2).1d&&$(2).o())e.o.D($(2).o().1O(\'1N://\',\'\')).l();p e.o.q();e.3.P(7(2).X);4(7(2).H)e.3.H();1f.1L(2,1K)}8 l(){B=S;4((!A||!$.N.L)&&7(9).r){4(e.3.I(":17"))e.3.Q().l().O(7(9).r,9.11);p e.3.I(\':1a\')?e.3.O(7(9).r,9.11):e.3.1G(7(9).r)}p{e.3.l()}u()}8 u(c){4($.k.w)g;4(c&&c.1W.1X=="1E"){g}4(!M&&e.3.I(":1a")){$(K.f).1b(\'W\',u)}4(9==S){$(K.f).1b(\'W\',u);g}e.3.V("z-14").V("z-1A");j b=e.3[0].1z;j a=e.3[0].1y;4(c){b=c.2o+7(9).E;a=c.2n+7(9).G;j d=\'1w\';4(7(9).2k){d=$(C).1r()-b;b=\'1w\'}e.3.n({E:b,14:d,G:a})}j v=z(),h=e.3[0];4(v.x+v.1s<h.1z+h.1n){b-=h.1n+20+7(9).E;e.3.n({E:b+\'1C\'}).P("z-14")}4(v.y+v.1t<h.1y+h.1m){a-=h.1m+20+7(9).G;e.3.n({G:a+\'1C\'}).P("z-1A")}}8 z(){g{x:$(C).2e(),y:$(C).2d(),1s:$(C).1r(),1t:$(C).2p()}}8 q(a){4($.k.w)g;4(B)2c(B);9=S;j b=7(2);8 J(){e.3.V(b.X).q().n("1g","")}4((!A||!$.N.L)&&b.r){4(e.3.I(\':17\'))e.3.Q().O(b.r,0,J);p e.3.Q().2b(b.r,J)}p J();4(7(2).H)e.3.1l()}})(2a);',62,155,'||this|parent|if|||settings|function|current||||||body|return|||var|tooltip|show|title|css|url|else|hide|fade||div|update||blocked|||viewport|IE|tID|window|html|left|each|top|fixPNG|is|complete|document|bgiframe|track|fn|fadeTo|addClass|stop|part|null|append|bodyHandler|removeClass|mousemove|extraClass|backgroundImage|delay|h3|tOpacity|false|tooltipText|right||id|animated|showBody|true|visible|unbind|empty|showURL|save|handle|opacity|defaults|class|data|attr|unfixPNG|offsetHeight|offsetWidth|position|src|createHelper|width|cx|cy|relative|extend|auto|hideWhenEmpty|offsetTop|offsetLeft|bottom|filter|px|none|OPTION|RegExp|fadeIn|navigator|png|match|arguments|apply|test|http|replace|br|for|shift|click|split|mouseout|jquery|target|tagName|nodeType|call||mouseover|alt|bind|removeAttr|200|setTimeout|appendTo|href|MSIE|jQuery|fadeOut|clearTimeout|scrollTop|scrollLeft|absolute|msie|crop|sizingMethod|enabled|positionLeft|AlphaImageLoader|Microsoft|pageY|pageX|height|DXImageTransform|progid|block|userAgent|browser'.split('|'),0,{}))
/////////////////////////////////////////////////////
$(function() {
	$('a').tooltip({ 
		track: true, 
		delay: 0, 
		showURL: false, 
		showBody: " - ", 
		fade: 250 
	});
	$('dfn').tooltip({ 
		track: true, 
		delay: 0, 
		showURL: false, 
		showBody: " - ", 
		fade: 250 
	});
	$('#ajax em').tooltip({ 
		track: true, 
		delay: 0, 
		showURL: false, 
		showBody: " - ", 
		fade: 250 
	});
});
}
