// Site Flag
$("html").data("context", "");
$("html").data("site-flag", "rebif");
$("html").data("service-uri", "/services/api/");
$("html").data("session-timeout", "1,800");


// Our Plugins
/* ********** Validation ********** */
	// Class definition
	function Validator(options){

		this.fields = options.fields;
		
		this.fieldSet = [];					// array for references to the field elements
		
		var boundBlurFunc = function(ref){
			return function(){
				// we want to ignore the check on blur for email and password
				if (this.id =="loginEmail" || this.id=="loginPassword"){
					return false;
				}
				else{
					main.checkField(ref);
				}
			};
		};
		
		var radioFunc = function(ref, fieldRef){
			$(ref).unbind("blur").bind("blur", function(){
				main.checkField(fieldRef);
			});	
		};
		
		for(var field in this.fields){
			if(this.fields.hasOwnProperty(field)){
				var fieldRef = $("#" + field);
	
				// Putting the list of fields in an easy to use array
				this.fieldSet.push(fieldRef);
				
				var main = this;				// scoping variable (for use in the closure below)
				
				// Setting the default error messages to null to avoid having to check for 'undefined'
				fieldRef.data("required", null);
				fieldRef.data("invalid", null);
				
				// Setting the blur event on each of the form fields
				fieldRef.bind("blur", boundBlurFunc(fieldRef));
				
				if($(fieldRef).attr("type") == "radio"){
					var radiosByName = $("input[name=" + $(fieldRef).attr("name") + "]");
					for(var rIndex = 0; rIndex < radiosByName.length; rIndex++){
						radioFunc(radiosByName[rIndex], fieldRef);
					}
				}				
			}
		}

		// Main method for validating a single field
		this.checkField = function(field){
			var params = {};				// useful object for passing parameters between functions
			var reg;						// regular expression variable
			params.fieldRef = $(field);
			params.objRef = this.fields[$(field).attr("id")];
			
			// Getting field name from label and removing * and : (using this string for default error messaging)
			params.fieldName = $(params.fieldRef.siblings("label")[0]).text();
			params.fieldName = params.fieldName.replace(/[*:]/g, "");

			params.fieldVal = params.fieldRef.attr("value");
			//params.fieldVal = $.trim(params.fieldVal);
			params.message = false;			// unless overwritten, this makes each rule use default error messaging
			
			// Clears any existing field level validation errors to start with a fresh slate
			params.fieldRef.data("invalid", null);
			
			// For each rule specified for the field...
			for(var rule in this.fields[field.attr("id")]){
				if(this.fields[field.attr("id")].hasOwnProperty(rule)){
	
					switch(rule){
						case "required":
							if(this.fields[field.attr("id")].required){
								// Method abstracted so that the overall form validation can use it as well. See below.
								this.checkRequired(params);
							}
							break;
						case "alpha":
							// Call the setMessage method to determine the error messaging
							params.msgString = "alpha";
							params.message = this.setMessage(params);
							
							reg = /[\d\~\!\@\#\$\%\^\&\*\(\)\;\:\"<>\?\/\|\\]/;
							
							// If the field is not empty and contains any digits, set error
							if(params.fieldVal.match(reg) && params.fieldVal != ""){
								params.fieldRef.data("invalid", params.message ? params.message: " cannot contain numbers");
							}
							break;
						case "email":
							// Call the setMessage method to determine the error messaging
							params.msgString = "email";
							params.message = this.setMessage(params);
		
							// This regexp by Dustin Diaz: http://www.dustindiaz.com/update-your-email-regexp/
							reg = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;				
							// If the field is not empty and does not match the email pattern, set error
							if(!params.fieldVal.match(reg) && params.fieldVal != ""){
								params.fieldRef.data("invalid", params.message ? params.message: "Your email address is not in a valid format.  Example of correct format:  joe.example@example.org");
							}
							break;
						case "multipleEmails":
							// Call the setMessage method to determine the error messaging
							params.msgString = "multipleEmails";
							params.message = this.setMessage(params);
							
							// This regexp by Matt Kohnen, adapted from Dustin Diaz: http://mattkohnen.com/regex#multiple-emails-commas
							reg = /^(([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})(,|, |$))+$/;
							// If the field is not empty and does not match the email pattern, set error
							if(!params.fieldVal.match(reg) && params.fieldVal != ""){
								params.fieldRef.data("invalid", params.message ? params.message: "Your email address is not in a valid format.  If you're including multiple email addresses, please use a comma to separate them.");
							}
							break;
						case "match":
							// Method abstracted so that the overall form validation can use it as well. See below.
							this.checkMatch(params);
							break;
						case "num":
							// Call the setMessage method to determine the error messaging
							params.msgString = "num";
							params.message = this.setMessage(params);
							
							reg = /\D/;						
							// If the field is not empty and contains any non-digits, set error
							if(params.fieldVal.match(reg) && params.fieldVal != ""){
								params.fieldRef.data("invalid", params.message ? params.message: "Please use only numbers");
							}
							break;
						case "minLength":
							// Call the setMessage method to determine the error messaging
							params.msgString = "minLength";
							params.message = this.setMessage(params);
	
							// If the length of the field vaue is less than that specified during instantiation, set error
							if(params.fieldVal.length !== 0 && params.fieldVal.length < params.objRef.minLength){
								params.fieldRef.data("invalid", params.message ? params.message: params.fieldName + " cannot be less than " + params.objRef.minLength + " characters");
							}
							break;						
						case "phone":
							// Call the setMessage method to determine the error messaging
							params.msgString = "phone";
							params.message = this.setMessage(params);
							
							reg = /^(\(?[2-9]\d{2}\)?|[2-9]\d{2})(-|\s)?[2-9]\d{2}(-|\s)?\d{4}$/;						
							// If the field contains more or less than 10 digits, set an error. Spaces, hyphens, and parenthesis are allowed
							if(!params.fieldVal.match(reg)){
								params.fieldRef.data("invalid", params.message ? params.message: params.fieldName + " must be a 10-digit phone number");
							}
							break;	
						case "ext":
							// Call the setMessage method to determine the error messaging
							params.msgString = "ext";
							params.message = this.setMessage(params);
							
							reg = /^(\D*\d\D*){6,}$/;
							var reg2 = /^(\d*\D*\d+\D*\d*)$/;					
							// If the field contains between 1 and 5 digits, set an error. Other characters are allowed (and field can be empty)
							if((!params.fieldVal.match(reg2) && params.fieldVal != "") || params.fieldVal.match(reg)){
								params.fieldRef.data("invalid", params.message ? params.message: params.fieldName + " must have between 1 and 5 digits");
							}
							break;
						case "alphaNumForced":
							// Call the setMessage method to determine the error messaging
							params.msgString = "alphaNumForced";
							params.message = this.setMessage(params);
							
							//reg = /^(.*\d.*\D.*)|(.*\D.*\d.*)$/;
							// No spaces allowed now:  http://mattkohnen.com/regex#alphanumeric-forced-no-spaces
							reg = /(?=^.{1,}$)(?!.*\s)(?=.*[a-zA-Z])(?=.*\d)[0-9a-zA-Z!@#$%*()_+^&\[\]]+$/;
							
							// If the field does not contain at least 1 digit and 1 letter, set an error
							if(!params.fieldVal.match(reg) && params.fieldVal.length !== 0){
								params.fieldRef.data("invalid", params.message ? params.message: params.fieldName + " must contain at least one number and one letter");
							}
							break;
							case "usps":
							// Call the setMessage method to determine the error messaging
							params.msgString = "usps";
							params.message = this.setMessage(params);
							
							// If the field is not empty and does not contain either 5 digits, or 5 digits and a hyphen and 4 more digits
							reg = /^(\d{5}|\d{5}\-\d{4})$/;
							if(!params.fieldVal.match(reg) && params.fieldVal.length !== 0){
								params.fieldRef.data("invalid", params.message ? params.message: "Please use a valid ZIP code");
							}
							break;
					}
				}
			}
			// Call the method to display errors, passing a reference to the field so that only it is checked
			this.displayErrors(params.fieldRef);	
		};
		
		// Method to check entire form for required fields
		this.checkForm = function(){
			for(var field in this.fields){
				
				if(this.fields.hasOwnProperty(field)){
					
					var params = {};
					params.fieldRef = $("#" + field);
					params.objRef = this.fields[field];
					
					// Check to see if field exists (allowing the same object instantiation to serve for multiple pages with different fields)
					if(params.fieldRef.length > 0){
						// Getting field name from label and removing * and : (using this string for default error messaging)
						params.fieldName = $(params.fieldRef.siblings("label")[0]).text();
						params.fieldName = params.fieldName.replace(/[*:]/g, "");
						
						params.fieldVal = params.fieldRef.attr("value");
						//params.fieldVal = $.trim(params.fieldVal);
						params.message = false;			// unless overwritten, this makes each rule use default error messaging		
										
						// Checking each required field (see checkRequired method, below)
						if(params.objRef.required === true){
							this.checkRequired(params);
						}
						
						// Checking each match field (see checkMatch method, below)
						if(typeof(params.objRef.match) === "string"){
							this.checkMatch(params);
						}
						
						if(typeof(params.objRef.either) === "string"){
							this.checkEither(params);
						}
					}
				}
			}
			// Call the method to display errors, passing no reference so that the entire form is checked
			return this.displayErrors();
		};
		
		// Method for displaying all validation errors
		this.displayErrors = function(single){
		
			var flag = false;					// used to prevent a false negative condition
			
			var multiFieldError = null;				// implementation specific: for the three date of birth selects
			
			// Will check a single field if passed one; otherwise checks all fields in the fieldSet variable
			var context = single || this.fieldSet;
			
			var errorContents;					// string for error message and markup
			
			$(context).each(
				function(){
					/* Implementation Specific --
					 * The multiFieldError variable and associated logic are only in place
					 * because we have three select boxes sharing one error space, and we need to
					 * check the data of all of them to prevent a minor error in one circumstance
					 */
					$(this).siblings("select").each(
						function(){
							if(typeof($(this).data("required")) === "string"){
								multiFieldError = true;
							}
						}
					);

					// If any error message is present
					if(typeof($(this).data("required")) === "string" || typeof($(this).data("invalid")) == "string" || multiFieldError === true){
						
						// required and syntactic validation are mutually exclusive, so display one message or the other
						if(typeof($(this).data("required")) === "string"){
							errorContents = "<p>" + ($(this).data("required") + "</p>");
						}else if(typeof($(this).data("invalid")) == "string"){
							errorContents = "<p>" + ($(this).data("invalid") + "</p>");
						}
						
						// If there is already an error container displayed for this field, just swap out its contents
						if($(this).closest("li").prev().hasClass("error-row")){
							$(this).closest("li").prev().html(errorContents);
						}else{
						// Otherwise add an error row into the markup with the contents inside, and display the message via animation
							$(this).closest("li").addClass("has-errors").before("<li class='error-row'>" + errorContents + "</li>");
							$(this).closest("li").siblings(".error-row").slideDown();
						}
						
						flag = true;
					}else if(flag === false){
					// With no error message present, delete error row markup and remove the error class
						$(this).closest("li").removeClass("has-errors");
						$(this).closest("li").prev(".error-row").slideUp(
							function(){
								$(this).remove();
							}
						);
					}
				}
			);
			return flag;
		};
		
		this.setMessage = function(params){
			// Check for a user-entered error message for this rule and use it in place of default if it exists
			if(typeof(params.objRef.messages) != "undefined" && typeof(params.objRef.messages[params.msgString]) != "undefined"){
				params.message = params.objRef.messages[params.msgString];
			}else{
				params.message = null;
			}	
			return params.message;			
		};
		
		this.checkRequired = function(params){
			// Call the setMessage method to determine the error messaging
			params.msgString = "required";
			params.message = this.setMessage(params);
			
			// Check to see if the field is a text input, select, or password input
			if(params.fieldRef.is(":text, select, :password")){
				// Check if empty, and set or unset the error message
				if(params.fieldVal == ""){
					params.fieldRef.data("required", params.message ? params.message: params.fieldName + " is a required field");
					return params.fieldRef;
				}else{
					params.fieldRef.data("required", null);
					return null;
				}
			// Else it's a radio or checkbox input	
			}else{
				// Check if at least one checkbox or radio is checked, and set or unset the error message
				if(!$("input[name=" + $(params.fieldRef).attr("name") + "]").is(":checked") && (params.objRef.required === true)){
					params.fieldRef.data("required", params.message ? params.message: params.fieldName + " is required");
					return params.fieldRef;
				}else{
					params.fieldRef.data("required", null);
					return null;
				}
			}
		};
		
		this.checkMatch = function(params){
			// Call the setMessage method to determine the error messaging
			params.msgString = "match";
			params.message = this.setMessage(params);					
			
			// If the field is not empty and does not match the value of the field specified during instantiation, set error
			if(params.fieldVal != $("#" + params.objRef.match).val()){
				params.fieldRef.data("invalid", params.message ? params.message: "This field does not match");
			}
		};
		
		this.checkEither = function(params){
			// Call the setMessage method to determine the error messaging
			params.msgString = "either";
			params.message = this.setMessage(params);					
		
			if(params.fieldVal ==  "" && ($("#" + params.objRef.either).val() == "")){
				params.fieldRef.data("invalid", params.message ? params.message: "At least one of this type of field is required");
			}else{
				params.fieldRef.data("invalid", null);
			}
		};		
	}
	
/* ////////// END Validation ////////// */


/* ********** Miscellaneous Functions ********** */
	function cleanNumbers(fields){
		var oldVal;
		var newVal;
		var reg = /\D/g;
		$(fields).each(
			function(){
				oldVal = $("#" + this).val();
				newVal = oldVal.replace(reg, "");
				$("#" + this).val(newVal);
			}		
		);
	}
	
// Function to make query string parameters easily accessible from a jquery object
	(function() {
		jQuery.query = {};
		var r = jQuery.query;
		var params = location.search.replace(/^\?/,'').split('&');
		for(var i = params.length - 1; i >= 0; i--){
			var p = params[i].split('='), key = p[0];
			if(key){
				r[key] = p[1];
			} 
		}
	})(); 
	$("html").data("redirectUrl", (window.location + "").indexOf("redirectUrl"));
	$("html").data("redirectUrl", (($("html").data("redirectUrl") == -1) ? $("html").data("context") + "/pages/home" : $.query.redirectUrl));

/* ********** Date adjustment scripts ********** */
	if($("#dobDay").length > 0){
		// This takes a month and year and determines the number of days in the month
		var numDays = function(inMonth, inYear) {
			inMonth = inMonth == "" ? 1 : inMonth;
			inYear = inYear == "" ? 1980 : inYear;
			var date1;
			var count1;
			var count2;
			var numDaysMS;
			var flag;
			var dayCount;
			var month;
			month = inMonth - 1;
			date1 = new Date(inYear, month, 28);
			count1 = date1.getMonth();
			numDaysMS = date1.getTime();
			flag = true;
			dayCount = 28;
			while(flag){
				numDaysMS += 86400000;
				date1.setTime(numDaysMS);
				count2 = date1.getMonth();
				if(count1 !== count2){
					flag = false; 
				}else{
					dayCount++;
				}
			}
			if(dayCount > 31){
				dayCount = 31;
			}
			return dayCount;
		};
		// This adjusts the select#dateOfBirthDay element to show the correct number of days based on the other selects
		var adjustDays = function(){
			var initialDay = $("#dobDay").val();
			$("#dobDay").html($("#dobDay").data("contents"));
			$("#dobDay").val(initialDay);
			
			var dayCount = numDays($("#dobMonth").val(), $("#dobYear").val());
			var daySet = $("#dobDay option");
			var setLength = daySet.length;
	
			for(var i = 0; i < setLength; i++){
				if($(daySet[i]).attr("value") > dayCount){
					$(daySet[i]).remove();
				}
			}
			if($("#dobDay").attr("value") > dayCount){
				$("#dobDay").attr("value", dayCount);
			}
		};
		$("#dobMonth, #dobYear").change(
			function(){
				adjustDays();
			}
		);
		$("#dobDay").data("contents", $("#dobDay").html());
		adjustDays();
	}
/* ////////// END Date adjustment scripts ////////// */

/* ********** Cookie Helpers ********** */
	function createCookie(name, value, days){
		var expires;
		if(days){
			var date = new Date();
			date.setTime(date.getTime() + (days * 24 * 60 * 60 *1000));
			expires = "; expires=" + date.toGMTString();
		}
		else{
			expires = "";
		} 
		document.cookie = name + "=" + value + expires + "; path=/";
	}
	function createSessionCookie(name, value){
		document.cookie = name + "=" + value +"; path=/";
	}
	function readCookie(name){
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0; i < ca.length; i++){
			var c = ca[i];
			while(c.charAt(0) === ' '){
				c = c.substring(1, c.length);
			} 
			if(c.indexOf(nameEQ) === 0){
				return c.substring(nameEQ.length, c.length);
			}
		}
		return null;
	}
	// The following removeCookie function works for session cookies as well as persistent cookies: 
	function removeCookie(name) {
		var value = null;
		var expires = "; expires=Thu, 01-Jan-1970 00:00:01 GMT";
		document.cookie = name + "=" + value + expires + "; path=/";
	}
/* ////////// END Cookie Helpers ////////// */

/* Array Remover */
	function removeFromArray(array, from, to) {
		var rest = array.slice((to || from) + 1 || array.length);
		array.length = from < 0 ? array.length + from : from;
		return array.push.apply(array, rest);
	}
/* END Array Remover */

/* ////////// END Miscellaneous Functions ////////// */

// 3rd Party Plugins
/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(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);
/*
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqModal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 03/01/2009 +r14
 */
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqm-overlay',
closeClass: 'jqm-close',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};

$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};

$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])L('bind');A.push(s);}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=F;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
 if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose($(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
 (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
 if(A[0]){A.pop();if(!A[0])L('unbind');}
 if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
 if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery);
/**
* jQuery Color Animations r1.0 // 2007.09.09 // jQuery 1.2.x+
* <http://plugins.jquery.com/project/color>
*/
(function(c){c.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor","borderTopColor","color","outlineColor"],function(e,d){c.fx.step[d]=function(f){if(f.state==0){f.start=b(f.elem,d);f.end=a(f.end)}f.elem.style[d]="rgb("+[Math.max(Math.min(parseInt((f.pos*(f.end[0]-f.start[0]))+f.start[0]),255),0),Math.max(Math.min(parseInt((f.pos*(f.end[1]-f.start[1]))+f.start[1]),255),0),Math.max(Math.min(parseInt((f.pos*(f.end[2]-f.start[2]))+f.start[2]),255),0)].join(",")+")"}});function a(e){var d;if(e&&e.constructor==Array&&e.length==3){return e}d=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e);if(d){return[parseInt(d[1]),parseInt(d[2]),parseInt(d[3])]}d=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e);if(d){return[parseFloat(d[1])*2.55,parseFloat(d[2])*2.55,parseFloat(d[3])*2.55]}d=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e);if(d){return[parseInt(d[1],16),parseInt(d[2],16),parseInt(d[3],16)]}d=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e);if(d){return[parseInt(d[1]+d[1],16),parseInt(d[2]+d[2],16),parseInt(d[3]+d[3],16)]}}function b(f,d){var e;while(f){e=c.curCSS(f,d);if(e!=""&&e!="transparent"||c.nodeName(f,"body")){break}d="backgroundColor";f=f.parentNode}return a(e)}})(jQuery);

/*
 * jQuery Easing v1.1.1 - http://gsgd.co.uk/sandbox/jquery.easing.php
 *
 * Uses the built in easing capabilities added in jQuery 1.1
 * to offer multiple easing options
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */
jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d)},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b}});

jQuery(document).ready(function(){ 
	$("head").append("<script src='" + $("html").data("context") + "/resources/js/main.js' type='text/javascript'></script>");
});

