/* informedia combine engine v.1.1.11 
 * file:  
 * link: bottom.js 
 * hash: 1392201764-505a5b23e4131bc36c4fe485cfb8c903.js */




window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.documentElement,e=d.firstElementChild||d.firstChild,f=a.createElement("body"),g=a.createElement("div");return g.id="mq-test-1",g.style.cssText="position:absolute;top:-100em",f.style.background="none",f.appendChild(g),function(a){return g.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',d.insertBefore(f,e),c=42===g.offsetWidth,d.removeChild(f),{matches:c,media:a}}}(document);

(function(a){"use strict";function x(){u(!0)}var b={};if(a.respond=b,b.update=function(){},b.mediaQueriesSupported=a.matchMedia&&a.matchMedia("only all").matches,!b.mediaQueriesSupported){var q,r,t,c=a.document,d=c.documentElement,e=[],f=[],g=[],h={},i=30,j=c.getElementsByTagName("head")[0]||d,k=c.getElementsByTagName("base")[0],l=j.getElementsByTagName("link"),m=[],n=function(){for(var b=0;l.length>b;b++){var c=l[b],d=c.href,e=c.media,f=c.rel&&"stylesheet"===c.rel.toLowerCase();d&&f&&!h[d]&&(c.styleSheet&&c.styleSheet.rawCssText?(p(c.styleSheet.rawCssText,d,e),h[d]=!0):(!/^([a-zA-Z:]*\/\/)/.test(d)&&!k||d.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&m.push({href:d,media:e}))}o()},o=function(){if(m.length){var b=m.shift();v(b.href,function(c){p(c,b.href,b.media),h[b.href]=!0,a.setTimeout(function(){o()},0)})}},p=function(a,b,c){var d=a.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),g=d&&d.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+b+"$2$3")},i=!g&&c;b.length&&(b+="/"),i&&(g=1);for(var j=0;g>j;j++){var k,l,m,n;i?(k=c,f.push(h(a))):(k=d[j].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,f.push(RegExp.$2&&h(RegExp.$2))),m=k.split(","),n=m.length;for(var o=0;n>o;o++)l=m[o],e.push({media:l.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:f.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(/\(\s*min\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(/\(\s*max\-width\s*:\s*(\s*[0-9\.]+)(px|em)\s*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},s=function(){var a,b=c.createElement("div"),e=c.body,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",e||(e=f=c.createElement("body"),e.style.background="none"),e.appendChild(b),d.insertBefore(e,d.firstChild),a=b.offsetWidth,f?d.removeChild(e):e.removeChild(b),a=t=parseFloat(a)},u=function(b){var h="clientWidth",k=d[h],m="CSS1Compat"===c.compatMode&&k||c.body[h]||k,n={},o=l[l.length-1],p=(new Date).getTime();if(b&&q&&i>p-q)return a.clearTimeout(r),r=a.setTimeout(u,i),void 0;q=p;for(var v in e)if(e.hasOwnProperty(v)){var w=e[v],x=w.minw,y=w.maxw,z=null===x,A=null===y,B="em";x&&(x=parseFloat(x)*(x.indexOf(B)>-1?t||s():1)),y&&(y=parseFloat(y)*(y.indexOf(B)>-1?t||s():1)),w.hasquery&&(z&&A||!(z||m>=x)||!(A||y>=m))||(n[w.media]||(n[w.media]=[]),n[w.media].push(f[w.rules]))}for(var C in g)g.hasOwnProperty(C)&&g[C]&&g[C].parentNode===j&&j.removeChild(g[C]);for(var D in n)if(n.hasOwnProperty(D)){var E=c.createElement("style"),F=n[D].join("\n");E.type="text/css",E.media=D,j.insertBefore(E,o.nextSibling),E.styleSheet?E.styleSheet.cssText=F:E.appendChild(c.createTextNode(F)),g.push(E)}},v=function(a,b){var c=w();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},w=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}();n(),b.update=n,a.addEventListener?a.addEventListener("resize",x,!1):a.attachEvent&&a.attachEvent("onresize",x)}})(this);




function ValidForm(strFormId, strMainAlert) {
	this.id 					= strFormId;
	this.elements 				= {};
	this.pages 					= [];
	this.valid 					= false;
	this.validator 				= new ValidFormValidator(this.id);
	this.validator.mainAlert 	= strMainAlert;
	this.events 				= [];
	this.cachedEvents 			= [];
	this.conditions 			= [];
	this.customEvents 			= [
									"beforeSubmit",
									"beforeNextPage",
									"afterNextPage",
									"beforePreviousPage",
									"afterPreviousPage",
									"beforeAddPreviousButton",
									"afterAddPreviousButton",
									"beforeShowPage",
									"afterShowPage",
									"beforeAddPageNavigation",
									"afterAddPageNavigation",
									"beforeDynamicChange",
									"afterDynamicChange",
									"afterValidate"
								];
	this.labels 				= {};
	this.__continueExecution 	= true;

	// Initialize ValidForm class
	this._init();
};

ValidForm.prototype._init = function() {
	var self = this;

	// Handle disabled elements and make sure all sub-elements are disabled as well.
	this.traverseDisabledElements();

	// This is where the magic happens: onSubmit; validate form.
	jQuery("#" + self.id).bind("submit", function(){
		jQuery("#" + this.id).trigger("VF_BeforeSubmit", [{ValidForm: self}]);
		if (typeof self.events.beforeSubmit == "function") {
			self.events.beforeSubmit(self);
		}

		if (self.__continueExecution) {
			if (self.pages.length > 1) {
				// Validation has been done on each page individually.
				// No need to re-validate here.
				return true;
			} else {
				return self.validate();
			}
		} else {
			return false;
		}
	});

	// Dynamic duplication logic.
	self.dynamicDuplication();
};

ValidForm.prototype.initialize = function () {
	var self = this;

	for (var i = 0; i <= self.conditions.length; i++) {
		if (typeof self.conditions[i] !== "undefined") {
			self.conditions[i]._init();
		}
	}
};

ValidForm.prototype.addCondition = function (objCondition) {
	this.conditions.push(new ValidFormCondition(this, objCondition));
};

ValidForm.prototype.showAlerts = function (objFields) {
	var __this = this;

	// Remove open alerts first.
	__this.removeAlerts();

	try {
		if ($(objFields).length > 0) {
			$(objFields).each(function () {
				var objFieldError = this;

				for (var fieldName in objFieldError) {
					if (objFieldError.hasOwnProperty(fieldName)) {
						var objField = __this.getElement(fieldName);

						if (objField !== null) {
							// Field found in current form
							objField.validator.showAlert(objFieldError[fieldName]);
						}
					}
				}
			});

			$("#" + __this.id).trigger("VF_ShowAlerts", [{ValidForm: __this, invalidFields: objFields}]);
		}
	} catch (e) {
		try {
			console.error("Show alerts failed: ", e.message, e); // Log error
		} catch (e) {} // Or die trying
	}
};

ValidForm.prototype.removeAlerts = function() {
	for (var strElement in this.elements) {
		var objElement = this.elements[strElement];
		if (objElement !== null) {
			objElement.validator.removeAlert();
		}
	}
};

ValidForm.prototype.setLabel = function (key, value) {
	if (typeof value !== "undefined") {
		this.labels[key] = value;
	} else {
		throw new Error("Cannot set empty label in ValidForm.setLabel('" + key + "', '" + value + "')");
	}
};

ValidForm.prototype.matchfields = function (strSecondFieldId, strFirstFieldId, strMatchError) {
	var objElement = this.getElement(jQuery("#" + strSecondFieldId).attr("name"));
	objElement.validator.matchWith = this.getElement(jQuery("#" + strFirstFieldId).attr("name"));
	objElement.validator.matchError = strMatchError;
};

ValidForm.prototype.traverseDisabledElements = function () {
	var __this = this;

	jQuery("#" + this.id + " fieldset.vf__disabled").each(function(){
		var fieldset = this;

		jQuery("input, select, textarea", fieldset).attr("disabled", "disabled");
		jQuery(".vf__dynamic a", fieldset).addClass("vf__disabled");
		jQuery("legend input", fieldset)
			.removeAttr("disabled");

	});

	__this.attachAreaEvents(jQuery("legend input"));
};

ValidForm.prototype.dynamicDuplication = function () {
	var __this 	= this;

	// Bind click event to duplicate button
	jQuery(".vf__dynamic a").bind("click", function() {
		var $anchor = jQuery(this);

		// Call custom event if set.
		jQuery("#" + this.id).trigger("VF_BeforeDynamicChange", [{ValidForm: __this, objAnchor: $anchor}]);
		if (typeof __this.events.beforeDynamicChange == "function") {
			__this.events.beforeDynamicChange(__this, $anchor);
		}

		if (!jQuery(this).parent().prev().hasClass("vf__disabled")) {
			// Update dynamic field counter.
			var $original 	= $anchor.parent().prev();
			var copy 		= $original.clone();
			var counter; // Counter placeholder

			// Clear values.
			var names = jQuery(this).data("target-name").split("|");
			var ids = jQuery(this).data("target-id").split("|");

			copy.find("input[name$='_dynamic']").remove();

			jQuery.each(names, function(index, fieldname){
				// Fix every field in an area or multifield.
				var objOriginal = __this.getElement(fieldname);
				
				counter = $("#" + fieldname + "_dynamic");

				// Set value to number '0' if value is NaN
				if (isNaN(parseInt(counter.val()))) {
					counter.val(0);
				}

				counter.val(parseInt(counter.val()) + 1);
				var search 	= (parseInt(counter.val()) == 1) ? fieldname : fieldname + "_" + (parseInt(counter.val()) - 1);

				copy.find("[name='" + search + "']").each(function(){
					if (jQuery(this).attr("type") == "radio" ||
							jQuery(this).attr("type") == "checkbox") {
						// Radio buttons and checkboxes have to be treated differently.
						var fieldId;
						if (counter.val() == 1) {
							fieldId = jQuery(this).attr("id");
						} else {
							var arrFieldId = jQuery(this).attr("id").split("_");
							arrFieldId.pop();
							fieldId = arrFieldId.join("_");
						}

						jQuery(this)
							.removeAttr("checked")
							.attr("name", fieldname + "_" + counter.val())
							.attr("id", fieldId + "_" + counter.val())
							.parent("label").attr("for", fieldId + "_" + counter.val());
					} else {
						// Normal fields (input, textarea) are easy.						
						jQuery(this)
							.attr("value", objOriginal.validator.hint) // = hint or empty
							.attr("name", fieldname + "_" + counter.val())
							.attr("id", ids[index] + "_" + counter.val())
							.prev("label").attr("for", ids[index] + "_" + counter.val());
						
						jQuery(this)
							.bind("focus", function() {
								if (jQuery(this).val() == objOriginal.validator.hint) {
									jQuery(this).val("");
									jQuery(this).parent().removeClass("vf__hint");
								}
							})
							.bind("blur", function() {
								if (jQuery(this).val() == "" && objOriginal.validator.required) {
									jQuery(this).val(objOriginal.validator.hint);
									jQuery(this).parent().addClass("vf__hint");
								}
							});
					}
				});

				// Add fields to the form collection.
				if (objOriginal !== null) { // objOriginal is null if there is a paragraph in the area.
					var objCopy = jQuery.extend(new ValidFormElement(), objOriginal);
					objCopy.id = ids[index] + "_" + counter.val();
					objCopy.name = fieldname + "_" + counter.val();
					objCopy.validator = jQuery.extend(new ValidFormFieldValidator(), objOriginal.validator);
					objCopy.validator.id = objCopy.id;
					objCopy.validator.required = false;

					__this.addElement(objCopy);
				}

			});

			// Remove 'required' styling.
			copy
				.find(".vf__required")
				.removeClass("vf__required")
				.addClass("vf__optional")
			copy
				.removeClass("vf__required")
				.removeClass("vf__error")
				.addClass("vf__optional")
				.addClass("vf__clone");

			// For now, we remove the ID attribute from clones
			copy.removeAttr("id");

			copy.find("p.vf__error").remove();
			copy.find(".vf__error").removeClass("vf__error");

			jQuery(this).parent().before(copy);

			// Fix click event on active areas.
			if (copy.hasClass("vf__area")) {
				var copiedTrigger = jQuery("legend :checkbox", copy);
				var originalTrigger = jQuery("legend :checkbox", $original);

				if (copiedTrigger.length > 0) {
					var counter = $("#" + copiedTrigger.attr("name") + "_dynamic");

					// +1 on the counter
					counter.val(parseInt(counter.val()) + 1);

					copiedTrigger.attr("id", copiedTrigger.attr("id") + "_" + counter.val());
					copiedTrigger.attr("name", copiedTrigger.attr("name") + "_" + counter.val());
					copiedTrigger.parent("label").attr("for", copiedTrigger.attr("id"));

					if (originalTrigger.attr("checked") == "checked") {
						copiedTrigger.attr("checked", "checked");
					}

					__this.attachAreaEvents(copiedTrigger);
				}
			}

			// Call custom event if set.
			jQuery("#" + __this.id).trigger("VF_AfterDynamicChange", [{ValidForm: __this, objAnchor: $anchor, objCopy: copy}]);
			if (typeof __this.events.afterDynamicChange == "function") {
				__this.events.afterDynamicChange({ValidForm: __this, objAnchor: $anchor, objCopy: copy});
			}
		}

		return false;
	});
};

ValidForm.prototype.attachAreaEvents = function(objActiveTrigger) {
	var __this = this;

	objActiveTrigger.unbind("click").bind("click", function(){
		var fieldset = jQuery(objActiveTrigger).parentsUntil(".vf__area").parent(".vf__area");

		if (this.checked) {
			// Enable active area
			jQuery("input, select, textarea", fieldset).removeAttr("disabled");
			jQuery(".vf__dynamic a", fieldset).removeClass("vf__disabled");
			jQuery(fieldset).removeClass("vf__disabled");

			var $dynamicTrigger = jQuery(fieldset).data("vf__dynamicTrigger");
			if (typeof $dynamicTrigger === "object") {
				$dynamicTrigger.show();
			}

			$("#" + __this.id).trigger("VF_EnableActiveArea", [{ValidForm: __this, objArea: fieldset}]);
		} else {
			// Disable active area & remove error's

			var inputNames = [];
			jQuery("div > input, select, textarea", fieldset)
				.attr("disabled", "disabled")
				.each(function () {
					inputNames.push($(this).attr("name"));
				});

			jQuery(".vf__dynamic a", fieldset).addClass("vf__disabled");
			jQuery("legend input", fieldset).removeAttr("disabled");
			jQuery(fieldset).addClass("vf__disabled");

			// Get the dynamic trigger, if available
			var $dynamicTrigger = $("[data-target-id='" + inputNames.join("|") + "']");
			if ($dynamicTrigger.length > 0) {
				$dynamicTrigger.hide();

				// And store it in a data attribute of the current fieldset for later reference.
				jQuery(fieldset).data("vf__dynamicTrigger", $dynamicTrigger);
			}

			// Remove errors.
			jQuery("div.vf__error", fieldset).each(function(){
				jQuery(this).removeClass("vf__error").find("p.vf__error").remove();
			});

			$("#" + __this.id).trigger("VF_DisableActiveArea", [{ValidForm: __this, objArea: fieldset}]);
		}
	});
};

ValidForm.prototype.inArray = function(arrToSearch, value) {
	for (var i=0; i < arrToSearch.length; i++) {
		if (arrToSearch[i] === value) {
			return true;
		}
	}
	return false;
};

ValidForm.prototype.addElement = function() {
	var objAddedElement = null;

	if (arguments.length > 0 && typeof(arguments[0]) == "object") {
		objAddedElement = this.elements[arguments[0].name] = arguments[0];
	} else {
		var typeError		= "";
		var required		= false;
		var requiredError	= "";
		var hint			= null;
		var hintError		= "";
		var minLength		= null;
		var minLengthError	= "";
		var maxLength		= null;
		var maxLengthError	= "";

		if (arguments.length > 0) {
			var strElementId = arguments[0];
		} else {
			return false;
		}

		if (arguments.length > 1) {
			var strElementName = arguments[1];
		} else {
			return false;
		}

		if (arguments.length > 2) {
			var strValidation = arguments[2];
		} else {
			return false;
		}

		if (arguments.length > 3) {
			required = arguments[3];
		}

		if (arguments.length > 4) {
			maxLength = arguments[4];
		}

		if (arguments.length > 5) {
			minLength = arguments[5];
		}

		if (arguments.length > 6) {
			hint = arguments[6];
		}

		if (arguments.length > 7) {
			typeError = arguments[7];
		}

		if (arguments.length > 8) {
			requiredError = arguments[8];
		}

		if (arguments.length > 9) {
			hintError = arguments[9];
		}

		if (arguments.length > 10) {
			minLengthError = arguments[10];
		}

		if (arguments.length > 11) {
			maxLengthError = arguments[11];
		}

		objAddedElement = this.elements[strElementName] = new ValidFormElement(this.id, strElementName, strElementId, strValidation, required, maxLength, minLength, hint, typeError, requiredError, hintError, minLengthError, maxLengthError);
	}

	// Store the element in a data property in the DOM element.
	$("[name='" + strElementName + "']", "#" + this.id).data("vf__field", objAddedElement);

	return objAddedElement;
};

ValidForm.prototype.getElement = function(strElementName){
	var objReturn = null;

	for (var strElement in this.elements) {
		if (strElement == strElementName) {
			objReturn = this.elements[strElement];
			break;
		}
	}

	return objReturn;
};

ValidForm.prototype.addEvent = function(strEvent, callback){
	if (this.inArray(this.customEvents, strEvent)) {
		this.events[strEvent] = callback;

		for(var i in this.cachedEvents) {
			if (this.cachedEvents.hasOwnProperty(i)) {
				var objCachedEvent = this.cachedEvents[i];
				for (var eventName in objCachedEvent) {
					if (objCachedEvent.hasOwnProperty(eventName)) {
						if (strEvent == eventName) {
							this.events[strEvent](objCachedEvent[eventName]);
						}
					}
				}
			}
		}
	} else {
		jQuery("#" + this.id).bind(strEvent, callback);
	}
};

ValidForm.prototype.reset = function() {
	this.validator.removeMain();
	for (var strElement in this.elements) {
		var objElement = this.elements[strElement];

		// Only reset if this is an element that can be reset.
		if (typeof objElement.reset == "function") {
			objElement.reset();
		}
	}
};

ValidForm.prototype.validate = function(strSelector) {
	this.valid = true;
	var objDOMForm = null;
	var blnReturn = false;
	strSelector = strSelector || null;

	// Set the form object.
	try {
		objDOMForm = jQuery("#" + this.id);
	} catch(e) {
		alert("An error occured while calling the Form.\nMessage: " + e.message);
		this.valid = false;
	}

	if (objDOMForm) {
		// Reset main error notifications.
		this.validator.removeMain();
		this.validator.removePage();

		for (var strElement in this.elements) {
			var objElement = this.elements[strElement];

			if (((strSelector !== null) && (jQuery(strSelector).has(jQuery("[name='" + objElement.name + "']")).length > 0))
				|| (strSelector == null)) {
				// Check if the element is part of an area.
				var objArea = jQuery("[name='" + objElement.name + "']").parentsUntil(".vf__area").parent(".vf__area");
				if (objArea.length > 0) {
					var objChecker = jQuery("legend :checkbox", objArea);
					if (objChecker.length > 0) {
						if (objChecker.get(0).checked) {
							if (!objElement.validate()) {
								this.valid = false;
							}
						}
					} else {
						if (!objElement.validate()) {
							this.valid = false;
						}
					}
				} else {
					if (!objElement.validate()) {
						this.valid = false;
					}
				}
			}
		}
	} else {
		alert("An error occured while calling the Form.\nMessage: " + e.message);
		this.valid = false;
	}

	if (!this.valid) {
		this.validator.showMain();
	}

	blnReturn = this.valid;

	jQuery("#" + this.id).trigger("VF_AfterValidate", [{ValidForm: this, selector: strSelector}]);
	if (typeof this.events.afterValidate == "function") {
		varReturn = this.events.afterValidate(this, strSelector);
		if (typeof varReturn !== "undefined") {
			blnReturn = varReturn;
		}
	}

	return blnReturn;
};

function ValidFormComparison (objForm, subject, comparison, value) {
	this.subject 	= this._setSubject(objForm, subject);
	if (this.subject !== null) {
		this.comparison = comparison;
		this.value 		= value || null;
		this.isMet		= false;

		this._deferred	= $.Deferred();

		this.uid 		= "com_" + Math.floor(Math.random()*9999);

		return this._init();
	} else {
		return false;
	}
};

ValidFormComparison.prototype._init = function () {
	try {
		var self 		= this
		,	$objSubject = (this.subject instanceof jQuery) ? this.subject : $("[name='" + this.subject.name + "']");

		// Set event listeners. Trigger 'change' event
		if ($objSubject.is("input") || $objSubject.is("textarea")) {
			if ($objSubject.attr("type") !== "checkbox" && $objSubject.attr("type") !== "radio") {

				var delay;
				$objSubject.on("keyup", function () {
					var $self = $(this);

					clearTimeout(delay);
					delay = setTimeout(function () {
						$self.trigger("change");
					}, 300);
				});
			}
		}

		$objSubject
			.on("change", function () {
				self._deferred.notifyWith(self, [self.check()]);
			})
			.trigger("change"); // make sure conditions are met onload

	} catch (e) {
		throw new Error("Failed to initialize ValidFormComparison: " + e.message, 1);
	}

	this.promise 	= this._deferred.promise();

	return this;
};

ValidFormComparison.prototype._setSubject = function (objForm, strSubject) {
	var varReturn;

	if (typeof objForm !== "object" || !objForm instanceof ValidForm) {
		throw new Error("ValidForm element not set in ValidFormCondition.");
	}

	try {
		varReturn = objForm.getElement(strSubject);

		if (varReturn === null) {
			// Element not found in ValidForm internal collection,
			// this is probably a fieldset, area or paragraph element.
			varReturn = $("#" + strSubject);

			if (varReturn.length <= 0) {
				varReturn = null; // Reset subject
				//throw new Error("Could not find subject element with id or name '" + strSubject + "'.", 1);
			}
		}
	} catch (e) {
		throw new Error("Failed to set subject: " + e.message, 1);
	}

	return varReturn;
};

ValidFormComparison.prototype.check = function () {
	var blnReturn 	= false
	,	self		= this
	,	strValue 	= (self.subject instanceof jQuery) ? self.subject.val() : self.subject.getValue();

	switch (self.comparison) {
		case "equal":
			if (strValue == self.value) {
				// Comparison met.
				blnReturn = true;
			}
			break;
		case "notequal":
			if (strValue != self.value) {
				// Comparison met.
				blnReturn = true;
			}
			break;
		case "empty":
			if (strValue === "") {
				blnReturn = true;
			}
			break;
		case "notempty":
			if (strValue != "") {
				blnReturn = true;
			}
			break;
		case "lessthan":
			var intCurrentValue = parseInt(strValue)
			,	varCurrentValue = (isNaN(intCurrentValue)) ? strValue : intCurrentValue;

			if (varCurrentValue < self.value) {
				blnReturn = true;
			}
			break;
		case "greaterthan":
			var intCurrentValue = parseInt(strValue)
			,	varCurrentValue = (isNaN(intCurrentValue)) ? strValue : intCurrentValue;

			if (varCurrentValue > self.value) {
				blnReturn = true;
			}
			break;
		case "lessthanorequal":
			var intCurrentValue = parseInt(strValue)
			,	varCurrentValue = (isNaN(intCurrentValue)) ? strValue : intCurrentValue;

			if (varCurrentValue <= self.value) {
				blnReturn = true;
			}
			break;
		case "greaterthanorequal":
			var intCurrentValue = parseInt(strValue)
			,	varCurrentValue = (isNaN(intCurrentValue)) ? strValue : intCurrentValue;

			if (varCurrentValue >= self.value) {
				blnReturn = true;
			}
			break;
		case "contains":
			if (strValue.toString().toLowerCase().indexOf(self.value.toString().toLowerCase()) !== -1) {
				blnReturn = true;
			}
			break;
		case "startswith":
			if (strValue.indexOf(self.value) === 0) {
				blnReturn = true;
			}
			break;
		case "endswith":
			if (strValue.slice(-self.value.length) == self.value) {
				blnReturn = true;
			}
			break;
	}

	self.isMet = blnReturn;
	return blnReturn;
};

function ValidFormCondition (objForm, objCondition) {
	if (typeof objCondition !== "object" || objCondition == null) {
		throw new Error("Invalid condition object supplied in ValidFormCondition construct.");

	}

	if (typeof objForm === "undefined" || !(objForm instanceof ValidForm)) {
		throw new Error("Form object undefined or not an instance of ValidForm in ValidFormCondition construct.");

	}

	try {
		this.validform 		= objForm;
		this.subject 		= this._setSubject(objCondition.subject);
		this.property 		= objCondition.property;
		this.value 			= objCondition.value;
		this.comparisonType = objCondition.comparisonType;
		this.comparisons 	= [];
		this.condition 		= objCondition;

	} catch (e) {
		throw new Error("Failed to set default values in ValidFormCondition construct: " + e.message);
	}

	return this;
};

ValidFormCondition.prototype._init = function () {
	try {
		var self = this
		,	objComparisons = this.condition.comparisons;

		if (typeof objComparisons === "object" && objComparisons.length > 0) {
			for (var i = 0; i < objComparisons.length; i++) {
				var Comparison = objComparisons[i];
				if (this.validform.getElement(Comparison.subject) !== null) {
					this.addComparison(new ValidFormComparison(this.validform, Comparison.subject, Comparison.comparison, Comparison.value));
				}
			}
		}

		self.isMet()
			.progress(function (blnResult) {
				self.set(blnResult);
			});

	} catch (e) {
		throw new Error("Failed to initialize Condition: " + e.message, 1);
	}

	return this;
};

ValidFormCondition.prototype._setSubject = function (strSubject) {
	var varReturn;

	if (typeof this.validform !== "object" || !this.validform instanceof ValidForm) {
		throw new Error("ValidForm element not set in ValidFormCondition.");
	}

	try {
		varReturn = this.validform.getElement(strSubject);

		if (varReturn === null) {
			// Element not found in ValidForm internal collection,
			// this is probably a fieldset, area or paragraph element.
			varReturn = $("#" + strSubject);

			if (varReturn.length <= 0) {
				throw new Error("Could not find subject element with id or name '" + strSubject + "'.", 1);
			}
		}
	} catch (e) {
		throw new Error("Failed to set subject: " + e.message, 1);
	}

	return varReturn;
};

ValidFormCondition.prototype.set = function (blnResult) {
	var self = this;

	var getDynamicCount = function ($objSubject) {
		$("input[name$='" +  + "']", $objSubject);
	}

	// Utility functions
	var Util = {
		"visible": function (blnValue) {
			var $objSubject = (self.subject instanceof jQuery) ? self.subject : $("[name='" + self.subject.name + "']");

			if (blnValue) {
				$objSubject.show();

				if (!$objSubject.is("div") && !$objSubject.is("fieldset")) {
					$objSubject.parent().show();
				}

				if ($objSubject.attr("type") == "checkbox" || $objSubject.attr("type") == "radio") {
					$objSubject.parent().parent().parent().show();
				}

				if ($objSubject.next().hasClass("vf__dynamic")) {
					$objSubject.next().show();
				}

				$objSubject.nextAll(".vf__clone, .vf__dynamic").show();

				// Set enabled back to default state
				Util.enabled(null, true);

				// Set required back to default state
				Util.required(null, true);

			} else {
				$objSubject.hide();

				if (!$objSubject.is("div") && !$objSubject.is("fieldset")) {
					$objSubject.parent().hide();
				}

				if ($objSubject.attr("type") == "checkbox" || $objSubject.attr("type") == "radio") {
					$objSubject.parent().parent().parent().hide();
				}

				if ($objSubject.next().hasClass("vf__dynamic")) {
					$objSubject.next().hide();
				}

				$objSubject.nextAll(".vf__clone, .vf__dynamic").hide();

				// Set enabled back to default state
				Util.enabled(false);

				// Set required back to default state
				Util.required(false);
			}

			$("#" + self.validform.id).trigger("VF_ConditionSet", [{"condition": "visible", "value": blnValue, "subject": self.subject}]);
		},

		"enabled": function (blnValue, blnDefaultState) {
			blnDefaultState = blnDefaultState || false;

			if (self.subject instanceof ValidFormElement) {
				blnValue = (blnDefaultState) ? self.subject.getEnabled(true) : blnValue;

				self.subject.setEnabled(blnValue);
			} else {
				// Iterate over sub elements
				$("input, textarea, select", self.subject).each(function () {
					var objElement = self.validform.getElement($(this).attr("name"));

					if (objElement !== null) {
						blnValue = (blnDefaultState) ? objElement.getEnabled(true) : blnValue;
						objElement.setEnabled(blnValue);
					}
				});
			}

			$("#" + self.validform.id).trigger("VF_ConditionSet", [{"condition": "enabled", "value": blnValue, "subject": self.subject}]);
		},

		"required": function (blnValue, blnDefaultState) {
			blnDefaultState = blnDefaultState || false;

			if (self.subject instanceof ValidFormElement) {
				blnValue = (blnDefaultState) ? self.subject.getRequired(true) : blnValue;

				self.subject.setRequired(blnValue);
			} else {
				// Iterate over sub elements
				$("input, textarea, select", self.subject).each(function () {
					var objElement = self.validform.getElement($(this).attr("name"));

					if (objElement !== null) {
						blnValue = (blnDefaultState) ? objElement.getRequired(true) : blnValue;
						objElement.setRequired(blnValue);
					}
				});

			}

			$("#" + self.validform.id).trigger("VF_ConditionSet", [{"condition": "required", "value": blnValue, "subject": self.subject}]);
		}
	}

	// Set the condition
	Util[self.property]((blnResult == !!self.value));
};

ValidFormCondition.prototype.addComparison = function (objComparison) {
	var self = this;

	if (!objComparison instanceof ValidFormComparison) {
		throw new Error("Invalid argument: objComparison is no ValidFormComparison type in ValidFormCondition.addCondition()", 1);
	}

	this.comparisons.push(objComparison);
};

ValidFormCondition.prototype.isMet = function () {
	var self = this
	,	def = $.Deferred();

	// Count met comparisons
	var _checkComparisons = function () {
		var success = 0;
		for (var i = 0; i < self.comparisons.length; i++) {
			if (self.comparisons[i].isMet) {
				if (success < self.comparisons.length) {
					success++;
				} else {
					if (success > 0) {
						success--;
					}
				}
			}
		}

		return success;
	}

	// comparison match all
	var _matchAll = function () {
		return _checkComparisons() === self.comparisons.length;
	}

	// comparison match any
	var _matchAny = function () {
		return _checkComparisons() > 0;
	}

	for (var i = 0; i < self.comparisons.length; i++) {
		if (self.comparisonType === "all") {
			self.comparisons[i].promise.progress(function (blnResult) {
				if (_matchAll()) {
					def.notify(true);
				} else {
					def.notify(false);
				}
			});
		} else {
			self.comparisons[i].promise.progress(function (blnResult) {
				if (_matchAny()) {
					def.notify(true);
				} else {
					def.notify(false);
				}
			});
		}
	}

	return def.promise();
};

function ValidFormElement(strFormId, strElementName, strElementId, strValidation) {
	this.formId					= strFormId;
	this.id 					= strElementId;
	this.name 					= strElementName;
	this.disabled 				= !!($("#" + strElementId).attr("disabled") === "disabled");
	this.validator 				= new ValidFormFieldValidator(strElementId, strElementName);
	this.validator.check 		= strValidation;
	this.validator.required		= false;
	this.validator.minLength	= null;
	this.validator.maxLength	= null;

	// Rewritten 'ValidFormElement.arguments' to just 'arguments' -Robin
	// http://aptana.com/reference/api/Arguments.html
	if (arguments.length > 4) {
		this.validator.required = arguments[4];
	}

	if (arguments.length > 5) {
		this.validator.maxLength = arguments[5];
	}

	if (arguments.length > 6) {
		this.validator.minLength = arguments[6];
	}

	if (arguments.length > 7) {
		this.validator.hint = arguments[7];

		var __this = this;
		if (this.validator.hint != "") {
			jQuery("#" + this.id)
				.bind("focus", function(){
					if (jQuery(this).val() == __this.validator.hint) {
						jQuery(this).val("");
						jQuery(this).parent().removeClass("vf__hint");
					}
				})
				.bind("blur", function(){
					if (jQuery(this).val() == "" && __this.validator.required) {
						jQuery(this).val(__this.validator.hint);
						jQuery(this).parent().addClass("vf__hint");
					}
				});
		}
	}

	if (arguments.length > 8) {
		this.validator.typeError = arguments[8];
	}

	if (arguments.length > 9) {
		this.validator.requiredError = arguments[9];
	}

	if (arguments.length > 10) {
		this.validator.hintError = arguments[10];
	}

	if (arguments.length > 11) {
		this.validator.minLengthError = arguments[11];
	}

	if (arguments.length > 12) {
		this.validator.maxLengthError = arguments[12];
	}

	// Keep the original values in a local cache for future reference.
	this._defaultstate = {
		"required": this.validator.required,
		"enabled": !this.disabled
	}
};

ValidFormElement.prototype.validate = function() {
	return this.validator.validate();
};

ValidFormElement.prototype.getValue = function () {
	var $field 	= jQuery("[name='" + this.name + "']")
	,	value;

	switch ($field.attr("type")) {
		case "radio":
			// Single value
			value = jQuery("[name='" + this.name + "']:checked").val();
			break;
		case "checkbox":
			value = jQuery("[name='" + this.name + "']:checked").map(function () {return this.value;}).get().join(", ");
			break;
		default:
			value = $field.val();
	}

	return value;
};

ValidFormElement.prototype.setRequired = function (blnValue) {
	var self = this;

	this.validator.required = blnValue;

	// The state has changed, remove it's alert.
	this.validator.removeAlert();

	var $parent = $("#" + this.id).parent();
	if ($parent.hasClass("vf__multifielditem")) {
		// Multifield item
		$parent = $parent.parent();
	}

	if (blnValue) {
		// Required == true
		$parent.removeClass("vf__optional").addClass("vf__required");
	} else {
		// Required == false
		$parent.addClass("vf__optional").removeClass("vf__required");
	}

	$parent.find("input, select").each(function () {
		var field = $(this).data("vf__field");

		if (typeof field !== "undefined") {
			if (field.validator.required) {
				$parent.removeClass("vf__optional").addClass("vf__required");
			}
		}
	});
};

ValidFormElement.prototype.getRequired = function (blnDefaultState) {
	return (!!blnDefaultState) ? this._defaultstate.required : this.validator.required;
};

ValidFormElement.prototype.setEnabled = function (blnValue) {
	this.disabled = !blnValue;

	if (blnValue) {
		// Enabled == true, e.g. disabled = false
		$("#" + this.id)
			// .addClass("vf__optional")
			// .removeClass("vf__required")
			.removeClass("vf__disabled")
			.removeAttr("disabled");

		$("#" + this.id).parent().addClass("vf__optional").removeClass("vf__required");
	} else {
		// Enabled == false, e.g. disabled = true
		$("#" + this.id)
			// .removeClass("vf__optional")
			// .addClass("vf__required")
			.addClass("vf__disabled")
			.attr("disabled", "disabled");

		$("#" + this.id).parent().removeClass("vf__optional").addClass("vf__required");
	}
};

ValidFormElement.prototype.getEnabled = function (blnDefaultState) {
	return (!!blnDefaultState) ? this._defaultstate.enabled : !this.disabled;
};

ValidFormElement.prototype.getDynamicCount = function () {
	var self 		= this
	,	varReturn 	= 0
	,	$counter 	= $("input[name='" + self.name + "_dynamic']", $("#" + self.formId)); // jQuery performs better when scoped correctly

	if ($counter.length > 0) {
		varReturn = parseInt($counter.val());

		if (isNaN(varReturn)) {
			varReturn = 0;
		}
	}

	return varReturn;
}

ValidFormElement.prototype.reset = function() {
	this.validator.removeAlert();

	var objElement = jQuery("#" + this.id);
	objElement.val("");
};

function ValidFormValidator(strFormId) {

	this.id 				= strFormId;


	this.mainAlert			= "";
};

ValidFormValidator.prototype.removeMain = function() {
	jQuery("#" + this.id + " div.vf__main_error.ym-error").remove();
};

ValidFormValidator.prototype.showMain = function() {
	if (this.mainAlert != "") {
		jQuery("#" + this.id).prepend("<div class=\"vf__main_error ym-error\"><p class=\"ym-message\">" + this.mainAlert + "</p></div>");
	}

	// Jump to the first error.
	jQuery.scrollTo(jQuery("div.vf__error.ym-error:first"), 500);
};

ValidFormValidator.prototype.showPage = function (strAlert) {
	strAlert = (typeof this.pageAlert !== "undefined") ? this.pageAlert : strAlert;

	if (typeof strAlert !== "undefined" && strAlert !== "") {
		var $objPageError = jQuery("#" + this.id).find(".vf__page:visible").find(".vf__page_error");

		if ($objPageError.length > 0) {
			this.removePage();
		}

		jQuery("#" + this.id).find(".vf__page:visible").prepend("<div class=\"vf__page_error ym-error\"><p class=\"ym-message\">" + strAlert + "</p></div>");
	}

	// Jump to the first error.
	jQuery.scrollTo(jQuery("div.vf__error.ym-error:first"), 500);
};

ValidFormValidator.prototype.removePage = function() {
	jQuery("#" + this.id + " .vf__page:visible div.vf__page_error.ym-error").remove();
};

function ValidFormFieldValidator(strElementId, strElementName) {

	this.id 				= strElementId;

	this.name 				= strElementName;

	this.disabled 			= !!($("#" + strElementId).attr("disabled") === "disabled");

	this.check				= null;

	this.typeError			= "";

	this.required			= false;

	this.requiredError		= "";

	this.hint				= null;

	this.hintError			= "";

	this.minLength			= null;

	this.minLengthError		= "";

	this.maxLength			= null;

	this.maxLengthError		= "";
};

ValidFormFieldValidator.prototype.validate = function(value) {
	var objElement = jQuery("#" + this.id);
	var value = objElement.val();

	this.removeAlert();

	// Check if the disabled attribute has been set if so, no validation is
	// needed because this field value will not be submitted anyway.
	this.disabled = !!(objElement.attr("disabled") === "disabled");


	if (!this.disabled) {
		try {
			var objDOMElement = objElement.get(0);
		

			switch (objDOMElement.type) {
				case 'checkbox':
				case 'radiobutton':
					throw "Checkbox or radio button detected.";
					break;
			}

			// Required, but empty is not good.
			if (this.required && value == "") {
				this.showAlert(this.requiredError);
				return false;
			}

			// Check if there is a matchWith field to validate against
			if (typeof this.matchWith == "object") {
				if (this.matchWith.validate()) {
					if (jQuery("#" + this.matchWith.id).val() != value) {
						this.matchWith.validator.showAlert(this.matchError);
						this.showAlert(this.matchError);
						return false;
					}
				}
			}

			// Value is the same as hint value.
			if (this.hint && value == this.hint) {
				this.showAlert(this.hintError);
				return false;
			}

			// Check if the length of the value is within the range.
			if (this.minLength > 0 && value.length < this.minLength) {
				this.showAlert(sprintf(this.minLengthError, this.minLength));
				return false;
			}

			if (this.maxLength > 0 && value.length > this.maxLength) {
				this.showAlert(sprintf(this.maxLengthError, this.maxLength));
				return false;
			}

			// Check specific types using regular expression.
			if(typeof this.check != "function" && typeof this.check != "object") {
				return true;
			} else {
				// If the user entered a value, use the regular expression to validate that value.
				if (value.length > 0) {
					blnReturn = this.check.test(value);

					if (blnReturn == false) this.showAlert(this.typeError);

					return blnReturn;
				} else {
					return true;
				}
			}
		} catch(e) {
			var objElements = jQuery("input[name='" + this.name + "']");
			if (objElements.length > 0) {
				var objValidElements = objElements.filter(":checked");
				value = objValidElements.val();

				// Required, but empty is not good.
				if (this.required && value == undefined && objElements.attr("disabled") !== "disabled") {
					this.showAlert(this.requiredError);
					return false;
				} else if (!this.required && value == undefined) {
					return true;
				} else if (this.required && value == undefined && objElements.attr("disabled") == "disabled") {
					return true;
				}

				// Check if the length of the value is within the range.
				if (this.minLength > 0 && objValidElements.length < this.minLength) {
					this.showAlert(sprintf(this.minLengthError, this.minLength));
					return false;
				}

				if (this.maxLength > 0 && objValidElements.length > this.maxLength) {
					this.showAlert(sprintf(this.maxLengthError, this.maxLength));
					return false;
				}

				// Check specific types using the type array.
				if (typeof this.check == "array") {
					for (var intCount = 0; intCount < objValidElements.length; intCount++) {
						if (!ValidForm.inArray(this.check, objValidElements.get(intCount))) {
							this.showAlert(this.typeError);
							return false;
						}
					}
				}

				return true;
			} else {
				return true;
			}
		}
	} else {
		return true;
	}

};

ValidFormFieldValidator.prototype.removeAlert = function() {
	var objElement = jQuery("#" + this.id);

	if (objElement.length == 0) {
		objElement = jQuery("input[name='" + this.name + "']:first").closest(".vf__list");
	}

	objElement.closest(".vf__error").removeClass("vf__error").removeClass("ym-error").find("p.vf__error").remove();
	// objElement.closest(".vf__optional, .vf__required").removeClass("vf__error").find("p.vf__error").remove();

	if (objElement.closest("div").hasClass("vf__multifielditem")) {
		objElement.closest(".vf__multifield").removeClass("vf__error").removeClass("ym-error").find("p.vf__error").remove();
	}
};

ValidFormFieldValidator.prototype.showAlert = function(strAlert) {
	var objElement = jQuery("#" + this.id);
	if (objElement.length == 0) {
		objElement = jQuery("input[name='" + this.name + "']:first").closest(".vf__list");
	}

	var objMultifieldItem = objElement.closest("div");
	if (objMultifieldItem.hasClass("vf__multifielditem")) {
		objMultifieldItem.addClass("vf__error").addClass("ym-message");

		var objAlertWrap = objMultifieldItem.closest(".vf__multifield");
		
		objAlertWrap.addClass("vf__error").addClass("ym-message");
		if (objAlertWrap.find("p.vf__error.ym-message").length <= 0) {
			// Only add an error message if we haven't done so before.
			objAlertWrap.prepend("<p class=\"vf__error ym-message\">" + strAlert + "</p>");
		}
	} else {
		objElement.closest(".vf__optional, .vf__required").addClass("vf__error ym-error").prepend("<p class=\"vf__error ym-message\">" + strAlert + "</p>");
	}
};

;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

var sprintf=function(){function a(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function b(a,b){for(var c=[];b>0;c[--b]=a){}return c.join("")}var c=function(){if(!c.cache.hasOwnProperty(arguments[0])){c.cache[arguments[0]]=c.parse(arguments[0])}return c.format.call(null,c.cache[arguments[0]],arguments)};c.format=function(c,d){var e=1,f=c.length,g="",h,i=[],j,k,l,m,n,o;for(j=0;j<f;j++){g=a(c[j]);if(g==="string"){i.push(c[j])}else if(g==="array"){l=c[j];if(l[2]){h=d[e];for(k=0;k<l[2].length;k++){if(!h.hasOwnProperty(l[2][k])){throw sprintf('[sprintf] property "%s" does not exist',l[2][k])}h=h[l[2][k]]}}else if(l[1]){h=d[l[1]]}else{h=d[e++]}if(/[^s]/.test(l[8])&&a(h)!="number"){throw sprintf("[sprintf] expecting number but found %s",a(h))}switch(l[8]){case"b":h=h.toString(2);break;case"c":h=String.fromCharCode(h);break;case"d":h=parseInt(h,10);break;case"e":h=l[7]?h.toExponential(l[7]):h.toExponential();break;case"f":h=l[7]?parseFloat(h).toFixed(l[7]):parseFloat(h);break;case"o":h=h.toString(8);break;case"s":h=(h=String(h))&&l[7]?h.substring(0,l[7]):h;break;case"u":h=Math.abs(h);break;case"x":h=h.toString(16);break;case"X":h=h.toString(16).toUpperCase();break}h=/[def]/.test(l[8])&&l[3]&&h>=0?"+"+h:h;n=l[4]?l[4]=="0"?"0":l[4].charAt(1):" ";o=l[6]-String(h).length;m=l[6]?b(n,o):"";i.push(l[5]?h+m:m+h)}}return i.join("")};c.cache={};c.parse=function(a){var b=a,c=[],d=[],e=0;while(b){if((c=/^[^\x25]+/.exec(b))!==null){d.push(c[0])}else if((c=/^\x25{2}/.exec(b))!==null){d.push("%")}else if((c=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(b))!==null){if(c[2]){e|=1;var f=[],g=c[2],h=[];if((h=/^([a-z_][a-z_\d]*)/i.exec(g))!==null){f.push(h[1]);while((g=g.substring(h[0].length))!==""){if((h=/^\.([a-z_][a-z_\d]*)/i.exec(g))!==null){f.push(h[1])}else if((h=/^\[(\d+)\]/.exec(g))!==null){f.push(h[1])}else{throw"[sprintf] huh?"}}}else{throw"[sprintf] huh?"}c[2]=f}else{e|=2}if(e===3){throw"[sprintf] mixing positional and named placeholders is not (yet) supported"}d.push(c)}else{throw"[sprintf] huh?"}b=b.substring(c[0].length)}return d};return c}();var vsprintf=function(a,b){b.unshift(a);return sprintf.apply(null,b)};


(function(j,f){function s(a,b){var c=a.createElement("p"),m=a.getElementsByTagName("head")[0]||a.documentElement;c.innerHTML="x<style>"+b+"</style>";return m.insertBefore(c.lastChild,m.firstChild)}function o(){var a=d.elements;return"string"==typeof a?a.split(" "):a}function n(a){var b=t[a[u]];b||(b={},p++,a[u]=p,t[p]=b);return b}function v(a,b,c){b||(b=f);if(e)return b.createElement(a);c||(c=n(b));b=c.cache[a]?c.cache[a].cloneNode():y.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);
return b.canHaveChildren&&!z.test(a)?c.frag.appendChild(b):b}function A(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();a.createElement=function(c){return!d.shivMethods?b.createElem(c):v(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+o().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(d,b.frag)}
function w(a){a||(a=f);var b=n(a);if(d.shivCSS&&!q&&!b.hasCSS)b.hasCSS=!!s(a,"article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}");e||A(a,b);return a}function B(a){for(var b,c=a.attributes,m=c.length,f=a.ownerDocument.createElement(l+":"+a.nodeName);m--;)b=c[m],b.specified&&f.setAttribute(b.nodeName,b.nodeValue);f.style.cssText=a.style.cssText;return f}function x(a){function b(){clearTimeout(d._removeSheetTimer);c&&c.removeNode(!0);
c=null}var c,f,d=n(a),e=a.namespaces,j=a.parentWindow;if(!C||a.printShived)return a;"undefined"==typeof e[l]&&e.add(l);j.attachEvent("onbeforeprint",function(){b();var g,i,d;d=a.styleSheets;for(var e=[],h=d.length,k=Array(h);h--;)k[h]=d[h];for(;d=k.pop();)if(!d.disabled&&D.test(d.media)){try{g=d.imports,i=g.length}catch(j){i=0}for(h=0;h<i;h++)k.push(g[h]);try{e.push(d.cssText)}catch(n){}}g=e.reverse().join("").split("{");i=g.length;h=RegExp("(^|[\\s,>+~])("+o().join("|")+")(?=[[\\s,>+~#.:]|$)","gi");
for(k="$1"+l+"\\:$2";i--;)e=g[i]=g[i].split("}"),e[e.length-1]=e[e.length-1].replace(h,k),g[i]=e.join("}");e=g.join("{");i=a.getElementsByTagName("*");h=i.length;k=RegExp("^(?:"+o().join("|")+")$","i");for(d=[];h--;)g=i[h],k.test(g.nodeName)&&d.push(g.applyElement(B(g)));f=d;c=s(a,e)});j.attachEvent("onafterprint",function(){for(var a=f,c=a.length;c--;)a[c].removeNode();clearTimeout(d._removeSheetTimer);d._removeSheetTimer=setTimeout(b,500)});a.printShived=!0;return a}var r=j.html5||{},z=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,
y=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q,u="_html5shiv",p=0,t={},e;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";q="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}e=b}catch(d){e=q=!0}})();var d={elements:r.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup main mark meter nav output progress section summary time video",
version:"3.6.2",shivCSS:!1!==r.shivCSS,supportsUnknownElements:e,shivMethods:!1!==r.shivMethods,type:"default",shivDocument:w,createElement:v,createDocumentFragment:function(a,b){a||(a=f);if(e)return a.createDocumentFragment();for(var b=b||n(a),c=b.frag.cloneNode(),d=0,j=o(),l=j.length;d<l;d++)c.createElement(j[d]);return c}};j.html5=d;w(f);var D=/^$|\b(?:all|print)\b/,l="html5shiv",C=!e&&function(){var a=f.documentElement;return!("undefined"==typeof f.namespaces||"undefined"==typeof f.parentWindow||
"undefined"==typeof a.applyElement||"undefined"==typeof a.removeNode||"undefined"==typeof j.attachEvent)}();d.type+=" print";d.shivPrint=x;x(f)})(this,document);




(function () {
	var YAML_focusFix = {
		skipClass : 'ym-skip',

		init : function () {
			var userAgent = navigator.userAgent.toLowerCase();
			var	is_webkit = userAgent.indexOf('webkit') > -1;
			var	is_ie = userAgent.indexOf('msie') > -1;

			if (is_webkit || is_ie) {
				var body = document.body,
					handler = YAML_focusFix.click;
				if (body.addEventListener) {
					body.addEventListener('click', handler, false);
				} else if (body.attachEvent) {
					body.attachEvent('onclick', handler);
				}
			}
		},

		trim : function (str) {
			return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
		},

		click : function (e) {
			e = e || window.event;
			var target = e.target || e.srcElement;
			var a = target.className.split(' ');

			for (var i=0; i < a.length; i++) {
				var cls = YAML_focusFix.trim(a[i]);
				if ( cls === YAML_focusFix.skipClass) {
					YAML_focusFix.focus(target);
					break;
				}
			}
		},

		focus : function (link) {
			if (link.href) {
				var href = link.href,
					id = href.substr(href.indexOf('#') + 1),
					target = document.getElementById(id);
				if (target) {
					target.setAttribute("tabindex", "-1");
					target.focus();
				}
			}
		}
	};
	YAML_focusFix.init();
})();