// ========================================
// = Frogzog. Unified Theme JS Functions. =
// ========================================

// req'd js
/* jquery.js, pngfix.js (for ie < 7) */
// req'd css
/* unified.css, unified_ie.css (for ie) */
// included jquery extensions:
/* color, dimensions, fzu_dimScreen (custom), hoverIntent */
// other js
/* sifr */

// apply all unified theme bindings
function fzu_bind(context) {
	// sifr
	if (typeof sIFR == 'function') { sIFR.replaceElement('.sifr_h1_bold', named({sFlashSrc: "/swf/sifr/vista_sans_alt_bold.swf", sColor: "#8CC542", sFlashVars: 'letterSpacing=-2&offsetLeft=2' })); sIFR.replaceElement('.sifr_h1_bolditalic', named({sFlashSrc: "/swf/sifr/vista_sans_alt_bolditalic.swf", sColor: "#8CC542", sFlashVars: 'letterSpacing=-2&offsetLeft=2' })); }
	// bind dropbox styles
	fzu_dropboxBind(context);
	// bind .filter widget
	fzu_filterBind(context);
	// bind <input type="checkbox" class="input_checkbox">'s to custom skinning
	fzu_inputCheckboxesBind(context);
	// bind input date selector (.input_date)
	fzu_inputDateBind(context);
	// input, disable on submit
	fzu_inputDisableOnSubmit(context);
	// bind input hints, creates p.input_hint w/ corresponding <label> title attribute after the <label> and enables the a.input_hint_toggle link to show/hide the p.input_hints
	fzu_inputHintsBind(context);
	// bind max length, adds .input_text_counter and logic to .input_text_maxlength, .input_text_maxlines, and .input_text_maxphrases
	fzu_inputMaxLengthBind(context);
	// bind <input type="radio" class="input_radio">'s to custom skinning
	fzu_inputRadioBind(context);
	// bind <select class="input_select">'s to custom skinning
	fzu_inputSelectsBind(context);
	// modal window bindings
	fzu_modalBind(context);
	// add in percentage bars
	fzu_percentageBars(context);
	// png fix (for ie < 7)
	fzu_pngFix(context);
	// scrollimate
	fzu_scrollimate(context);
	// auto show / hide table rows
	fzu_showAllTopBind(context);
	// tips bind
	fzu_tipBind(context);
}

// fzu, bind .dropbox styles
function fzu_dropboxBind(context) {
	// for each dropbox_trigger
	$('.dropbox_trigger', context).each(function() {
		// the target dropbox
		var $dropbox = $('#' + $(this).attr('id').replace(/_trigger/, ''));
		// store target to 'rel', add hand cursor style, and add toggle function on click
		$(this).attr('rel', $dropbox.attr('id')).css('cursor', 'pointer').click(function() { fzu_dropboxToggle($(this).attr('rel')); });
		// setup the dropbox up (show it, wrap it, and adjust margin-top to hide)
		$dropbox.css('display', 'block').css('margin-top', '-' + $dropbox.outerHeight() + 'px').wrap('<div class="dropbox_content_wrapper" style="height: ' + $dropbox.outerHeight() + 'px; top: ' + $(this).outerHeight() + 'px; width: ' + $dropbox.outerWidth() + 'px; visibility: hidden;"></div>');
		// if right align drop box, position the dropbox
		if ($dropbox.hasClass('right')) {
			// trigger offset
			var trigger_position = $(this).position();
			// position the dropbox
			$dropbox.parent('.dropbox_content_wrapper').css('left', trigger_position.left + $(this).outerWidth() - $dropbox.outerWidth() + 'px');
		}
		// else left align
		else {
			// label offset
			var label_position = $(this).siblings('.dropbox_label').position();
			// position the dropbox
			$dropbox.parent('.dropbox_content_wrapper').css('left', label_position.left + 'px');
		}
	});
}

// fzu, dropbox, hide all
function fzu_dropboxHide() {
	// for each shown dropbox
	$('.dropbox_content.dropbox_shown').each(function() {
		// remove selected class from the trigger
		$('#' + $(this).attr('id') + '_trigger').removeClass('selected').siblings('.dropbox_label').removeClass('dropbox_label_selected');
		// hide the drop box
		$(this).animate({ marginTop: '-' + $(this).outerHeight() + 'px' }, 200, 'swing', function() { $(this).removeClass('dropbox_shown').parent('.dropbox_content_wrapper').css('visibility', 'hidden').parent('.dropbox').css('z-index', 1); });
		// unbind listeners
		$(document).unbind('mousedown', fzu_dropboxMouseListener);
	});
}

// fzu, dropbox selector mouse listener
function fzu_dropboxMouseListener(event) {
	// mouse click target
	var $target = $(event.target);
	// close dropbox if click didn't occur inside it
	if (!$target.hasClass('dropbox_content') && !$target.parents('.dropbox_content').length) fzu_dropboxHide();
}

// fzu, toggle a drop box
function fzu_dropboxToggle(dropbox_id) {
	// target dropbox
	var $dropbox = $('#' + dropbox_id);
	// dropbox's trigger
	var $trigger = $('#' + dropbox_id + '_trigger');
	// if not shown
	if (!$dropbox.hasClass('dropbox_shown')) {
		// add selected class to the trigger
		$trigger.addClass('selected').siblings('.dropbox_label').addClass('dropbox_label_selected');
		// show the dropbox container
		$dropbox.parent('.dropbox_content_wrapper').css('visibility', 'visible').parent('.dropbox').css('z-index', 2);
		// show the drop box
		$dropbox.addClass('dropbox_shown').animate({ marginTop: '0' }, 200, 'swing');
		// bind listener
		$(document).bind('mousedown', fzu_dropboxMouseListener);
	}
	// else is shown, hide all the shown drop boxes
	else fzu_dropboxHide();
}

// fzu, bind .filter style searching
function fzu_filterBind(context) {
	// filter text (input box) bindings
	$('.filter_text', context).each(function() {
		// store original text, set on click, set on focus and blur
		$(this).attr('original_value', $(this).attr('value')).click(function() { if ($(this).attr('value') == $(this).attr('original_value')) $(this).attr('value', ''); }).keyup(function(event) { fzu_filterUpdate(event, $(this).attr('id'), $(this).attr('id').replace(/_filter/, '')); });
	});
	// filter button (clear) bindings
	$('.filter_clear', context).click(function(event) {
		// the filter text
		var $filter_text = $(this).siblings('.filter_text');
		// remove the value of the text and focus on it
		$filter_text.attr('value', '').focus();
		// and update the filter
		fzu_filterUpdate(event, $filter_text.attr('id'), $filter_text.attr('id').replace(/_filter/, ''));
	});
}

// fzu, update a filter
function fzu_filterUpdate(event, filter_text_id, filter_items_id) {
	// the filter text <input>
	$filter_text = $('#' + filter_text_id);
	// the filter items container
	$filter_items = $('#' + filter_items_id);
	// if keypress == 'esc', clear the text before updating
	if (event.keyCode == 27) $filter_text.attr('value', '');
	// if no filter text, or filter text = original text, show all items
	if (!$filter_text.attr('value') || $filter_text.attr('value') == $filter_text.attr('original_value')) {
		$filter_items.find('.filter_item').removeClass('hide');
		return;
	}
	// else filter at will
	else $filter_items.find('.filter_item').each(function() {
		// (the filter text search is stored in title)
		if (!$(this).attr('title').toLowerCase().match($filter_text.attr('value').toLowerCase()) && !$(this).hasClass('selected')) $(this).addClass('hide');
		// else show it
		else $(this).removeClass('hide');
	});
}

// update custom-skinned <input type="radio" class="input_radio"> on global mouse up (to avoid click on decoy and release outside)
function fzu_inputCheckboxMouseUp(context) {
	// remove focus style on all decoys
	$('input[type="checkbox"].input_checkbox', context).each(function() {
		$('#' + $(this).attr('rel')).removeClass('input_checkbox_decoy_focus input_checkbox_decoy_checked_focus');
	});
}

// update custom-skinned <input type="checkbox" class="input_checkbox">
function fzu_inputCheckboxUpdate($target) {
	// update the decoy <span> style based to match the <input>
	$target.each(function() { $(this).attr('checked') ? $('#' + $(this).attr('rel')).addClass('input_checkbox_decoy_checked') : $('#' + $(this).attr('rel')).removeClass('input_checkbox_decoy_checked'); });
}

// bind <input type="checkbox" class="input_checkbox">'s to custom skinning (hides actual <input>, uses decoy <span>, kudos to ryanfait.com)
function fzu_inputCheckboxesBind(context) {
	$('input[type="checkbox"].input_checkbox', context).each(function() {
		// do we need to add HTMl, style and bind, or just update the style
		var style_only = $('#' + $(this).attr('rel')).length ? true : false;
		// if the decoy hasn't been created yet
		if (!style_only) {
			// store the id of the decoy style to the <input> rel attribute (yes I know technically this is illegal)
			$(this).attr('rel', 'input_checkbox_decoy_' + $(this).attr('id'));
			// create the decoy <span> (viewable part of the skin) add the decoy applied style to the <input>
			if (!style_only) $(this).addClass('input_checkbox_decoy_applied').before('<span id="' + $(this).attr('rel') + '" class="input_checkbox_decoy"></span>');
		}
		// update <input> sizing
		$(this).css('width', $('#' + $(this).attr('rel')).outerWidth() + 'px');
		// initial checkbox update
		fzu_inputCheckboxUpdate($(this));
		// if we are only adding or updating the style, stop here and don't re-apply bindings
		if (style_only) return;
		// bindings
		$(this).mousedown(function() {
			// on <input> mouse down add appropriate focus class to decoy <span> (depending on whether or not its checked)
			$('#' + $(this).attr('rel')).addClass($(this).attr('checked') ? 'input_checkbox_decoy_checked_focus' : 'input_checkbox_decoy_focus');
		}).mouseup(function() {
			// on <input> mouse up remove focus classes from decoy <span>
			$('#' + $(this).attr('rel')).removeClass('input_checkbox_decoy_focus input_checkbox_decoy_checked_focus');
		}).click(function() {
			// on <input> changed update decoy <span> checked class for all related checkboxes (set to click not change because IE doesn't update changed on radio's until its blurred)
			fzu_inputCheckboxUpdate($(this));
		});
	});
	// global mouse up bind to avoid case when user clicks on decoy and releases outside
	$(document).bind('mouseup', function() { fzu_inputCheckboxMouseUp(); });
}

// select a custom checkbox
function fzu_inputCheckboxSelect($checkbox) {
	$checkbox.attr('checked', 'checked');
	$('#' + $checkbox.attr('rel')).addClass('input_checkbox_decoy_checked');
}

// un-select a custom checkbox
function fzu_inputCheckboxUnselect($checkbox) {
	$checkbox.removeAttr('checked');
	$('#' + $checkbox.attr('rel')).removeClass('input_checkbox_decoy_checked');
}

// fzu, date selector bindings
function fzu_inputDateBind(context) {
	// date input
	$('.input_date, .input_date_inline', context).each(function() {
		// is inline datepicker? (always shown rather than auto show/hide on form focus/blur)
		var inline = $(this).hasClass('input_date_inline');
		// datepicker config
		var datepicker_config = fzu_inputDateConfig($(this).attr('id'));
		// inline datepicker specific
		if (inline) {
			// id for the hidden <input> (steals from the datepicker <span> container)
			var input_id = $(this).attr('id');
			// new id the the datepicker <span> container (since we can't have duplicate IDs)
			var container_id = $(this).attr('id') + '_datepicker';
			// on inline datepicker select update the hidden <input>
			datepicker_config.onSelect = function(date_text, date_picker) { $('#' + $(this).attr('rel')).attr('value', date_text); };
			// update the <span> container id, store its target hidden <input> to the <span> rel attribute, create the hidden <input>, and create the datepicker
			$(this).attr('id', container_id).attr('rel', input_id).after('<input type="hidden" id="' + input_id + '" name="' + input_id + '" value="" />').datepicker(datepicker_config);
		}
		// else !inline
		else {
			// update datepicker config to give focus back to form field unless IE, which is lame and doesn't want to play so nice
			datepicker_config.onClose = function() { if (!$.browser.msie) $(this).focus(); };
			// auto show/hide on form focus/blur
			$(this).datepicker(datepicker_config);
		}
	});
	// date range input
	$('.input_date_range, .input_date_range_inline', context).each(function() {
		// is inline datepicker? (always shown rather than auto show/hide on form focus/blur)
		var inline = $(this).hasClass('input_date_range_inline');
		// id for the input, container, the 'from' and 'to' datepickers
		var input_id = $(this).attr('id');
		var container_id = $(this).attr('id') + '_container';
		var from_id = $(this).attr('id') + '_from';
		var to_id = $(this).attr('id') + '_to';
		// date range container HTML
		var container_html = '<div id="' + container_id + '" class="input_date_range_container ui-corner-all"><div class="input_date_range_section"><h4>From</h4><span id="' + from_id + '" class="input_date_inline"></span></div><div class="input_date_range_section"><h4>To</h4><span id="' + to_id + '" class="input_date_inline"></span></div><div class="clear">&nbsp;</div></div>';
		// if inline, write container HTML after <input>
		if (inline) $(this).after(container_html);
		// else, write container HTML at end of body
		else $('body').append(container_html);
		// create 'from' datepicker
		var from_config = fzu_inputDateConfig(from_id);
		from_config.onChangeMonthYear = function(year, month, date_picker) { fzu_inputDateRangeHighlightSelected(input_id); };
		from_config.onSelect = function(data_text, date_picker) { $('#' + to_id).datepicker('option', 'minDate', new Date(data_text)); fzu_inputDateRangeHighlightSelected(input_id); fzu_inputDateRangeUpdateValue(input_id); };
		$('#' + from_id).datepicker(from_config);
		// create 'to' datepicker
		var to_config = fzu_inputDateConfig(to_id);
		to_config.onChangeMonthYear = function(year, month, date_picker) { fzu_inputDateRangeHighlightSelected(input_id); };
		to_config.onSelect = function(data_text, date_picker) { $('#' + from_id).datepicker('option', 'maxDate', new Date(data_text)); fzu_inputDateRangeHighlightSelected(input_id); fzu_inputDateRangeUpdateValue(input_id); };
		$('#' + to_id).datepicker(to_config);
		// inline date range picker specific
		if (inline) {
			// value
			var input_value = $(this).text();
			// nix the <span>
			$(this).remove();
			// add a hidden <input>
			$('#' + container_id).before('<input type="hidden" name="' + input_id + '" id="' + input_id + '" value="' + input_value + '" />');
			// set dates
			var selected_dates = input_value.split(' - ');
			$('#' + from_id).datepicker('setDate', new Date(selected_dates[0]));
			$('#' + to_id).datepicker('setDate', new Date(selected_dates[1]));
		}
		// else !inline, auto show/hide on form focus/blur
		else {
			// add controls, hide container by default
			$('#' + container_id).append('<div class="input_date_range_controls"><input type="button" value="Done" class="input_button input_button_submit" onclick="javascript: fzu_inputDateRangeHide(true);" /></div>').css('display', 'none');
			// on focus, show date range picker, add 'focus' class
			$('#' + input_id).focus(function() { $(this).addClass('focus'); fzu_inputDateRangeShow($(this).attr('id')); });
			// on blur, remove 'focus' class
			$('#' + input_id).blur(function() { $(this).removeClass('focus'); });
			// if right align range
			if ($(this).hasClass('input_date_range_right')) $('#' + container_id).addClass('right');
		}
		// and do initial higlight
		fzu_inputDateRangeHighlightSelected(input_id);
	});
}

// fzu, get date selector config
function fzu_inputDateConfig(input_id) {
	/* for a list of configuration options see http://jqueryui.com/demos/datepicker/ */
	// start with defaults
	var datepicker_config = {
		dateFormat: 'd M yy',
		dayNamesMin: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
		duration: 200,
		nextText: 'Next Month',
		prevText: 'Previous Month',
		showAnim: 'slideDown'	
	};
	// if this datepicker has custom config set
	if ($('#' + input_id + '_config').length) {
		// get input config json
		var input_config = eval('(' + $('#' + input_id + '_config').attr('value') + ')');
		// update datepicker_config object
		for (property in input_config) {
			// ignore prototype properties
			if (!input_config.hasOwnProperty(property)) continue;
			// update datepicker_config
			datepicker_config[property] = input_config[property];
		}
	}
	// and return
	return datepicker_config;
}

// fzu, date range selector hide
function fzu_inputDateRangeHide(add_focus) {
	// if add focus update input and focus (and not IE which doesn't play nice)
	if (add_focus && !$.browser.msie) $('.input_date_range_open').removeClass('.input_date_range_open').focus();
	// else just update input
	else $('.input_date_range_open').removeClass('.input_date_range_open');
	// hide container
	$('.input_date_range_shown').removeClass('input_date_range_shown').slideUp(200);
	// unbind listener
	$(document).unbind('keyup', fzu_inputDateRangeKeyListener);
	$(document).unbind('mousedown', fzu_inputDateRangeMouseListener);
}

// fzu, date range higlight selected dates
function fzu_inputDateRangeHighlightSelected(input_id) {
	// wait just a sec for the date picker to update itself
	setTimeout(function() {
		// from date
		var from_date = $('#' + input_id + '_from').datepicker('getDate');
		// to date
		var to_date = $('#' + input_id + '_to').datepicker('getDate');
		// for each datepicker
		$('#' + input_id + '_container .input_date_range_section').each(function() {
			// month and year of datepicker
			var month_year = ' ' + $(this).find('.ui-datepicker-month').text() + ' ' + $(this).find('.ui-datepicker-year').text();
			// for each date in the datepicker
			$(this).find('td[onclick]').each(function() {
				// date object
				var compare_date = new Date($(this).children('a').text() + month_year);
				// highlight/unhighlight if in range
				compare_date >= from_date && compare_date <= to_date ? $(this).addClass('input_date_range_highlight') : $(this).removeClass('input_date_range_highlight');
			});
		});
	}, 100);
}

// fzu, date range selector key listener
function fzu_inputDateRangeKeyListener(event) {
	// continue by key press
	switch(event.keyCode) {
		// on 'tab' keypress, hide if input doesn't have focus
		case 9:
			if (!$(event.target).hasClass('focus')) fzu_inputDateRangeHide();
			break;
		// on 'esc' close date range
		case 27:
			fzu_inputDateRangeHide();
			break;
	}
}

// fzu, date range selector mouse listener
function fzu_inputDateRangeMouseListener(event) {
	// mouse click target
	var $target = $(event.target);
	// close range selector if click didn't happen on container or input of the date range
	if (!$target.hasClass('.input_date_range_open') && !$target.parents('.input_date_range_open').length && !$target.parents('.input_date_range_shown').length) fzu_inputDateRangeHide();
}

// fzu, date range selector show
function fzu_inputDateRangeShow(input_id) {
	// container
	var $container = $('#' + input_id + '_container');
	// input
	var $input = $('#' + input_id);
	// update the selected dates
	fzu_inputDateRangeUpdateSelected(input_id);
	// input: add class to note it has open date range
	$input.addClass('input_date_range_open');
	// input offset
	var input_offset = $input.offset();
	// if right align
	if ($container.hasClass('right')) left_pos = (input_offset.left + $input.outerWidth()) - $container.outerWidth();
	// else left align
	else left_pos = input_offset.left;
	// container: add class, position and show
	$container.addClass('input_date_range_shown').css({ left: left_pos + 'px', position: 'absolute', top: input_offset.top + $input.outerHeight() + 'px' }).slideDown(200);
	// bind listener
	$(document).bind('keyup', fzu_inputDateRangeKeyListener);
	$(document).bind('mousedown', fzu_inputDateRangeMouseListener);
}

// fzu, update date range datepicker selected days
function fzu_inputDateRangeUpdateSelected(input_id) {
	// split dates by seperator (-)
	var dates = $('#' + input_id).attr('value').split('-');
	// if dates, set em
	if (dates[0] && dates[1]) {
		$('#' + input_id + '_from').datepicker('setDate', new Date(dates[0]));
		$('#' + input_id + '_to').datepicker('setDate', new Date(dates[1]));
	}
	// and highlight the current selection
	fzu_inputDateRangeHighlightSelected(input_id);
}

// fzu, update date range <input> value
function fzu_inputDateRangeUpdateValue(input_id) {
	// get selected dates in date text format
	var from_date_text = $.datepicker.formatDate($('#' + input_id + '_from').datepicker('option', 'dateFormat'), $('#' + input_id + '_from').datepicker('getDate'));
	var to_date_text = $.datepicker.formatDate($('#' + input_id + '_to').datepicker('option', 'dateFormat'), $('#' + input_id + '_to').datepicker('getDate'));
	// update input value
	$('#' + input_id).attr('value', from_date_text + ' - ' + to_date_text);
}

// fzu, disable form fields
function fzu_inputDisable(context, on_submit) {
	// disable and add disabled class for inputs
	$('input, .input_checkbox_decoy, .input_radio_decoy, .input_select_decoy, textarea', context).each(function() {
		// if already disabled, store 'input_disable_persistent' class so we don't enable it when we shouldn't
		if ($(this).attr('disabled') == true) $(this).addClass('input_disable_persistent');
		// and disable and add disabled class
		$(this).attr('disabled', true).addClass('disabled');
	});
	// and the same goes for inline datepickers
	$('.input_date_inline', context).each(function() {
		// if already disabled, store 'input_disable_persistent' class so we don't enable it when we shouldn't
		if ($(this).datepicker('isDisabled')) $(this).addClass('input_disable_persistent');
		// and disable and add disabled class
		$(this).addClass('disabled').datepicker('disable');
	});
}

// fzu, disable form fields on form submit
function fzu_inputDisableOnSubmit(context) {
	// on form submit
	$('form:not(.filter)', context).submit(function() {
		// disable submit buttons
		fzu_inputDisable($(this).find('input[type="submit"]'));
	});
}

// fzu, enable form fields (useful if re-enabling after disabling on submit)
function fzu_inputEnable(context) {
	// enable and remove disabled class for inputs
	$('input, .input_checkbox_decoy, .input_radio_decoy, .input_select_decoy, textarea', context).each(function() {
		// if persistent disable (was disabled before fzu_inputDisable was called) don't enable it
		if ($(this).hasClass('input_disable_persistent')) $(this).removeClass('input_disable_persistent');
		// else good to
		else $(this).removeAttr('disabled').removeClass('disabled');
	});
	// and the same goes for inline datepickers
	$('.input_date_inline', context).each(function() {
		// if persistent disable (was disabled before fzu_inputDisable was called) don't enable it
		if ($(this).hasClass('input_disable_persistent')) $(this).removeClass('input_disable_persistent');
		// else good to
		else $(this).removeClass('disabled').datepicker('enable');
	});
}

// fzu, remove error highlighing from jquery $target input field
function fzu_inputErrorUnhighlight($target) {
	if ($target.hasClass('input_error')) {
		// remove input field highlighting
		$target.removeClass('input_error').siblings('.input_text_counter').removeClass('input_text_counter_error');
		// remove label highlighting / help link
		$('label[for="' + $target.attr('id') + '"]').removeClass('input_label_error').siblings('a.input_error_help').remove();
		// if <select> remove its error style
		if ($('#' + $target.attr('rel')).length) $('#' + $target.attr('rel')).removeClass('input_select_decoy_error');
	}
}

// fzu, set a jquery $target input field to error with error_msg
function fzu_inputErrorHighlight($target, error_msg) {
	// add input field highlighting
	$target.addClass('input_error').siblings('.input_text_counter').addClass('input_text_counter_error');
	// add label highlighting
	var $label = $('label[for="' + $target.attr('id') + '"]');
	$label.addClass('input_label_error');
	// if no help link already
	if (!$label.siblings('a.input_error_help').length) {
		// add the help link
		$label.after(' <a href="javascript: void(0)" title="' + error_msg + '" class="sup input_error_help tip_title">Help</a>');
		// and bind it to a tip
		fzu_tipBind($label.parent().eq(0));
	}
}

// fzu, bind input hints, creates p.input_hint w/ corresponding <label> title attribute after the <label> and enables the a.input_hint_toggle link to show/hide the p.input_hints
function fzu_inputHintsBind(context) {
	// write hints underneath each label (requires <br /> tag after label)
	$('form .input_label[title]', context).each(function(index) { $(this).siblings('br').eq(0).after('<p class="input_hint">' + $(this).attr('title') + '</p>'); });
	// show .input_hint_toggle and bind it to toggle that form's hints
	$('form .input_hints_toggle', context).css('display', 'inline').click(function() { fzu_inputHintsToggle($(this).closest('form')); });
}

// fzu, input hints, toggle (slide down/up .input_hint's)
function fzu_inputHintsToggle($target) {
	// if the hints are shown, hide them
	if ($target.hasClass('input_hints_shown')) $target.removeClass('input_hints_shown').find('.input_hint').slideUp(200);
	// else show hints underneath each label
	else $target.addClass('input_hints_shown').find('.input_hint').slideDown(200);
}

// fzu, max length, bind
function fzu_inputMaxLengthBind(context) {
	// ie < 7 gets no nicities
	if ($.browser.msie && $.browser.version < 7) return;
	// apply to .input_text_maxlength, .input_text_maxlines, .input_text_maxphrases
	$('.input_text_maxlength, .input_text_maxlines, .input_text_maxphrases', context).each(function(index) {
		// add counter HTML
		$(this).after('<span id="' + $(this).attr('id') + '_counter" class="input_text_counter"></span>');
		// bind on key up
		$(this).keyup(function() { fzu_inputMaxLengthUpdate($(this)); });
		// and do initial update (2nd field sets the initial width for the input/counter combo)
		fzu_inputMaxLengthUpdate($(this), $(this).width() - 1, true);
	});
}

// fzu, max length, update
function fzu_inputMaxLengthUpdate($target, initial_width, initialize) {
	// calculate width of the input/counter combo, if initial width was passed, use it for the total width
	if (initial_width) var total_width = initial_width;
	// else get the current width of the combo
	else total_width = $target.width() + $('#' + $target.attr('id') + '_counter').outerWidth();
	// if max length
	if ($target.hasClass('input_text_maxlength')) {
		// total number of characters
		var numerator = $target.attr('value').length;
		// number of allowed characters
		var denomerator = $target.attr('maxlength');
		// if textarea (has no built in maxlength)
		if ($target.get(0).tagName.toLowerCase() == 'textarea') {
			// if over limit
			if (numerator > denomerator) fzu_inputErrorHighlight($target, 'You are limited to ' + denomerator + ' characters.');
			// else un highlight (unless we are init'ing)
			else if (!initialize) fzu_inputErrorUnhighlight($target);
		}
	}
	// else if max lines
	else if ($target.hasClass('input_text_maxlines')) {
		// total number of lines
		var lines = $target.attr('value').split("\n");
		// only count lines that are not empty
		var numerator = 0;
		for (var i=0; i < lines.length; i++) { if ($.trim(lines[i]).length) numerator++; };
		// denomerator, hijacks the accept attribute
		var denomerator = $target.attr('accept');
		// if over the limit, add error class
		if (numerator > denomerator) fzu_inputErrorHighlight($target, 'You are limited to ' + denomerator + ' lines.');
		// else un highlight (unless we are init'ing)
		else if (!initialize) fzu_inputErrorUnhighlight($target);
	}
	// else if max phrases
	else if ($target.hasClass('input_text_maxphrases')) {
		// total number of comma separated phrases
		var phrases = $target.attr('value').split(',');
		// count number of phrases that are not empty
		var numerator = 0;
		for (var i=0; i < phrases.length; i++) { if ($.trim(phrases[i]).length) numerator++; };
		// denomerator, hijacks the accept attribute
		var denomerator = $target.attr('accept');
		// if over the limit, add error class
		if (numerator > denomerator) fzu_inputErrorHighlight($target, 'You are limited to 10 ' + $('label[for="' + $target.attr('id') + '"]').text());
		// else un highlight (unless we are init'ing)
		else if (!initialize) fzu_inputErrorUnhighlight($target);
	}
	// update counter HTML
	$('#' + $target.attr('id') + '_counter').html('<span class="fraction_num">' + numerator + '</span><span class="fraction_div">&#8260;</span><span class="fraction_den">' + denomerator + '</span>');
	// adjust sizing (keep the input/counter combo the same width as the original input)
	$target.css('width', (total_width - $('#' + $target.attr('id') + '_counter').outerWidth()) + 'px');
}

// update custom-skinned <input type="radio" class="input_radio"> on global mouse up (to avoid click on decoy and release outside)
function fzu_inputRadioMouseUp(context) {
	// remove focus style on all decoys
	$('input[type="radio"].input_radio', context).each(function() {
		$('#' + $(this).attr('rel')).removeClass('input_radio_decoy_focus input_radio_decoy_checked_focus');
	});
}

// update custom-skinned <input type="radio" class="input_radio">
function fzu_inputRadioUpdate($target) {
	// update the decoy <span> style based to match the <input>
	$target.each(function(index) { $(this).attr('checked') ? $('#' + $(this).attr('rel')).addClass('input_radio_decoy_checked') : $('#' + $(this).attr('rel')).removeClass('input_radio_decoy_checked'); });
}

// bind <input type="radio" class="input_radio">'s to custom skinning (hides actual <input>, uses decoy <span>, kudos to ryanfait.com)
function fzu_inputRadioBind(context) {
	// create decoys and bind logic
	$('input[type="radio"].input_radio', context).each(function() {
		// do we need to add HTMl, style and bind, or just update the style
		var style_only = $('#' + $(this).attr('rel')).length ? true : false;
		// if the decoy hasn't been created yet
		if (!style_only) {
			// store the id of the decoy style to the <input> rel attribute (yes I know technically this is illegal)
			$(this).attr('rel', 'input_radio_decoy_' + $(this).attr('id'));
			// create the decoy <span> (viewable part of the skin) and add the decoy applied style to the <input>
			$(this).addClass('input_radio_decoy_applied').before('<span id="' + $(this).attr('rel') + '" class="input_radio_decoy"></span>');
		}
		// update <input> sizing
		$(this).css('width', $('#' + $(this).attr('rel')).outerWidth() + 'px');
		// initial radio update
		fzu_inputRadioUpdate($(this));
		// pass through disabled class
		if ($(this).attr('disabled')) $('#' + $(this).attr('rel')).addClass('disabled');
		// if we are only adding or updating the style, stop here and don't re-apply bindings
		if (style_only) return;
		// bindings
		$(this).mousedown(function() {
			// on <input> mouse down add appropriate focus class to decoy <span> (depending on whether or not its checked)
			$('#' + $(this).attr('rel')).addClass($(this).attr('checked') ? 'input_radio_decoy_checked_focus' : 'input_radio_decoy_focus');
		}).mouseup(function() {
			// on <input> mouse up remove focus classes from decoy <span>
			$('#' + $(this).attr('rel')).removeClass('input_radio_decoy_focus input_radio_decoy_checked_focus');
		}).click(function() {
			// on <input> click update decoy <span> checked class for all related radio buttons (set to click not change because IE doesn't update changed on radio's until its blurred)
			fzu_inputRadioUpdate($('input[type="radio"][name="' + $(this).attr('name') + '"].input_radio'));
		});
	});
	// global mouse up bind to avoid case when user clicks on decoy and releases outside
	$(document).bind('mouseup', function() { fzu_inputRadioMouseUp(); });
}

// fzu, update custom-skinned <select> decoy
function fzu_inputSelectUpdate($target) {
	// update decoy <span> text
	$('#' + $target.attr('rel')).text($target.children('option:selected').text());
}

// fzu, bind <select class="input_select"> boxes to custom skinning (hides actual select, uses decoy <span>, kudos to ryanfait.com)
function fzu_inputSelectsBind(context) {
	$('select.input_select', context).each(function() {
		// store the id of the decoy style to the <select> rel attribute (yes I know technically this is illegal)
		$(this).attr('rel', 'input_select_decoy_' + $(this).attr('id'));
		// do we need to add HTML, style and bind, or just update the style
		var style_only = $('#' + $(this).attr('rel')).length ? true : false;
		// if we need to create the decoy <span> (viewable part of the skin)
		if (!style_only) {
			// get the relative positon of the <select>
			var select_pos = $(this).position();
			// create and position the decoy <span> and add the decoy applied style to the <select>
			// $(this).addClass('input_select_decoy_applied').before('<span id="' + $(this).attr('rel') + '" class="input_select_decoy" style="left: ' + select_pos.left + 'px; top: ' + select_pos.top + 'px;">' + $(this).children('option:selected').text() + '</span>');
			$(this).addClass('input_select_decoy_applied').before('<span id="' + $(this).attr('rel') + '" class="input_select_decoy" style="left: ' + select_pos.left + 'px; bottom: -' + (select_pos.top - 24) + 'px;">' + $(this).children('option:selected').text() + '</span>');
			
		}
		// if the input has errors (.input_error) give the decoy an error class too
		if ($(this).hasClass('input_error')) $('#' + $(this).attr('rel')).addClass('input_select_decoy_error');
		// if no icon style
		if ($(this).hasClass('input_select_no_icon')) $('#' + $(this).attr('rel')).addClass('input_select_decoy_no_icon');
		// expand the hidden <select> to the decoy <span> size (use height for normal browsers)
		$(this).css('height', $('#' + $(this).attr('rel')).outerHeight() + 'px').css('width', $('#' + $(this).attr('rel')).outerWidth() + 'px');
		// if we are only adding or updating the style, stop here and don't re-apply bindings
		if (style_only) return;
		// <select> bindings
		$(this).change(function() {
			// on <select> change update the decoy <span> text
			fzu_inputSelectUpdate($(this));
		}).keyup(function() {
			// on <select> key up update the decoy <span> text
			fzu_inputSelectUpdate($(this));
		}).focus(function(){
			// on <select> focus add decoy <span> focus class
			$('#' + $(this).attr('rel')).addClass('input_select_decoy_focus');
		}).blur(function() {
			// on <select> blur remove decoy <span> focus class
			$('#' + $(this).attr('rel')).removeClass('input_select_decoy_focus');
		});
	});
}

// fzu, apply modal window bindings
function fzu_modalBind(context) {
	// modal links
	$('a.modal').click(function() { fzu_modalShow($(this).attr('href'), false); return false; });
	$('a.modal_mini').click(function() { fzu_modalShow($(this).attr('href'), true); return false; });
	$('a.modal_zoom').click(function() { fzu_modalZoom($(this).attr('href')); return false; });
	// modal input buttons
	$('input[type="button"].modal').click(function() { fzu_modalShow($(this).closest('form').attr('action'), false); });
	$('input[type="button"].modal_mini').click(function() { fzu_modalShow($(this).closest('form').attr('action'), true); });
}

// fzu, hide the modal window
function fzu_modalClose() {
	// container animation time
	var animation_speed = $.browser.msie ? 0 : 200;
	// fade out the container, then remove markup and screen dimmer
	$('#modal').fadeOut(animation_speed, function() {
		// remove modal HTML
		$(this).remove(); 
		// un-dim screen and re-show flash
		$.fzu_dimScreenStop(function() { $('object[type="application/x-shockwave-flash"]').css('visibility', 'visible'); });
	});
}

// fzu, show a modal window
function fzu_modalShow(modal_url, modal_mini) {
	// append arbitrary time variable to the modal URL to force no-cacheing
	var now = new Date();
	modal_url += (modal_url.indexOf('?') > -1 ? '&amp;' : '?') + 'stop_cache=' + now.getTime();
	// cya, remove any previous model markup
	$('#modal').remove();
	// write in the modal container <div id="fzu_modal"> (this is written in seperately since we need its size before writing in the iframe)
	$('body').append('<div id="modal" class="' + (modal_mini ? 'modal_mini_container' : 'modal_container') + '"></div>');
	// write in the close button <a id="fzu_modal_close"> and the modal iframe <iframe id="fzu_modal_iframe">
	$('#modal').append('<a id="modal_close" href="javascript: void(0)" onclick="javascript: fzu_modalClose(); return false;" class="ir">Close</a><iframe width="' + $('#modal').width() + '" height="' + $('#modal').height() + '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" name="modal_iframe" id="modal_iframe" src="' + modal_url + '"></iframe>');
	// position the container and prep for fade in (turn display off and visibility on)
	$('#modal').css({
		display: 'none'
		,left: ( ($(window).width() / 2 - $('#modal').outerWidth() / 2) + $(window).scrollLeft() )+'px'
		,top: ( ($(window).height() / 2 - $('#modal').outerHeight() / 2) + $(window).scrollTop() )+'px'
		,visibility: 'visible'
	});
	// hide flash
	$('object[type="application/x-shockwave-flash"]').css('visibility', 'hidden');
	// dim screen, then show modal window
	$.fzu_dimScreen(200, 0.6, function() {
		// only safari handles the fading gracefully
		if (!$.browser.safari) $('#modal').css('display', 'block');
		// everybody else gets the niceties
		else $('#modal').fadeIn(200);
		// and focus on the modal iframe
		$('#modal_iframe').focus();
	});
	// make screen dimmer clickable to hide modal window
	$('#dim_screen').click(function() { fzu_modalClose(); });
}

// fzu, show a modal zoom
function fzu_modalZoom(image_url) {
	// cya, remove any previous model markup
	$('#modal').remove();
	// hide flash
	$('object[type="application/x-shockwave-flash"]').css('visibility', 'hidden');
	// dim screen, then show modal zoom window
	$.fzu_dimScreen(200, 0.6, function() {
		// insert modal container, (if previously sized modal zoom, use it)
		$('body').append('<div id="modal" class="modal_zoom_container"'+(typeof(fzu_modal_zoom_size) == 'undefined' ? '' : ' style="height: '+fzu_modal_zoom_size.height+'px; width: '+fzu_modal_zoom_size.width+'px;"')+'></div>');
		// write modal content
		var modal_html = '<a id="modal_close" href="javascript: void(0)" onclick="javascript: fzu_modalClose(); return false;" class="ir">Close</a>';
		modal_html += '<div class="image_container loading"></div>';
		// insert modal content
		$('#modal').append(modal_html).css({
			display: 'none'
			,left: ( ($(window).width() / 2 - $('#modal').outerWidth() / 2) + $(window).scrollLeft() )+'px'
			,top: ( ($(window).height() / 2 - $('#modal').outerHeight() / 2) + $(window).scrollTop() )+'px'
			,visibility: 'visible'
		});
		// fade in
		$.browser.safari ? $('#modal').fadeIn(200) : $('#modal').css('display', 'block');
		// image
		var image = new Image();
		// setup image load, then set src
		$(image).load(function() {
			// add into image zoom wrapper
			var $loaded_image = $('#modal .image_container').html('<img src="'+image_url+'" class="block" />').children('img').eq(0).css('opacity', 0);
			// store fzu_modal_zoom_size for re-calling of the function keeping sizing right
			fzu_modal_zoom_size = { height: $loaded_image.outerHeight(), width: $loaded_image.outerWidth() };
			// padding size
			var padding_width = parseInt($('#modal').css('padding-left'));
			// remove loading class, expand and reposition modal
			$('#modal').animate({
				height: fzu_modal_zoom_size.height+'px'
				,left: ( ($(window).width() / 2 - (fzu_modal_zoom_size.width + (padding_width * 2)) / 2) + $(window).scrollLeft() )+'px'
				,top: ( ($(window).height() / 2 - (fzu_modal_zoom_size.height + (padding_width * 2)) / 2) + $(window).scrollTop() )+'px'
				,width: fzu_modal_zoom_size.width+'px'
			}, 200, 'swing', function() {
				$loaded_image.animate({ opacity: 1 }, 500, 'swing');
			}).find('.loading').removeClass('loading');
		}).attr('src', image_url);
	});
	// make screen dimmer clickable to hide modal window
	$('#dim_screen').click(function() { fzu_modalClose(); });
}

// fzu, percentage bars
function fzu_percentageBars(context) {
	// now (used for creating ids)
	var now = new Date().getTime();
	// for each percentage
	$('dl.percentage', context).each(function(index) {
		// if already has percentage shown don't re-add it
		if ($(this).hasClass('percentage_bar_drawn')) return;
		// generate an id for the percentage bar
		var id = 'percentage_bar_' + now + '_' + index;
		// percentage
		var percent = parseInt($(this).find('dd').html());
		if (!percent) percent = 0;
		// else add the class and write in the percentage bar
		$(this).after('<div class="clear">&nbsp;</div><div id="' + id + '" class="percentage_bar"><div class="percentage_bar_bg"></div><div class="percentage_bar_fill' + (percent > 100 ? ' percentage_bar_bonus' : '') + '"></div></div>');
		// and animate the percentage bar
		$('#' + id + ' .percentage_bar_fill').animate({ width: (percent > 100 ? '100' : percent) + '%' }, 1000, 'swing');
	});
}

// fzu, apply png fix for ie < 7
function fzu_pngFix(context) {
	// if ie < 7
	if (jQuery.browser.msie && jQuery.browser.version < 7) {
		// png fixes
		DD_belatedPNG.fix('html *');
	}
}

// scrollimate!
function fzu_scrollimate(context) {
	// for each
	$('.scrollimate', context).each(function() {
		// add js applied styles
		$(this).addClass('scrollimate_js');
		// nav controls
		var $target = $(this);
		$(this).children('ul.nav').children('li').each(function(index) {
			$(this).children('a').click(function() { if ($(this).hasClass('animating')) return false; fzu_scrollimateShow($target, index); return false; });
		});
		// show first
		fzu_scrollimateShow($(this), 0);
	});
}

// scrollimate, show <li> index
function fzu_scrollimateShow($target, index) {
	// disable nav until animation is complete
	$target.find('ul.nav a').addClass('animating');
	// animate vars
	var scrollimate_pos   = $target.offset();
	var $nav_to_show      = $target.children('ul.nav').children('li').removeClass('selected').eq(index); $nav_to_show.addClass('selected');
	var nav_pos           = $nav_to_show.offset();
	var nav_bg_pos        = nav_pos.left - scrollimate_pos.left + ($nav_to_show.outerWidth() / 2) - 1000;
	var $section_shown    = $target.children('ul.content').children('li.selected').eq(0);
	var $section_to_show  = $target.children('ul.content').children('li').eq(index); $section_to_show.addClass('selected');
	var section_width     = $section_to_show.outerWidth();
	var section_height    = $section_to_show.outerHeight();
	var animate_direction = parseInt($target.children('ul.nav').css('background-position'), 10) > nav_bg_pos ? -1 : 1;
	var animate_time      = jQuery.browser.msie && jQuery.browser.version < 7 ? 0 : 500;
	// animate nav (1000 is half the bg image size)
	$target.children('ul.nav').animate({ backgroundPosition: nav_bg_pos + 'px 0' }, animate_time, 'swing');
	// animate container
	$target.children('ul.content').animate({ height: section_height + 'px' }, animate_time, 'swing');
	// animate old content out
	$section_shown.animate({ left: (animate_direction * section_width * -1) + 'px' }, animate_time, 'swing', function() { $(this).removeClass('selected'); });
	// animate new content in
	$section_to_show.css('left', (animate_direction * section_width) + 'px').animate({ left: '0px' }, animate_time, 'swing', function() { $target.find('ul.nav a').removeClass('animating'); });
}

// fzu, bind show all/show top table rows
function fzu_showAllTopBind(context) {
	// bind to tables with .show_all_top class
	$('table.show_all_top', context).each(function(index) {
		// if the table has a tfoot already lose it
		$(this).children('tfoot').remove();
		// if the table doesn't have an id, generate it
		if (!$(this).attr('id')) $(this).attr('id', new Date().getTime() + 'i');
		// calculate number of columns in table
		var column_count = 0;
		$(this).children('thead').children('tr').eq(0).children('th').each(function() { column_count += $(this).attr('colspan') ? $(this).attr('colspan') : 1; });
		// if more than five results
		if ($(this).find('tbody tr').length > 5) {
			// write show all and show top links into tfoot
			$(this).children('thead').after('<tfoot><tr><td colspan="' + column_count + '"><a href="javascript: void(0)" onclick="fzu_showAll($(\'#' + $(this).attr('id') + '\'));" class="show_all">Show All</a><a href="javascript: void(0)" onclick="fzu_showTop($(\'#' + $(this).attr('id') + '\'));" class="show_top hide">Show Top</a></td></tr></tfoot>');
			// and start by showing top
			fzu_showTop($(this), false);
		}
	});
}

// fzu, show all table rows
function fzu_showAll($target, animate) {
	// animate by default
	if (animate == undefined) animate = true;
	// hide 'Show All' link, show 'Show Top' link
	$target.find('.show_all').addClass('hide');
	$target.find('.show_top').removeClass('hide');
	// if animate, fade in all non-visible rows
	if (animate) $target.find('tr.hide').removeClass('hide').fadeOut(0, function() { $(this).fadeIn(200) });
	// else just show em
	else $target.find('tr.hide').removeClass('hide');
}

// fzu, show top table rows
function fzu_showTop($target, animate) {
	// animate by default
	if (animate == undefined) animate = true;
	// show 'Show All' link, hide 'Show Top' link
	$target.find('.show_all').removeClass('hide');
	$target.find('.show_top').addClass('hide');
	// if animate, fade out all non 'top' rows
	if (animate) $target.find('tr').each(function(index) { if (index > 6) $(this).fadeOut(200, function() { $(this).addClass('hide'); }); });
	// else just hide em
	else $target.find('tr').each(function(index) { if (index > 6) $(this).addClass('hide'); });
}

// fzu tips, bind
function fzu_tipBind(context) {
	// current time (used for creating id's)
	var now = new Date().getTime();
	// title tips (creates a tip with the element's title, and shows it onclick)
	$('.tip_title', context).each(function(index) {
		// create id for the tip
		var tip_id = 'tip_' + now + '_' + index;
		// set up tip trigger 
		$(this).attr('id', tip_id + '_trigger').removeClass('tip_title').addClass('tip_trigger');
		// write tip content
		$(document.body).append('<div id="' + tip_id + '" class="tip"><p>' + $(this).attr('title') + '</p></div>');
		// and remove hover title
		$(this).removeAttr('title');
	})
	// basic tip triggers (show tip on click)
	$('.tip_trigger', context).click(function() { fzu_tipShow($(this).attr('id').replace(/_trigger/, '')); return false; });
	// input text tip triggers (show tip on focus, optionally hide tip on blur)
	$('.tip_focus_trigger', context).each(function() {
		// show on focus
		$(this).focus(function() { fzu_tipShow($(this).attr('id').replace(/_trigger/, '')); });
		// if 'auto_hide' class, hide on blur
		if ($(this).hasClass('auto_hide')) $(this).blur(function() { fzu_tipHide($(this).attr('id').replace(/_trigger/, '')); });
	});
	// hover text tip triggers (shown after delay on hover, optionally hide on mouse out)
	$('.tip_hover_trigger', context).each(function() {
		// default config
		var config = { interval: 300, out: function() {}, over: function() { fzu_tipShow($(this).attr('id').replace(/_trigger/, '')); } };
		// if has 'auto_hide' class, hide the popup on mouse out
		if ($(this).hasClass('auto_hide')) config.out = function() { fzu_tipHide($(this).attr('id').replace(/_trigger/, '')); };
		// and set it up!
		$(this).hoverIntent(config);
	});
}

// fzu tip, hide
function fzu_tipHide(tip_id) {
	// the tip
	var $tip = $('#' + tip_id);
	// if the tip isn't shown, do nothing
	if (!$tip.hasClass('tip_shown')) return;
	// get the tip's offset
	var tip_offset = $tip.offset();
	// fade out the tip
	$tip.animate({ opacity: 0, top: tip_offset.top - 10 }, 200, 'swing', function() { $(this).css('visibility', 'hidden').removeClass('tip_shown'); });
}

// fzu tip, show
function fzu_tipShow(tip_id) {
	// the tip
	var $tip = $('#' + tip_id);
	// the trigger
	var $trigger = $('#' + tip_id + '_trigger');
	// if no tip and trigger, something wrong, gotta bail
	if (!$tip.length && $trigger.length) return;
	// if the tip is already shown, gotta bail
	if ($tip.hasClass('tip_shown')) return;
	// if the trigger has the 'hide_all' class, close all the other open tips
	if ($trigger.hasClass('hide_all')) $('.tip_shown:not([id="' + tip_id + '"])').each(function() { fzu_tipHide($(this).attr('id')); });
	// if the tip hasn't been shown yet, 
	if (!$tip.hasClass('tip_applied')) {
		// store the original content
		var tip_content = $tip.html();
		// write in the header, footer and wrap the content
		$tip.html('<div class="tip_header"><a href="javascript: void(0)" onclick="fzu_tipHide(\'' + $tip.attr('id') + '\')" class="ir">Close</a></div><div class="tip_content">' + tip_content + '</div><div class="tip_footer"></div>').addClass('tip_applied');
	}
	// if tip has on close binding
	if ($('#' + $tip.attr('id') + '_on_close')) $tip.find('.tip_header .ir').click(function() { eval($('#' + $tip.attr('id') + '_on_close').attr('value')); });
	// get the trigger's offset (for calculating the tip's position)
	var trigger_offset = $trigger.offset();
	// calculated vars used more than once for calculating the tip's position
	var tip_width = $tip.outerWidth();
	var trigger_width = $trigger.outerWidth();
	var window_width = $(window).width();
	// calculate the tip's position
	var tip_top = trigger_offset.top - $tip.outerHeight() - 1;
	var tip_left = trigger_offset.left; // use this for default tip position
	if ($tip.hasClass('tip_left')) tip_left = trigger_offset.left + trigger_width - 25;
	else if ($tip.hasClass('tip_right')) tip_left = trigger_offset.left - tip_width + 25;
	else if ($tip.hasClass('tip_center')) tip_left = trigger_offset.left - (tip_width / 2 - trigger_width / 2);
	// and adjust the tip_left if itss going off screen (either left or right)
	while (tip_left < 0) tip_left++;
	// and adjust the tip_top if it's going off screen
	while (tip_top < 0) tip_top++;
	// (only adjust rightwards in if the resolution is greater than the width of the tip, which is highly unlikely)
	if (window_width > tip_width) { while (tip_left + tip_width > window_width) tip_left--; }
	// show the tip
	$tip.css({ left: tip_left + 'px', opacity: 0, top: (tip_top + 10) + 'px', visibility: 'visible' }).animate({ opacity: 1, top: tip_top + 'px' }, 200, 'swing', function() { $(this).addClass('tip_shown'); });
}

// fzu, jquery extension: jquery.color.js
// jQuery Color Animations. Copyright 2007 John Resig. Released under the MIT and GPL licenses.
(function(jQuery){jQuery.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){jQuery.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);}
fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2]),255),0)].join(",")+")";}});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)
return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
return[parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];return colors[jQuery.trim(color).toLowerCase()];}
function getColor(elem,attr){var color;do{color=jQuery.curCSS(elem,attr);if(color!=''&&color!='transparent'||jQuery.nodeName(elem,"body"))
break;attr="backgroundColor";}while(elem=elem.parentNode);return getRGB(color);};var colors={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]};})(jQuery);

// fzu, jquery extension: jquery.dimensions.js
// Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);

// fzu, jquery extension, dim the screen
// based on jQuery dimScreen by Brandon Goldman, modified for frogzog
jQuery.extend({fzu_dimScreen:function(speed,opacity,callback){if(jQuery('#dim_screen').size()>0)return;if(typeof speed=='function'){callback=speed;speed=null;}
if(typeof opacity=='function'){callback=opacity;opacity=null;}
if(speed<1){var placeholder=opacity;opacity=speed;speed=placeholder;}
if(opacity>=1){var placeholder=speed;speed=opacity;opacity=placeholder;}
speed=(speed>0)?speed:500;opacity=(opacity>0)?opacity:0.5;var top_pos = (jQuery.browser.msie && jQuery.browser.version < 7) ? jQuery(document).scrollTop() + 'px' : '0px'; return jQuery('<div></div>').attr({id:'dim_screen',fade_opacity:opacity,speed:speed}).css({height:$(window).height()+'px',opacity:0,overflow:'hidden',top:top_pos,width:$(window).width()+'px'}).appendTo(document.body).fadeTo(speed,0.7,callback);},fzu_dimScreenStop:function(callback){var x=jQuery('#dim_screen');var opacity=x.attr('fade_opacity');var speed=x.attr('speed');x.fadeOut(speed,function(){x.remove();if(typeof callback=='function')callback();});}});

// fzu, jquery extension, hoverIntent
/* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+ // <http://cherne.net/brian/resources/jquery.hoverIntent.html> */
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

/* * jQuery UI 1.7.2. Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about). Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. http://docs.jquery.com/UI */
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,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}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=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)}else{j=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"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;
/* jQuery UI Datepicker 1.7.2. Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about). Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.  http://docs.jquery.com/UI/Datepicker. Depends: ui.core.js */
(function($){$.extend($.ui,{datepicker:{version:"1.7.2"}});var PROP_NAME="datepicker";function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],dateFormat:"mm/dd/yy",firstDay:0,isRTL:false};this._defaults={showOn:"focus",showAnim:"show",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,showMonthAfterYear:false,yearRange:"-10:+10",showOtherMonths:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"normal",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false};$.extend(this._defaults,this.regional[""]);this.dpDiv=$('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>')}$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",log:function(){if(this.debug){console.log.apply("",arguments)}},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");if(!target.id){target.id="dp"+(++this.uuid)}var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{});if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},_newInst:function(target,inline){var id=target[0].id.replace(/([:\[\]\.])/g,"\\\\$1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:$('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(target,inst){var input=$(target);inst.append=$([]);inst.trigger=$([]);if(input.hasClass(this.markerClassName)){return}var appendText=this._get(inst,"appendText");var isRTL=this._get(inst,"isRTL");if(appendText){inst.append=$('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=$(this._get(inst,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):$('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:$("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if($.datepicker._datepickerShowing&&$.datepicker._lastInput==target){$.datepicker._hideDatepicker()}else{$.datepicker._showDatepicker(target)}return false})}input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst)},_inlineDatepicker:function(target,inst){var divSpan=$(target);if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});$.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst));this._updateDatepicker(inst);this._updateAlternate(inst)},_dialogDatepicker:function(input,dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){var id="dp"+(++this.uuid);this._dialogInput=$('<input type="text" id="'+id+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};$.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});this._dialogInput.val(dateText);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var browserHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}this._dialogInput.css("left",this._pos[0]+"px").css("top",this._pos[1]+"px");inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);if($.blockUI){$.blockUI(this.dpDiv)}$.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();$.removeData(target,PROP_NAME);if(nodeName=="input"){inst.append.remove();inst.trigger.remove();$target.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress)}else{if(nodeName=="div"||nodeName=="span"){$target.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var $target=$(target);var inst=$.data(target,PROP_NAME);if(!$target.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=$target.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled")}}this._disabledInputs=$.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return $.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?$.extend({},$.datepicker._defaults):(inst?(name=="all"?$.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker(null)}var date=this._getDateDatepicker(target);extendRemove(inst.settings,settings);this._setDateDatepicker(target,date);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date,endDate){var inst=this._getInst(target);if(inst){this._setDate(inst,date,endDate);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=$.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if($.datepicker._datepickerShowing){switch(event.keyCode){case 9:$.datepicker._hideDatepicker(null,"");break;case 13:var sel=$("td."+$.datepicker._dayOverClass+", td."+$.datepicker._currentClass,inst.dpDiv);if(sel[0]){$.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"))}return false;break;case 27:$.datepicker._hideDatepicker(null,$.datepicker._get(inst,"duration"));break;case 33:$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M");break;case 34:$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){$.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){$.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?-$.datepicker._get(inst,"stepBigMonths"):-$.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){$.datepicker._adjustDate(event.target,(event.ctrlKey?+$.datepicker._get(inst,"stepBigMonths"):+$.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){$.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){$.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=$.datepicker._getInst(event.target);if($.datepicker._get(inst,"constrainInput")){var chars=$.datepicker._possibleChars($.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_showDatepicker:function(input){input=input.target||input;if(input.nodeName.toLowerCase()!="input"){input=$("input",input.parentNode)[0]}if($.datepicker._isDisabledDatepicker(input)||$.datepicker._lastInput==input){return}var inst=$.datepicker._getInst(input);var beforeShow=$.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));$.datepicker._hideDatepicker(null,"");$.datepicker._lastInput=input;$.datepicker._setDateFromField(inst);if($.datepicker._inDialog){input.value=""}if(!$.datepicker._pos){$.datepicker._pos=$.datepicker._findPos(input);$.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;$(input).parents().each(function(){isFixed|=$(this).css("position")=="fixed";return !isFixed});if(isFixed&&$.browser.opera){$.datepicker._pos[0]-=document.documentElement.scrollLeft;$.datepicker._pos[1]-=document.documentElement.scrollTop}var offset={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null;inst.rangeStart=null;inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});$.datepicker._updateDatepicker(inst);offset=$.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:($.datepicker._inDialog&&$.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});if(!inst.inline){var showAnim=$.datepicker._get(inst,"showAnim")||"show";var duration=$.datepicker._get(inst,"duration");var postProcess=function(){$.datepicker._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){$("iframe.ui-datepicker-cover").css({width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4})}};if($.effects&&$.effects[showAnim]){inst.dpDiv.show(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[showAnim](duration,postProcess)}if(duration==""){postProcess()}if(inst.input[0].type!="hidden"){inst.input[0].focus()}$.datepicker._curInst=inst}},_updateDatepicker:function(inst){var dims={width:inst.dpDiv.width()+4,height:inst.dpDiv.height()+4};var self=this;inst.dpDiv.empty().append(this._generateHTML(inst)).find("iframe.ui-datepicker-cover").css({width:dims.width,height:dims.height}).end().find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){$(this).removeClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).removeClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).removeClass("ui-datepicker-next-hover")}}).bind("mouseover",function(){if(!self._isDisabledDatepicker(inst.inline?inst.dpDiv.parent()[0]:inst.input[0])){$(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");$(this).addClass("ui-state-hover");if(this.className.indexOf("ui-datepicker-prev")!=-1){$(this).addClass("ui-datepicker-prev-hover")}if(this.className.indexOf("ui-datepicker-next")!=-1){$(this).addClass("ui-datepicker-next-hover")}}}).end().find("."+this._dayOverClass+" a").trigger("mouseover").end();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}else{inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst.input&&inst.input[0].type!="hidden"&&inst==$.datepicker._curInst){$(inst.input[0]).focus()}},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=(window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth)+$(document).scrollLeft();var viewHeight=(window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight)+$(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?$(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?$(document).scrollTop():0;offset.left-=(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0;offset.top-=(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(offset.top+dpHeight+inputHeight*2-viewHeight):0;return offset},_findPos:function(obj){while(obj&&(obj.type=="hidden"||obj.nodeType!=1)){obj=obj.nextSibling}var position=$(obj).offset();return[position.left,position.top]},_hideDatepicker:function(input,duration){var inst=this._curInst;if(!inst||(input&&inst!=$.data(input,PROP_NAME))){return}if(inst.stayOpen){this._selectDate("#"+inst.id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))}inst.stayOpen=false;if(this._datepickerShowing){duration=(duration!=null?duration:this._get(inst,"duration"));var showAnim=this._get(inst,"showAnim");var postProcess=function(){$.datepicker._tidyDialog(inst)};if(duration!=""&&$.effects&&$.effects[showAnim]){inst.dpDiv.hide(showAnim,$.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(duration==""?"hide":(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide")))](duration,postProcess)}if(duration==""){this._tidyDialog(inst)}var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if($.blockUI){$.unblockUI();$("body").append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!$.datepicker._curInst){return}var $target=$(event.target);if(($target.parents("#"+$.datepicker._mainDivId).length==0)&&!$target.hasClass($.datepicker.markerClassName)&&!$target.hasClass($.datepicker._triggerClass)&&$.datepicker._datepickerShowing&&!($.datepicker._inDialog&&$.blockUI)){$.datepicker._hideDatepicker(null,"")}},_adjustDate:function(id,offset,period){var target=$(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=$(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{var date=new Date();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=$(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=$(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear&&!$.browser.msie){inst.input[0].focus()}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=$(id);if($(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=$("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;if(inst.stayOpen){inst.endDay=inst.endMonth=inst.endYear=null}this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear));if(inst.stayOpen){inst.rangeStart=this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay));this._updateDatepicker(inst)}},_clearDate:function(id){var target=$(id);var inst=this._getInst(target[0]);inst.stayOpen=false;inst.endDay=inst.endMonth=inst.endYear=inst.rangeStart=null;this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=$(id);var inst=this._getInst(target[0]);dateStr=(dateStr!=null?dateStr:this._formatDate(inst));if(inst.input){inst.input.val(dateStr)}this._updateAlternate(inst);var onSelect=this._get(inst,"onSelect");if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{if(!inst.stayOpen){this._hideDatepicker(null,this._get(inst,"duration"));this._lastInput=inst.input[0];if(typeof(inst.input[0])!="object"){inst.input[0].focus()}this._lastInput=null}}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");var date=this._getDate(inst);dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));$(altField).each(function(){$(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getFullYear(),date.getMonth(),date.getDate());var firstMon=new Date(checkDate.getFullYear(),1-1,4);var firstDay=firstMon.getDay()||7;firstMon.setDate(firstMon.getDate()+1-firstDay);if(firstDay<4&&checkDate<firstMon){checkDate.setDate(checkDate.getDate()-3);return $.datepicker.iso8601Week(checkDate)}else{if(checkDate>new Date(checkDate.getFullYear(),12-1,28)){firstDay=new Date(checkDate.getFullYear()+1,1-1,4).getDay()||7;if(firstDay>4&&(checkDate.getDay()||7)<firstDay-3){return 1}}}return Math.floor(((checkDate-firstMon)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){lookAhead(match);var origSize=(match=="@"?14:(match=="y"?4:(match=="o"?3:2)));var size=origSize;var num=0;while(size>0&&iValue<value.length&&value.charAt(iValue)>="0"&&value.charAt(iValue)<="9"){num=num*10+parseInt(value.charAt(iValue++),10);size--}if(size==origSize){throw"Missing number at position "+iValue}return num};var getName=function(match,shortNames,longNames){var names=(lookAhead(match)?longNames:shortNames);var size=0;for(var j=0;j<names.length;j++){size=Math.max(size,names[j].length)}var name="";var iInit=iValue;while(size>0&&iValue<value.length){name+=value.charAt(iValue++);for(var i=0;i<names.length;i++){if(name==names[i]){return i+1}}size--}throw"Unknown name at position "+iInit};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":var date=new Date(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(year==-1){year=new Date().getFullYear()}else{if(year<100){year+=new Date().getFullYear()-new Date().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}var date=this._daylightSavingAdjust(new Date(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TIMESTAMP:"@",W3C:"yy-mm-dd",formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":var doy=date.getDate();for(var m=date.getMonth()-1;m>=0;m--){doy+=this._getDaysInMonth(date.getFullYear(),m)}output+=formatNumber("o",doy,3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst){var dateFormat=this._get(inst,"dateFormat");var dates=inst.input?inst.input.val():null;inst.endDay=inst.endMonth=inst.endYear=null;var date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);date=defaultDate}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){var date=this._determineDate(this._get(inst,"defaultDate"),new Date());var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);return date},_determineDate:function(date,defaultDate){var offsetNumeric=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset,getDaysInMonth){var date=new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};date=(date==null?defaultDate:(typeof date=="string"?offsetString(date,this._getDaysInMonth):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):date)));date=(date&&date.toString()=="Invalid Date"?defaultDate:date);if(date){date.setHours(0);date.setMinutes(0);date.setSeconds(0);date.setMilliseconds(0)}return this._daylightSavingAdjust(date)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,endDate){var clear=!(date);var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;date=this._determineDate(date,new Date());inst.selectedDay=inst.currentDay=date.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=date.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=date.getFullYear();if(origMonth!=inst.selectedMonth||origYear!=inst.selectedYear){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new Date();today=this._daylightSavingAdjust(new Date(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var stepBigMonths=this._get(inst,"stepBigMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new Date(maxDate.getFullYear(),maxDate.getMonth()-numMonths[1]+1,maxDate.getDate()));maxDraw=(minDate&&maxDraw<minDate?minDate:maxDraw);while(this._daylightSavingAdjust(new Date(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new Date(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new Date(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery.datepicker._adjustDate(\'#'+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery.datepicker._gotoToday(\'#'+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var endDate=inst.endDay?this._daylightSavingAdjust(new Date(inst.endYear,inst.endMonth,inst.endDay)):currentDate;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group ui-datepicker-group-';switch(col){case 0:calender+="first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+="last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+="middle";cornerClass="";break}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead="";for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var printDate=this._daylightSavingAdjust(new Date(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody="";for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":" onclick=\"DP_jQuery.datepicker._selectDay('#"+inst.id+"',"+drawMonth+","+drawYear+', this);return false;"')+">"+(otherMonth?(showOtherMonths?printDate.getDate():"&#xa0;"):(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?" ui-state-active":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+($.browser.msie&&parseInt($.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,selectedDate,secondary,monthNames,monthNamesShort){minDate=(inst.rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span> "}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'M');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+((secondary||changeMonth||changeYear)&&(!(changeMonth&&changeYear))?"&#xa0;":"")}if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10}else{if(years[0].charAt(0)=="+"||years[0].charAt(0)=="-"){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10)}else{year=parseInt(years[0],10);endYear=parseInt(years[1],10)}}year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="ui-datepicker-year" onchange="DP_jQuery.datepicker._selectMonthYear(\'#'+inst.id+"', this, 'Y');\" onclick=\"DP_jQuery.datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){html+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}html+="</select>"}if(showMonthAfterYear){html+=(secondary||changeMonth||changeYear?"&#xa0;":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);var date=this._daylightSavingAdjust(new Date(year,month,day));var minDate=this._getMinMaxDate(inst,"min",true);var maxDate=this._getMinMaxDate(inst,"max");date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax,checkRange){var date=this._determineDate(this._get(inst,minMax+"Date"),null);return(!checkRange||!inst.rangeStart?date:(!date||inst.rangeStart>date?inst.rangeStart:date))},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate()},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);var date=this._daylightSavingAdjust(new Date(curYear,curMonth+(offset<0?offset:numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var newMinDate=(!inst.rangeStart?null:this._daylightSavingAdjust(new Date(inst.selectedYear,inst.selectedMonth,inst.selectedDay)));newMinDate=(newMinDate&&inst.rangeStart<newMinDate?inst.rangeStart:newMinDate);var minDate=newMinDate||this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new Date(year,month,day))):this._daylightSavingAdjust(new Date(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))}});function extendRemove(target,props){$.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&(($.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}$.fn.datepicker=function(options){if(!$.datepicker.initialized){$(document).mousedown($.datepicker._checkExternalClick).find("body").append($.datepicker.dpDiv);$.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate")){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return $.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?$.datepicker["_"+options+"Datepicker"].apply($.datepicker,[this].concat(otherArgs)):$.datepicker._attachDatepicker(this,options)})};$.datepicker=new Datepicker();$.datepicker.initialized=false;$.datepicker.uuid=new Date().getTime();$.datepicker.version="1.7.2";window.DP_jQuery=$})(jQuery);;

// sIFR v2.0.7
// Copyright 2004 - 2008 Mark Wubben and Mike Davidson. Prior contributions by Shaun Inman and Tomas Jogin.
var hasFlash=function(){var a=6;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1){document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n</script\> \n');if(window.hasFlash!=null)return window.hasFlash}if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;return parseInt(b.substr(b.indexOf(".")-2,2),10)>=a}return false}();String.prototype.normalize=function(){return this.replace(/\s+/g," ")};if(Array.prototype.push==null){Array.prototype.push=function(){var i=0,a=this.length,b=arguments.length;while(i<b){this[a++]=arguments[i++]}return this.length}}if(!Function.prototype.apply){Function.prototype.apply=function(a,b){var c=[];var d,e;if(!a)a=window;if(!b)b=[];for(var i=0;i<b.length;i++){c[i]="b["+i+"]"}e="a.__applyTemp__("+c.join(",")+");";a.__applyTemp__=this;d=eval(e);a.__applyTemp__=null;return d}}function named(a){return new named.Arguments(a)}named.Arguments=function(a){this.oArgs=a};named.Arguments.prototype.constructor=named.Arguments;named.extract=function(a,b){var c,d;var i=a.length;while(i--){d=a[i];if(d!=null&&d.constructor!=null&&d.constructor==named.Arguments){c=a[i].oArgs;break}}if(c==null)return;for(e in c)if(b[e]!=null)b[e](c[e]);return};var parseSelector=function(){var a=/^([^#.>`]*)(#|\.|\>|\`)(.+)$/;function r(s,t){var u=s.split(/\s*\,\s*/);var v=[];for(var i=0;i<u.length;i++)v=v.concat(b(u[i],t));return v}function b(c,d,e){c=c.normalize().replace(" ","`");var f=c.match(a);var g,h,i,j,k,n;var l=[];if(f==null)f=[c,c];if(f[1]=="")f[1]="*";if(e==null)e="`";if(d==null)d=document;switch(f[2]){case "#":k=f[3].match(a);if(k==null)k=[null,f[3]];g=document.getElementById(k[1]);if(g==null||(f[1]!="*"&&!o(g,f[1])))return l;if(k.length==2){l.push(g);return l}return b(k[3],g,k[2]);case ".":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;k=f[3].match(a);if(k!=null){if(g.className==null||g.className.match("(\\s|^)"+k[1]+"(\\s|$)")==null)continue;j=b(k[3],g,k[2]);l=l.concat(j)}else if(g.className!=null&&g.className.match("(\\s|^)"+f[3]+"(\\s|$)")!=null)l.push(g)}return l;case ">":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;j=b(f[3],g,">");l=l.concat(j)}return l;case "`":h=m(d,f[1]);for(i=0,n=h.length;i<n;i++){g=h[i];j=b(f[3],g,"`");l=l.concat(j)}return l;default:if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;l.push(g)}return l}}function m(d,o){if(o=="*"&&d.all!=null)return d.all;return d.getElementsByTagName(o)}function o(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}return r}();var sIFR=function(){var a="http://www.w3.org/1999/xhtml";var b=false;var c=false;var d;var ah=[];var al=document;var ak=al.documentElement;var am=window;var au=al.addEventListener;var av=am.addEventListener;var f=function(){var g=navigator.userAgent.toLowerCase();var f={a:g.indexOf("applewebkit")>-1,b:g.indexOf("safari")>-1,c:navigator.product!=null&&navigator.product.toLowerCase().indexOf("konqueror")>-1,d:g.indexOf("opera")>-1,e:al.contentType!=null&&al.contentType.indexOf("xml")>-1,f:true,g:true,h:null,i:null,j:null,k:null};f.l=f.a||f.c;f.m=!f.a&&navigator.product!=null&&navigator.product.toLowerCase()=="gecko";if(f.m&&g.match(/.*gecko\/(\d{8}).*/))f.j=new Number(g.match(/.*gecko\/(\d{8}).*/)[1]);f.n=g.indexOf("msie")>-1&&!f.d&&!f.l&&!f.m;f.o=f.n&&g.match(/.*mac.*/)!=null;if(f.d&&g.match(/.*opera(\s|\/)(\d+\.\d+)/))f.i=new Number(g.match(/.*opera(\s|\/)(\d+\.\d+)/)[2]);if(f.n||(f.d&&f.i<7.6))f.g=false;if(f.a&&g.match(/.*applewebkit\/(\d+).*/))f.k=new Number(g.match(/.*applewebkit\/(\d+).*/)[1]);if(am.hasFlash&&(!f.n||f.o)){var aj=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;f.h=parseInt(aj.substr(aj.indexOf(".")-2,2),10)}if(g.match(/.*(windows|mac).*/)==null||f.o||f.c||(f.d&&(g.match(/.*mac.*/)!=null||f.i<7.6))||(f.b&&f.h<7)||(!f.b&&f.a&&f.k<312)||(f.m&&f.j<20020523))f.f=false;if(!f.o&&!f.m&&al.createElementNS)try{al.createElementNS(a,"i").innerHTML=""}catch(e){f.e=true}f.p=f.c||(f.a&&f.k<312);return f}();function at(){return{bIsWebKit:f.a,bIsSafari:f.b,bIsKonq:f.c,bIsOpera:f.d,bIsXML:f.e,bHasTransparencySupport:f.f,bUseDOM:f.g,nFlashVersion:f.h,nOperaVersion:f.i,nGeckoBuildDate:f.j,nWebKitVersion:f.k,bIsKHTML:f.l,bIsGecko:f.m,bIsIE:f.n,bIsIEMac:f.o,bUseInnerHTMLHack:f.p}}if(am.hasFlash==false||!al.getElementsByTagName||!al.getElementById||(f.e&&(f.p||f.n)))return{UA:at()};function af(e){if((!k.bAutoInit&&(am.event||e)!=null)||!l(e))return;b=true;for(var i=0,h=ah.length;i<h;i++)j.apply(null,ah[i]);ah=[]}var k=af;function l(e){if(c==false||k.bIsDisabled==true||((f.e&&f.m||f.l)&&e==null&&b==false)||al.getElementsByTagName("body").length==0)return false;return true}function m(n){if(f.n)return n.replace(new RegExp("%\d{0}","g"),"%25");return n.replace(new RegExp("%(?!\d)","g"),"%25")}function as(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}function o(p,q,r,s,t){var u="";var v=p.firstChild;var w,x,y,z;if(s==null)s=0;if(t==null)t="";while(v){if(v.nodeType==3){z=v.nodeValue.replace("<","&lt;");switch(r){case "lower":u+=z.toLowerCase();break;case "upper":u+=z.toUpperCase();break;default:u+=z}}else if(v.nodeType==1){if(as(v,"a")&&!v.getAttribute("href")==false){if(v.getAttribute("target"))t+="&sifr_url_"+s+"_target="+v.getAttribute("target");t+="&sifr_url_"+s+"="+m(v.getAttribute("href")).replace(/&/g,"%26");u+='<a href="asfunction:_root.launchURL,'+s+'">';s++}else if(as(v,"br"))u+="<br/>";if(v.hasChildNodes()){y=o(v,null,r,s,t);u+=y.u;s=y.s;t=y.t}if(as(v,"a"))u+="</a>"}w=v;v=v.nextSibling;if(q!=null){x=w.parentNode.removeChild(w);q.appendChild(x)}}return{"u":u,"s":s,"t":t}}function A(B){if(al.createElementNS&&f.g)return al.createElementNS(a,B);return al.createElement(B)}function C(D,E,z){var p=A("param");p.setAttribute("name",E);p.setAttribute("value",z);D.appendChild(p)}function F(p,G){var H=p.className;if(H==null)H=G;else H=H.normalize()+(H==""?"":" ")+G;p.className=H}function aq(ar){var a=ak;if(k.bHideBrowserText==false)a=al.getElementsByTagName("body")[0];if((k.bHideBrowserText==false||ar)&&a)if(a.className==null||a.className.match(/\bsIFR\-hasFlash\b/)==null)F(a, "sIFR-hasFlash")}function j(I,J,K,L,M,N,O,P,Q,R,S,r,T){if(!l())return ah.push(arguments);aq();named.extract(arguments,{sSelector:function(ap){I=ap},sFlashSrc:function(ap){J=ap},sColor:function(ap){K=ap},sLinkColor:function(ap){L=ap},sHoverColor:function(ap){M=ap},sBgColor:function(ap){N=ap},nPaddingTop:function(ap){O=ap},nPaddingRight:function(ap){P=ap},nPaddingBottom:function(ap){Q=ap},nPaddingLeft:function(ap){R=ap},sFlashVars:function(ap){S=ap},sCase:function(ap){r=ap},sWmode:function(ap){T=ap}});var U=parseSelector(I);if(U.length==0)return false;if(S!=null)S="&"+S.normalize();else S="";if(K!=null)S+="&textcolor="+K;if(M!=null)S+="&hovercolor="+M;if(M!=null||L!=null)S+="&linkcolor="+(L||K);if(O==null)O=0;if(P==null)P=0;if(Q==null)Q=0;if(R==null)R=0;if(N==null)N="#FFFFFF";if(T=="transparent")if(!f.f)T="opaque";else N="transparent";if(T==null)T="";var p,V,W,X,Y,Z,aa,ab,ac;var ad=null;for(var i=0,h=U.length;i<h;i++){p=U[i];if(p.className!=null&&p.className.match(/\bsIFR\-replaced\b/)!=null)continue;V=p.offsetWidth-R-P;W=p.offsetHeight-O-Q;aa=A("span");aa.className="sIFR-alternate";ac=o(p,aa,r);Z="txt="+m(ac.u).replace(/\+/g,"%2B").replace(/&/g,"%26").replace(/\"/g, "%22").normalize() + S + "&w=" + V + "&h=" + W + ac.t;F(p,"sIFR-replaced");if(ad==null||!f.g){if(!f.g){if(!f.n)p.innerHTML=['<embed class="sIFR-flash" type="application/x-shockwave-flash" src="',J,'" quality="best" wmode="',T,'" bgcolor="',N,'" flashvars="',Z,'" width="',V,'" height="',W,'" sifr="true"></embed>'].join("");else p.innerHTML=['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" sifr="true" width="',V,'" height="',W,'" class="sIFR-flash"><param name="movie" value="',J,'"></param><param name="flashvars" value="',Z,'"></param><param name="quality" value="best"></param><param name="wmode" value="',T,'"></param><param name="bgcolor" value="',N,'"></param> </object>'].join('')}else{if(f.d){ab=A("object");ab.setAttribute("data",J);C(ab,"quality","best");C(ab,"wmode",T);C(ab,"bgcolor",N)}else{ab=A("embed");ab.setAttribute("src",J);ab.setAttribute("quality","best");ab.setAttribute("flashvars",Z);ab.setAttribute("wmode",T);ab.setAttribute("bgcolor",N)}ab.setAttribute("sifr","true");ab.setAttribute("type","application/x-shockwave-flash");ab.className="sIFR-flash";if(!f.l||!f.e)ad=ab.cloneNode(true)}}else ab=ad.cloneNode(true);if(f.g){if(f.d)C(ab,"flashvars",Z);else ab.setAttribute("flashvars",Z);ab.setAttribute("width",V);ab.setAttribute("height",W);ab.style.width=V+"px";ab.style.height=W+"px";p.appendChild(ab)}p.appendChild(aa);if(f.p)p.innerHTML+=""}if(f.n&&k.bFixFragIdBug)setTimeout(function(){al.title=d},0)}function ai(){d=al.title}function ae(){if(k.bIsDisabled==true)return;c=true;if(k.bHideBrowserText)aq(true);if(am.attachEvent)am.attachEvent("onload",af);else if(!f.c&&(al.addEventListener||am.addEventListener)){if(f.a&&f.k>=132&&am.addEventListener)am.addEventListener("load",function(){setTimeout("sIFR({})",1)},false);else{if(al.addEventListener)al.addEventListener("load",af,false);if(am.addEventListener)am.addEventListener("load",af,false)}}else if(typeof am.onload=="function"){var ag=am.onload;am.onload=function(){ag();af()}}else am.onload=af;if(!f.n||am.location.hash=="")k.bFixFragIdBug=false;else ai()}k.UA=at();k.bAutoInit=true;k.bFixFragIdBug=true;k.replaceElement=j;k.updateDocumentTitle=ai;k.appendToClassName=F;k.setup=ae;k.debug=function(){aq(true)};k.debug.replaceNow=function(){ae();k()};k.bIsDisabled=false;k.bHideBrowserText=true;return k}();

if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac && (!sIFR.UA.bIsWebKit || sIFR.UA.nWebKitVersion >= 100)){
	sIFR.setup();
};
