﻿var _errBub_Dismiss_Id = -1;
var _pmnu_open = false;
var _tmnu_open = false;
var _pmnu_twoCol_open = false;
var _tmnu_twoCol_open = false;
var _homePageUrl = "/home/";

function /*String*/ GetRedirectLoc()
{
	var redir = "/";
	var re = $("#redirect").val();

	if (typeof __redirectTo != "undefined")
	{
		if (typeof __redirectTo != null)
		{
			if (typeof __redirectTo == "string")
			{
				if(__redirectTo.length > 0)
					redir = __redirectTo;
			}
		}
	}

	if (re != null)
	{
		if (re.length > 0)
		{
			redir = re;
		}
	}

   return redir + window.location.hash.replace(/#/g, "9E0");
}

$(window).resize(function() {
   if ($("#profileIconTwoCol").position() != null)
      $(".dropContainerTwoCol").css("left", "" + $("#profileIconTwoCol").position().left + "px");

   if ($("#profileIcon").position() != null)
      $(".dropContainer").css("left", "" + $("#profileIcon").position().left + "px");
});


$(document).one("widgetsloaded", function ()
{
   if (!(window.location.search.indexOf("redir").length > 0 || window.location.search.indexOf("ret").length > 0))
      _fbTarget = GetRedirectLoc();

   $(this).click(function (event) {
      // Hide drop-downs on body click outside of the drop down divs.
      var tcn = event.target.className;
      var tid = event.target.id;
      if (tcn !== "profileIconTwoCol" && tcn !== "myTeamsCtaTwoCol" && tid != "myTeamsLinkTwo" && tid != "myTeamsTxt") {
         if (_pmnu_twoCol_open) {
            $("#profileOptionsTwoCol").animate({ top: "-45px" }, 500, "swing", function () {
               $(".dropContainerTwoCol").hide();
            });
            _pmnu_twoCol_open = !_pmnu_twoCol_open;
         } else if (_tmnu_twoCol_open) {
            $("#myTeamsOptionTwoCol").animate({ top: "-300px" }, 500, "swing", function () {
               $(".dropContainerTwoCol").hide();
            });
            _tmnu_twoCol_open = !_tmnu_twoCol_open;
         }

      }

      if (tcn !== "profileIcon" && tcn !== "myTeamsCta" && tid != "myTeamsLinkOne" && tid != "myTeamsTxt") {
         if (_pmnu_open) {
            $("#profileOptions").animate({ top: "-85px" }, 500, "swing", function () {
               $(".dropContainer").hide();
            });
            _pmnu_open = !_pmnu_open;
         } else if (_tmnu_open) {
            $("#myTeamsOption").animate({ top: "-300px" }, 500, "swing", function () {
               $(".dropContainer").hide();
            });
            _tmnu_open = !_tmnu_open;
         }
      }
   });


   $("#logo_imageL, #logo_image").click(function () {
      window.location = _homePageUrl;
   });

   //    $(this).click(function (event) {
   //        if (event.target.className == "popUpBackground") {
   //            $(".popUpContainer").hide();
   //            $(".popUpBackground").hide();
   //            $(".popUpDialog").hide();
   //        }
   //    });

   $(".formButtons").hover(
    function () {
       $(this).fadeTo("fast", .5);
       $(this).stop(true, false);
    },
    function () {
       $(this).fadeTo("fast", 1);
    });

   $("#signInBtn").click(function () {
      attemptSignIn();
   });


   $("#pword").keydown(function (e) {
      if (e.keyCode == '13') {
         attemptSignIn();
      }
   });

   $("#errDis").click(function () {
      if (_errBub_Dismiss_Id > -1)
         clearTimeout(_errBub_Dismiss_Id);
      dismissErr();
   });


   //sign in box focus and blur 
   $(".emailInput").focus(function () {

      $(this).css({ "background-image": "url(/images/emailBgTyping.png)",
         "background-position": "1px 3px"
      });

      if ($(".pwordInput").val() !== "") {
         $(".pwordInput").css({ "background-image": "url(/images/pwordBgTyping.png)",
            "background-position": "2px 2px"
         });
      }
   });

   $(".emailInput").blur(function () {
      if ($(this).val().length <= 0) {
         $(this).css(
          {
             "background-image": "url(/images/emailBg.png)",
             "background-position": "0px 2px"
          });
      }
   });

   //sign in box focus and blur 
   $(".pwordInput").focus(function () {
      $(this).css({ "background-image": "url(/images/pwordBgTyping.png)",
         "background-position": "2px 2px"
      });

      if ($(".emailInput").val() !== "") {
         $(".emailInput").css({ "background-image": "url(/images/emailBgTyping.png)",
            "background-position": "1px 3px"
         });
      }
   });

   $(".pwordInput").blur(function () {
      if ($(this).val().length <= 0) {
         $(this).css(
          {
             "background-image": "url(/images/pwordBg.png)",
             "background-position": "2px 2px"
          });
      }
   });


   //TEAM CLICK
   $(".teamContainer").click(function () {
      window.location = "/team/news/" + $(this).attr("id").split('_')[1] + "/home/";
   });

   //DROP DOWN LIST ONE COLUMN
   $("#profileIcon").click(function () {
      $("#profileOptions").stop(true, false);

      _pmnu_open = !_pmnu_open;
      $(".dropContainer").css("left", "" + $("#profileIcon").position().left + "px");

      if (_tmnu_open) {
         $("#myTeamsOption").animate({ top: "-300px" });
         _tmnu_open = !_tmnu_open;
      }

      if (_pmnu_open) {
         $(".dropContainer").show();
         $("#primaryNav").css({ "box-shadow": "0px 2px 7px #000000" });
         $("#profileOptions").animate({ top: "0px" });
      } else {
         $("#primaryNav").css({ "box-shadow": "0px 0px 0px #000000" });
         $("#profileOptions").animate({ top: "-45px" }, 500, "swing", function () {
            $(".dropContainer").hide();
         });
      }
   });

   $("#myTeamsCta,#myTeamsLinkOne").click(function () {
      $("#myTeamsOption").stop(true, false);

      _tmnu_open = !_tmnu_open;
      $(".dropContainer").css("left", "" + $("#myTeamsLinkOne").position().left + "px");

      if (_pmnu_open) {
         $("#profileOptions").animate({ top: "-45px" });
         _pmnu_open = !_pmnu_open;
      }

      if (_tmnu_open) {
         $(".dropContainer").show();
         $("#primaryNav").css({ "box-shadow": "0px 2px 7px #000000" });
         $("#myTeamsOption").animate({ top: "-45px" });
      } else {
         $("#primaryNav").css({ "box-shadow": "0px 0px 0px #000000" });
         $("#myTeamsOption").animate({ top: "-300px" }, 500, "swing", function () {
            $(".dropContainer").hide();
         });
      }
      if ($.trim($(".myTeamsOption").text()) == "") {
         $(".myTeamsOption").html("<div class='teamAlert'>You currently do not have any teams linked. Click <a title='Find Team' class='emptyTeamLink' href='/team/search/'>Find a Team</a> to start adding teams.</div>");
      }
   });

   //DROP DOWN LIST TWO COLUMN
   $("#profileIconTwoCol").click(function () {
      $("#profileOptionsTwoCol").stop(true, false);

      _pmnu_twoCol_open = !_pmnu_twoCol_open;
      $(".dropContainerTwoCol").css("left", "" + $("#profileIconTwoCol").position().left + "px");

      if (_tmnu_twoCol_open) {
         $("#myTeamsOptionTwoCol").animate({ top: "-300px" });
         _tmnu_twoCol_open = !_tmnu_twoCol_open;
      }

      if (_pmnu_twoCol_open) {
         $(".dropContainerTwoCol").show();
         $("#primaryNav").css({ "box-shadow": "0px 2px 7px #000000" });
         $("#profileOptionsTwoCol").animate({ top: "40px" });
      } else {
         $("#primaryNav").css({ "box-shadow": "0px 0px 0px #000000" });
         $("#profileOptionsTwoCol").animate({ top: "-45px" }, 500, "swing", function () {
            $(".dropContainerTwoCol").hide();
         });
      }
   });

   $("#myTeamsCtaTwoCol,#myTeamsLinkTwo").click(function () {
      $("#myTeamsOptionTwoCol").stop(true, false);

      _tmnu_twoCol_open = !_tmnu_twoCol_open;
      $(".dropContainerTwoCol").css("left", "" + $("#myTeamsLinkTwo").position().left + "px");

      if (_pmnu_twoCol_open) {
         $("#profileOptionsTwoCol").animate({ top: "-45px" });
         _pmnu_twoCol_open = !_pmnu_twoCol_open;
      }

      if (_tmnu_twoCol_open) {
         $(".dropContainerTwoCol").show();
         $("#primaryNav").css({ "box-shadow": "0px 2px 7px #000000" });
         $("#myTeamsOptionTwoCol").animate({ top: "-45px" });
      } else {
         $("#primaryNav").css({ "box-shadow": "0px 0px 0px #000000" });
         $("#myTeamsOptionTwoCol").animate({ top: "-300px" }, 500, "swing", function () {
            $(".dropContainerTwoCol").hide();
         });
      }

      if ($.trim($(".myTeamsOptionTwoCol").text()) == "") {
         $(".myTeamsOptionTwoCol").html("<div class='teamAlert'>You currently do not have any teams linked. Click <a title='Find Team' class='emptyTeamLink' href='/team/search/'>Find a Team</a> to start adding teams.</div>");
      }
   });

   $("#signInBtn").hover(
    function () {
       $(this).fadeTo("fast", .5);
       $(this).css({ cursor: "pointer" });
       $(this).stop(true, false);
    },
    function () {
       $(this).fadeTo("fast", 1);
    });
});

function dismissErr() {
	$("#errBub").animate({ "top": "45px" }, "fast");
	_errBub_Dismiss_Id = -1;
}

function attemptSignIn() {
   $("#loginForm").submit();
   /*
	$("#signInBtn").attr("disabled", "disabled");

	var prms = [];
	prms.push({ name: "e", value: $("#email").val() });
	prms.push({ name: "p", value: $("#pword").val() });
	prms.push({ name: "rememberMe", value: $("#rememberMe").prop("checked") });
	ajax("/api/Signin.aspx", prms,
		function (r) {
			var o;
			eval("o = " + r);
			if (o.ok){				
				window.location = GetRedirectLoc();
			} else {
				$("#errBub").animate({ "top": "71px" }, "fast");
				_errBub_Dismiss_Id = setTimeout(function () { dismissErr(); }, 2500);
				$("#signInBtn").removeAttr("disabled");
				$("#email").focus();
			}
		}); */
}
﻿PopupDialog=function(){if(this._popupId="",this._suppressAlertErrors=!1,this._customControls=new Array,this._debug=!1,"function"!=typeof _MTS_JQUERY)return this._Alert("You must use jQuery!"),null},PopupDialog.prototype={_RandomIdString:function(t){for(var e,p="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz",o="",n=0;n<t;n++)e=Math.floor(Math.random()*p.length),o+=p.substring(e,e+1);return o.toString()},_Alert:function(t){this._debug&&alert(t)},_IsValidParams:function(t,e){return"string"!=typeof t||null==t?(this._Alert("You must specify a valid message!"),!1):"string"==typeof e&&null!=e||(this._Alert("You must specify a valid title!"),!1)},_IsValidJsonControl:function(t){return"object"==typeof t&&null!=t&&("string"==typeof t.id&&null!=t.id&&("string"==typeof t.type&&null!=t.type&&("string"==typeof t.name&&null!=t.name&&("string"==typeof t.text&&null!=t.text&&!(t.id.length<=0||t.type.length<=0||t.name.length<=0)))))},_StandardWireups:function(){_MTS_JQUERY(".popUpDialogButton").hover(function(){_MTS_JQUERY(this).fadeTo("fast",.5),_MTS_JQUERY(this).css({cursor:"pointer"}),_MTS_JQUERY(this).stop(!0,!1)},function(){_MTS_JQUERY(this).fadeTo("fast",1)})},_CreateElement:function(t,e,p){var o=null;return"string"!=typeof t||null==t||"object"!=typeof(o=document.createElement(t))||null==o?null:("string"==typeof e&&null!=e&&(o.id=e),"string"==typeof p&&null!=p&&(o.className=p),o)},_AddCloser:function(t,e,p){var o=this;_MTS_JQUERY("#popUpClose_"+this._popupId).click(function(){"boolean"==typeof p&&null!=p&&p&&o.Hide(),"function"==typeof t&&null!=t&&t(o,e)})},NewDialog:function(){var t,e,p,o=_MTS_JQUERY("body")[0];"object"!=typeof o&&null==o||("object"==typeof(e=_MTS_JQUERY("#popUpDialog_"+this._popupId)[0])&&null!=e&&o.removeChild(e),this._customControls=new Array,this._popupId=this._RandomIdString(15),t=this._CreateElement("i","popUpClose_"+this._popupId,"fas fa-times popUpClose"),(p=this._CreateElement("div","popUpHeader_"+this._popupId,"popUpHeader")).appendChild(this._CreateElement("div","popUpHeading_"+this._popupId,"popUpHeading")),(e=this._CreateElement("div","popUpContainer_"+this._popupId,"popUpContainer")).appendChild(t),e.appendChild(p),e.appendChild(this._CreateElement("div","popUpDescription_"+this._popupId,"popUpDescription")),e.appendChild(this._CreateElement("div","popUpControls_"+this._popupId,"popUpControls")),e.appendChild(this._CreateElement("div","popUpElements_"+this._popupId,"popUpElements")),e.appendChild(this._CreateElement("div","popUpErrors_"+this._popupId,"popUpErrors")),e.appendChild(this._CreateElement("div","popUpButtons_"+this._popupId,"popUpButtons")),e.appendChild(this._CreateElement("div","popUpFooter_"+this._popupId,"popUpFooter")),(p=this._CreateElement("div","popUpDialog_"+this._popupId,"popUpDialog")).setAttribute("style","display: none;"),p.appendChild(e),p.appendChild(this._CreateElement("div","popUpBackground_"+this._popupId,"popUpBackground")),o.appendChild(p))},Show:function(){_MTS_JQUERY("#popUpDialog_"+this._popupId).css({visibility:"hidden"}),_MTS_JQUERY("#popUpDialog_"+this._popupId).show();_MTS_JQUERY("#popUpContainer_"+this._popupId);_MTS_JQUERY("#popUpDialog_"+this._popupId).css({visibility:"visible"}),_MTS_JQUERY(function(){_MTS_JQUERY.chosen&&_MTS_JQUERY("#popUpDialog_"+this._popupId+" select").chosen()})},Hide:function(){_MTS_JQUERY("#popUpDialog_"+this._popupId).hide()},CheckContainer:function(t){var e;return"string"!=typeof t||null==t?(this._Alert("Container must be a string!"),!1):t.length<=0?(this._Alert("You must provide a value!"),!1):"."!==t.substr(0,1)&&"#"!==t.substr(0,1)?(this._Alert("Your container must begin with either a dot (.) or a pound symbol (#)!"),!1):"object"!=typeof(e=_MTS_JQUERY(t))||null==e?(this._Alert("The specified container does not exist!"),!1):!(e.length<=0)||(this._Alert("The specified container is invalid!"),!1)},GetPopupId:function(){return this._popupId},AppendError:function(t){var e=this._RandomIdString(8),p=null;"string"==typeof t&&null!=t&&"object"==typeof(p=document.getElementById("popUpErrors_"+this._popupId))&&null!=p&&(p.appendChild(this._CreateElement("div","popUpError_"+this._popupId+"_"+e,"popUpError")),_MTS_JQUERY("#popUpError_"+this._popupId+"_"+e).html(t))},ClearErrors:function(){_MTS_JQUERY("#popUpErrors_"+this._popupId).html("")},GetControlData:function(){for(var t,e=this._customControls,p={},o=0;o<e.length;o++){if(t=e[o],!this._IsValidJsonControl(t))return null;switch(p[t.name]={id:t.id,type:t.type,text:t.text,value:""},t.type){case"checkbox":p[t.name].value=_MTS_JQUERY("#"+t.id).prop("checked").toString();break;case"radio":case"text":case"password":case"email":case"textarea":case"select":p[t.name].value=_MTS_JQUERY("#"+t.id).val().toString();break;default:return null}}return p},AddButton:function(t,e,p){var o=document.getElementById("popUpButtons_"+this._popupId),n="";if("object"!=typeof o||null==o)return this._Alert("You must create a new dialog before adding buttons! "),null;if("string"!=typeof t||null==t)return this._Alert("Invalid button value!"),null;if(t.length<=0)return this._Alert("You must provide a value when adding buttons!"),null;n+="popUpButton_"+this._popupId+"_"+this._RandomIdString(8),o.appendChild(this._CreateElement("div",n,"mts_cc_button popUpButton")),_MTS_JQUERY("#"+n).html(t),this._StandardWireups();var i=this;return _MTS_JQUERY("#"+n).click(function(){"function"==typeof e&&null!=e&&e(i,i.GetControlData(),p)}),_MTS_JQUERY("#"+n)},AddControl:function(t,e,p,o,n,i,l){var s,r=document.getElementById("popUpControls_"+this._popupId),u=null,a=null;if("object"==typeof r&&null!=r)if("string"==typeof t&&null!=t)if("string"==typeof e&&null!=e)if(e.length<=0)this._Alert("You must provide a control name when adding controls!");else{switch("string"==typeof p&&null!=p||(p=""),"string"==typeof o&&null!=o||(o=""),s="control_"+this._popupId+"_"+this._RandomIdString(8),(u=this._CreateElement("div","popUpControl_"+s,"popupControl")).appendChild(this._CreateElement("div","popUpControlText_"+s,"popUpControlText")),t){case"checkbox":(a=this._CreateElement("input",s,null)).setAttribute("type","checkbox"),a.setAttribute("name",e),a.setAttribute("class","popUpControlCheckbox");break;case"radio":(a=this._CreateElement("input",s,null)).setAttribute("type","radio"),a.setAttribute("name",e),a.setAttribute("value",p),a.setAttribute("class","popUpControlRadio");break;case"text":(a=this._CreateElement("input",s,null)).setAttribute("type","text"),a.setAttribute("name",e),a.setAttribute("value",p),a.setAttribute("class","popUpControlText");break;case"password":(a=this._CreateElement("input",s,null)).setAttribute("type","password"),a.setAttribute("name",e),a.setAttribute("value",p),a.setAttribute("class","popUpControlPassword");break;case"email":(a=this._CreateElement("input",s,null)).setAttribute("type","email"),a.setAttribute("name",e),a.setAttribute("value",p),a.setAttribute("class","popUpControlEmail");break;case"textarea":(a=this._CreateElement("textarea",s,null)).setAttribute("class","popUpControlTextArea");break;case"select":(a=this._CreateElement("select",s,null)).setAttribute("name",e),a.setAttribute("class",null===l||""===l?"popUpControlSelect":l);break;default:return void this._Alert("The specified control type is not valid!")}this._customControls.push({id:s,type:t,name:e,text:o}),"object"==typeof a&&null!=a&&u.appendChild(a),r.appendChild(u),_MTS_JQUERY("#popUpControlText_"+s).html(o),"textarea"===t&&_MTS_JQUERY("#"+s).html(p),"function"==typeof n&&null!=n&&n(_MTS_JQUERY("#popUpControls_"+this._popupId),_MTS_JQUERY("#"+s),_MTS_JQUERY("#popUpControlText_"+s),i)}else this._Alert("Invalid control name!");else this._Alert("Invalid control value!");else this._Alert("You must create a new dialog before adding controls! ")},AddElement:function(t,e,p,o,n){var i,l=document.getElementById("popUpElements_"+this._popupId),s=null;if("object"==typeof l&&null!=l)if("string"==typeof t&&null!=t)if("string"==typeof e&&null!=e){switch(i="popUpElement_"+this._popupId+"_"+this._RandomIdString(8),t){case"div":s=this._CreateElement("div",i,"popupElement");break;case"divWithClass":s=this._CreateElement("div",i,n);break;default:return void this._Alert("The specified element type is not valid!")}l.appendChild(s),_MTS_JQUERY("#"+i).html(e),"function"==typeof p&&null!=p&&p(_MTS_JQUERY("#popUpElements_"+this._popupId),_MTS_JQUERY("#"+i),o)}else this._Alert("Invalid element data!");else this._Alert("Invalid element type!");else this._Alert("You must create a new dialog before adding elements! ")},AddFooter:function(t,e,p,o){var n,i=document.getElementById("popUpFooter_"+this._popupId),l=null;"object"==typeof i&&null!=i?"string"==typeof t&&null!=t?"string"==typeof e&&null!=e?(n="popUpFooter_"+this._popupId+"_"+this._RandomIdString(8),"div"===t?(l=this._CreateElement("div",n,"popUpFooter"),i.appendChild(l),_MTS_JQUERY("#"+n).html(e),"function"==typeof p&&null!=p&&p(_MTS_JQUERY("#popUpFooter_"+this._popupId),_MTS_JQUERY("#"+n),o)):this._Alert("The specified element type is not valid!")):this._Alert("Invalid element data!"):this._Alert("Invalid element type!"):this._Alert("You must create a new dialog before adding elements! ")},NewCustomDialog:function(t,e,p,o,n){this._IsValidParams(t,e)&&(this.NewDialog(),_MTS_JQUERY("#popUpHeading_"+this._popupId).html(e),_MTS_JQUERY("#popUpDescription_"+this._popupId).html(t),this._AddCloser(o,n,!1),this._StandardWireups(),"function"==typeof p&&null!=p&&p())},NewOkayAlert:function(t,e,p,o,n,i){var l,s=this;this._IsValidParams(t,e)&&(this.NewDialog(),_MTS_JQUERY("#popUpHeading_"+this._popupId).html(e),_MTS_JQUERY("#popUpDescription_"+this._popupId).html(t),l=this.AddButton("Okay",function(){s.Hide(),"function"==typeof o&&null!=o&&o(s,n)},null),this._AddCloser(o,n,!0),this._StandardWireups(),(i="boolean"!=typeof i||null==i?!0:i)&&this.Show(),"function"==typeof p&&null!=p&&p(_MTS_JQUERY("#popUpContainer_"+this._popupId.toString()),_MTS_JQUERY("#popUpDescription_"+this._popupId),l))},NewYesNoPrompt:function(t,e,p,o,n,i){var l=this;this._IsValidParams(t,e)&&(this.NewDialog(),_MTS_JQUERY("#popUpHeading_"+this._popupId).html(e),_MTS_JQUERY("#popUpDescription_"+this._popupId).html(t),this.AddButton("Yes",function(){l.Hide(),"function"==typeof o&&null!=o&&o(!0,l,n)},null),this.AddButton("No",function(){l.Hide(),"function"==typeof o&&null!=o&&o(!1,l,n)},null),this._AddCloser(function(){"function"==typeof o&&null!=o&&o(!1,l,n)},null,!0),l._StandardWireups(),(i="boolean"!=typeof i||null==i?!0:i)&&l.Show(),"function"==typeof p&&null!=p&&p())}};
﻿var tTimer,tRefresh;function refreshSession(){$.post("/api/refreshSession.aspx",null,function(e){"success"==e&&(tRefresh=setTimeout("refreshSession()",_timeout))}).fail(function(){$("#tStatus").html(),$("#timeout").slideDown("fast"),startCountdown(_sessionTimeout-_timeout)})}function startCountdown(e){0<e?tTimer=setTimeout(function(){$("#tTimer").html(e/1e3),startCountdown(e-1e3)},1e3):$(".tText").html("Your session has expired and any changes made may not be saved.")}$(document).one("widgetsloaded",function(){13!=_portalId&&14!=_portalId&&15!=_portalId||$("#user_container").css({width:"100%"}),$(".myProfile").click(function(){window.location="/user/edit/"}),$("#navReg").click(function(){location="/user/register/"}),$("#tRenew").click(function(){var t=$("#tStatus");t.html(""),$.post("/api/refreshSession.aspx",null,function(e){"success"==e&&(window.clearTimeout(tRefresh),window.clearTimeout(tTimer),tRefresh=setTimeout("refreshSession()",_timeout),t.html("Success!"),t.css("color","green"),setTimeout(function(){$("#timeout").css("display","none")},600))}).fail(function(){t.html("Failed!"),t.css("color","red")})}),tRefresh=setTimeout("refreshSession()",_timeout)});
﻿_MTS_JQUERY(document).one("widgetsloaded",function(){var o,_,s,e,t=_MTS_JQUERY(".msw");0<t.length&&(o=t.position().top,_MTS_JQUERY(window).scroll(function(){_MTS_JQUERY(window).scrollTop()>=o?t.addClass("snapIt"):t.removeClass("snapIt")}),_=_MTS_JQUERY(".msScroller"),s=_MTS_JQUERY(".msBtn"),e=0,_MTS_JQUERY(".msgr").css({left:_MTS_JQUERY(window).width()-20+"px"}),s.each(function(){e+=_MTS_JQUERY(this).outerWidth()}),_.width(e+"px"),$(window).resize(function(){_.width(e+"px")}),_MTS_JQUERY(".mobileSelectors").scroll(function(){var o,_;_MTS_JQUERY(".mobileSelectors").scrollLeft()>_MTS_JQUERY(".msBtn").outerWidth()?(o=_MTS_JQUERY(".msgl")).show():(o=_MTS_JQUERY(".msgl")).hide(),_MTS_JQUERY(".mobileSelectors").scrollLeft()+$(".mobileSelectors").outerWidth()==$(".msScroller").outerWidth()?(_=_MTS_JQUERY(".msgr"),o=_MTS_JQUERY(".msgl"),_.hide(),o.show()):(_=_MTS_JQUERY(".msgr")).show()}))});
﻿
function trackItem(itemIdToTrack, itemTagTypeToTrack)
{
   var params = [];
   params.push({ name: "id", value: itemIdToTrack });
   params.push({ name: "tagType", value: itemTagTypeToTrack });
   //params.push({ name: "tagIdList", value: tagIdList });
   ajax("/api/tracking.aspx", params, function () { });
}
﻿
function trackItem(itemIdToTrack, itemTagTypeToTrack)
{
   var params = [];
   params.push({ name: "id", value: itemIdToTrack });
   params.push({ name: "tagType", value: itemTagTypeToTrack });
   //params.push({ name: "tagIdList", value: tagIdList });
   ajax("/api/tracking.aspx", params, function () { });
}
﻿var _loadedCat=[],_wiredUp=!1,_maxResults=15,_currentSeed=0,_currentSearchVal="",_selectedMenu="",_searched=[],_searchInProgress=!1,_curPage=0,_searchedEv=[],_searchEvProgress=!1,_curEvPage=0,_searchId=-1,_declinedTags=[],_slideTimeout=null,_isSliding=!1;function initTag(){if(!_hasJQuery||!_hasCal)return!1;_wiredUp||(wireSelect(),_cal.initialize())}function wireSelect(){_wiredUp=!0,_MTS_JQUERY(document).on("click",".fullLink",function(e){var t,a=_MTS_JQUERY(this).parents(".result");a.hasClass("highlightTag")||(a.addClass("highlightTag"),_isSliding||(_isSliding=!0,(t=a.parents(".search_widget").find(".tagConfirmation")).slideToggle(400,function(){_slideTimeout=null,_slideTimeout=setTimeout(function(){t.slideToggle(),_isSliding=!1},2e3)})))}),_MTS_JQUERY(document).on(_event,".tagSelect, .teamTagSelect",function(e){e.stopPropagation();var e=this.id.split("_")[0]+"_",t=_MTS_JQUERY.trim(this.innerHTML);if(null!=(r=GetIdFrom(e,this.id)))switch(e){case"entry_":selectTag(_MTS_SITEURL+"team/schedule/details/"+_teamId+"/"+_teamUrlName+"/"+r+"/",t,r,"ScheduleEvent");break;case"team_":var a=_MTS_JQUERY(this).parents(".typeSelect");"typeTeam"==a.attr("id")?selectTag(_MTS_SITEURL+"teamProfile.aspx?id="+r,t,r,"Team"):((n=[]).push({name:"teamId",value:_searchId=r}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/getSchoolSportByTeam.aspx",n,function(e){e.ok&&(_schoolUrlName=e.schoolUrlName,_sportUrlName=e.sportUrlName,toggleNext(a[0]))}));break;case"Sports_":selectTag(_MTS_SITEURL+"?m=1&sm="+r,t,r,"Sport");break;case"Schools_":selectTag(_MTS_SITEURL+"school/"+r+"/"+$.urlName(t)+"/",t,r,"School");break;case"Leagues_":selectTag(_MTS_SITEURL+"league/"+r+"/"+$.urlName(t)+"/",t,r,"League");break;case"event_":var n=r.split("_")[1],r=r.split("_")[0];1==n?selectTag(_MTS_SITEURL+"master/event/"+r+"/",t,r,"MasterEvent"):selectTag(_MTS_SITEURL+"event/"+r+"/",t,r,"PortalEvent");break;case"sch_":selectSch(_MTS_JQUERY(this));break;case"Roster_":selectTag(_MTS_SITEURL+"roster/player/"+_schoolUrlName+"-"+_sportUrlName+"/"+$.urlName(t)+"/"+_searchId+"/"+r,t,r,"Roster");break;case"Videos_":selectTag(_MTS_SITEURL+"team/photos/"+_searchId+"/team/",t,r,"Video");break;case"pv_":selectTag(_MTS_SITEURL+"video/player/"+r+"/"+$.urlName(t),t,r,"PortalVideo");break;case"pl_":selectSch(_MTS_JQUERY(this));break;case"Albums_":selectTag(_MTS_SITEURL+"albums/"+$.urlName(t)+"/"+r+"/",t,r,"PhotoAlbum");break;case"Categories_":selectTag("javascript:void(0);",t,r,"Category");break;case"Subcategories_":selectTag("javascript:void(0);",t,r,"Subcategory")}}),_MTS_JQUERY(document).on(_event,".tagBtn",function(e){e.stopPropagation(),toggleBack(this)}),_MTS_JQUERY(document).on(_event,".typeSelect",function(e){e.stopPropagation();e=this;"none"!=_MTS_JQUERY(e).find(".tTitle").css("display")&&(_selectedMenu=e.id,"Existing Photos"!=_MTS_JQUERY(e).children(".tTitle").html()&&(_MTS_JQUERY(".typeSelect").hide(),_MTS_JQUERY(e).show()),"typePhoto"!=e.id?toggleNext(e):togglePhoto())}),_MTS_JQUERY(document).on("mouseenter mouseleave",".tagSelect",function(){var e;this.clientWidth<this.scrollWidth&&(e="<div class='eHover'>"+_MTS_JQUERY.trim(this.innerHTML)+"</div>",_MTS_JQUERY(this).parent().append(e),_MTS_JQUERY(".eHover").css({top:this.offsetTop+40+"px",left:this.offsetLeft+40+"px"}))}).on("mouseout",".tagSelect",function(){_MTS_JQUERY(".eHover").remove()}),_MTS_JQUERY(document).delegate("#searchBar","keyup",function(){performSearch()}),_MTS_JQUERY(document).delegate(".sDateInput, .eDateInput","click",function(){var n=this;_MTS_JQUERY(n).val(""),GetMiniCalendar("select","Date Range",function(e,t,a){_MTS_JQUERY(n).val(e.toString()+"/"+t.toString()+"/"+a.toString())})}),_MTS_JQUERY(document).delegate("#searchTeams","click",function(){SearchByTeam(0,_MTS_JQUERY(this).parents(".finalSelectContainer"))}),_MTS_JQUERY(document).delegate(".tNext","click",function(){SearchByTeam(_curPage+1,_MTS_JQUERY(this).parents(".finalSelectContainer"))}),_MTS_JQUERY(document).delegate(".tPrev","click",function(){0<_curPage&&SearchByTeam(_curPage-1,_MTS_JQUERY(this).parents(".finalSelectContainer"))}),_MTS_JQUERY(document).delegate("#searchEvents","click",function(){SearchByEvent(0,_MTS_JQUERY(this).parents(".finalSelectContainer"))}),_MTS_JQUERY(document).delegate("#eNext","click",function(){SearchByEvent(_curEvPage+1,_MTS_JQUERY(this).parents(".finalSelectContainer"))}),_MTS_JQUERY(document).delegate("#ePrev","click",function(){0<_curEvPage&&SearchByEvent(_curEvPage-1,_MTS_JQUERY(this).parents(".finalSelectContainer"))})}function SearchByEvent(a,e){if(0==_searchEvProgress){_searchEvProgress=!0,_curEvPage=a,_MTS_JQUERY("#searchActiveEv").show();var n="typeEvent",r=_MTS_JQUERY("#eventSportFilter").val(),i=_MTS_JQUERY("#eventLevelFilter").val(),l=_MTS_JQUERY("#eventLeagueFilter").val(),s=_MTS_JQUERY("#searchBar").val(),c=_MTS_JQUERY("input[name=genderEv]:checked").val(),_=_MTS_JQUERY(".sDateInput").val(),o=_MTS_JQUERY(".eDateInput").val(),d=_MTS_JQUERY("#homeTeamFilter").val(),h=_MTS_JQUERY("#awayTeamFilter").val(),t=e.parents(".typeSelect").attr("id"),e=FindSearchEv(n,r,i,l,s,c,_,o,d,h,a);if(0<=e&&(CacheSearch(n),0<=(e=_searchedEv[e].end?FindSearchEv(n,r,i,l,s,c,_,o,d,h,a-1):e)))return LoadBySearched(e,n,t),_searchEvProgress=!1,_MTS_JQUERY("#searchActiveEv").hide(),!1;t=[];t.push({name:"type",value:n}),t.push({name:"sport",value:r}),t.push({name:"level",value:i}),t.push({name:"league",value:l}),t.push({name:"name",value:s}),t.push({name:"gender",value:c}),t.push({name:"from",value:0<a?15*a:1}),t.push({name:"to",value:15*a+(0<a?14:15)}),t.push({name:"homeTeam",value:d}),t.push({name:"awayTeam",value:h}),t.push({name:"start",value:_}),t.push({name:"end",value:o}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/getTagSelectCat.aspx",t,function(e){var t;e.ok&&(CacheSearch(n),t=!1,0<=e.tagSelect.indexOf("No Results Found")&&(t=!0),_MTS_JQUERY("<div id='"+n+"_"+_searchedEv.length+"' class='cache'>"+e.tagSelect+"</div>").insertBefore(_MTS_JQUERY("#"+n).find(".finalSelectContainer .buttonContainer")),_searchedEv.push({type:n,sport:r,level:i,league:l,phrase:s,gender:c,dtStart:_,dtEnd:o,homeTeam:d,awayTeam:h,page:a,end:t})),_searchEvProgress=!1,_MTS_JQUERY("#searchActiveEv").hide()})}}function SearchByTeam(n,e){if(0==_searchInProgress){_searchInProgress=!0,_curPage=n;var r="typeTeam",i=e.parents(".typeSelect").attr("id"),l=i.substr(4),s=e.find("#sportFilter").val(),c=e.find("#levelFilter").val(),_=e.find("#leagueFilter").val(),o=_MTS_JQUERY("#searchBar").val(),d=_MTS_JQUERY("input[name=gender"+l+"]:checked").val();_MTS_JQUERY("#searchActive"+l).show();e=FindSearch(r,s,c,_,o,d,n);if(0<=e&&(CacheSearch(i),0<=(e=_searched[e].end?FindSearch(r,s,c,_,o,d,n-1):e)))return LoadBySearched(e,r,i),_searchInProgress=!1,_MTS_JQUERY("#searchActive"+l).hide(),!1;e=[];e.push({name:"type",value:r},{name:"sport",value:s},{name:"level",value:c},{name:"league",value:_},{name:"name",value:o},{name:"gender",value:d},{name:"from",value:0<n?15*n:1},{name:"to",value:15*n+(0<n?14:15)}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/getTagSelectCat.aspx",e,function(e){var t,a;e.ok&&(CacheSearch(i),t=!1,""==e.tagSelect?(t=!0,0<=(a=FindSearch(r,s,c,_,o,d,n-1))&&LoadBySearched(a,r,i)):(_MTS_JQUERY("<div id='"+r+"_"+_searched.length+"' class='cache'>"+e.tagSelect+"</div>").insertBefore(_MTS_JQUERY("#"+i).find(".finalSelectContainer .buttonContainer")),_MTS_JQUERY(i+" .teamConSel").html(_MTS_JQUERY(i+" .teamConSel .tContainer").sort(function(e,t){e=_MTS_JQUERY(e).find(".tagSelect").html(),t=_MTS_JQUERY(t).find(".tagSelect").html();return e==t?0:e<t?-1:1}))),_searched.push({type:r,sport:s,level:c,league:_,phrase:o,gender:d,page:n,end:t}),CacheSearch(i,!0)),_searchInProgress=!1,_MTS_JQUERY("#searchActive"+l).hide()})}}function FindSearch(e,t,a,n,r,i,l){for(var s=_searched.length-1;0<=s;s--)if(_searched[s].type==e&&_searched[s].sport==t&&_searched[s].level==a&&_searched[s].league==n&&_searched[s].phrase==r&&_searched[s].gender==i&&_searched[s].page==l)return s;return-1}function FindSearchEv(e,t,a,n,r,i,l,s,c,_,o){for(var d=_searchedEv.length-1;0<=d;d--)if(_searchedEv[d].type==e&&_searchedEv[d].sport==t&&_searchedEv[d].level==a&&_searchedEv[d].league==n&&_searchedEv[d].phrase==r&&_searchedEv[d].gender==i&&_searchedEv[d].dtStart==l&&_searchedEv[d].dtEnd==s&&_searchedEv[d].homeTeam==c&&_searchedEv[d].awayTeam==_&&_searchedEv[d].page==o)return d;return-1}function LoadBySearched(e,t,a){_MTS_JQUERY("#cache").find("#"+t+"_"+e).clone().insertBefore(_MTS_JQUERY("#"+a).find(".finalSelectContainer .buttonContainer")),"typeEvent"!=t?_curPage=_searched[e].page:_curEvPage=_searchedEv[e].page}function CacheSearch(e,t){null==t&&(t=!1);var a=_MTS_JQUERY("#cache");0==a.length&&(_MTS_JQUERY("body").append("<div id='cache' style='display: none'></div>"),a=_MTS_JQUERY("#cache"));var n=_MTS_JQUERY("#"+e).find(".cache"),r=0<n.length?n.attr("id"):-1;if(0<n.length){for(var i=0,l=a.children().length;i<l;i++)if(a.children()[i].id==r)return t||n.remove(),!1;(t?n.clone():n).appendTo(a)}}function performSearch(){var l=Date.now;_currentSeed=l,setTimeout(function(){if(l!=_currentSeed)return!1;var t,e=_MTS_JQUERY("#searchBar").val();if(_MTS_JQUERY(".finalSelectContainer").each(function(){var e=_MTS_JQUERY(this);if("none"!=e.css("display"))return t=e.find(".tagSelect"),!1}),null==t||0==t.length)return!1;var a=_MTS_JQUERY(t[0]).parent().attr("class");if("tContainer"==a||"eventContainer"==a)return!1;var n=t.length-1;t.css("display","none");do{var r=t[n],i=_MTS_JQUERY.trim(r.innerHTML.toLowerCase())}while((""==e||0<=i.indexOf(e.toLowerCase()))&&(r.style.display="block"),n--)},200)}function togglePhoto(){window.parent.tinyMCE.activeEditor.windowManager.open({file:"/mce/imageSel.aspx?id="+_teamId,width:450,height:300,inline:1},{plugin_url:"/"})}function toggleNext(t){for(var e,a=!1,n=("typeRoster"==t.id||"typePlayer"==t.id||"typeVideos"==t.id)&&0<_searchId,r=t.id+"_"+_searchId,i=_loadedCat.length-1;0<=i;i--)if(_loadedCat[i]==t.id&&!n||n&&_loadedCat[i]==r){a=!0;break}a||"typeSch"==t.id||"typeTeam"==t.id||"typeEvent"==t.id||(n||"typeRoster"==t.id||"typePlayer"==t.id||"typeVideos"==t.id)&&!n?n?(TargetByTeam(t),_MTS_JQUERY("#"+r).show()):NextAction(t):(_loadedCat.push(n?r:t.id),(e=[]).push({name:"type",value:t.id}),e.push({name:"isPortal",value:_isPortalTag}),e.push({name:"searchId",value:_searchId}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/getTagSelectCat.aspx",e,function(e){e.ok&&(n&&(e.tagSelect="<div id='"+r+"' class='searched'>"+e.tagSelect+"</div>",TargetByTeam(t)),_MTS_JQUERY(e.tagSelect).insertBefore(_MTS_JQUERY(t).find(".finalSelectContainer .buttonContainer")),n||NextAction(t))}))}function TargetByTeam(e){var t=_MTS_JQUERY("#searchBar");0<t.val().length&&(t.val(""),performSearch("")),_MTS_JQUERY("#sBarTitle").html("Type name of "+("typeRoster"==e.id||"typePlayer"==e.id?"player":"video")+" to narrow results:"),_MTS_JQUERY(e).find(".filterOptions, .tNext, .tPrev, .cache, .searched").hide()}function NextAction(e){var t=_MTS_JQUERY(e).find(".firstSelectContainer"),a=_MTS_JQUERY(e).find(".finalSelectContainer"),n=_MTS_JQUERY(".tTitle"),r=_MTS_JQUERY(".sBar"),i=_MTS_JQUERY("#sBarTitle");switch(_MTS_JQUERY("#selCat").hide(),"typeEvent"!=e.id&&"typeSch"!=e.id&&r.show(),e.id){case"typePortalVideos":case"typePlayer":case"typeRoster":case"typeVideos":case"typeTeam":i.html("Enter team name to narrow search:");break;case"typeSports":i.html("Type name of sport to narrow results:");break;case"typeLeagues":i.html("Type name of league to narrow results:");break;case"typeSchools":i.html("Type name of school to narrow results:");break;case"typeCategories":i.html("Type name of the category/subcategory to narrow results:")}switch("none"!=n.css("display")&&0<t.length?t.show():(t.hide(),a.show(),a.children().show()),ToggleCustomDropdowns(),n.hide(),_MTS_JQUERY(e).find(".buttonContainer")[0].style.display="block",performSearch(_MTS_JQUERY("#searchBar").val()),_MTS_JQUERY(".searched").hide(),e.id){case"typeRoster":case"typeVideos":var l=getTagsByType("Team");if($("#typeTeam_-1").remove(),CacheSearch(e.id),0<l.length){for(var s="<div id='typeTeam_-1' class='cache'>",c=l.length-1;0<=c;c--)s+="<div class='tContainer'><div id='team_"+l[c].id.split("_")[2]+"' class='teamTagSelect'>"+$.trim(_MTS_JQUERY(l[c]).find(".tagTitle").html())+"</div></div>";s+="</div>",$(s).insertBefore(_MTS_JQUERY("#"+e.id).find(".finalSelectContainer .buttonContainer"))}}}function toggleBack(e){_MTS_JQUERY(".sBar").hide(),_MTS_JQUERY(".searched").hide(),_MTS_JQUERY(".tPrev, .tNext").show(),_MTS_JQUERY("#searchBar").val("");var t=_MTS_JQUERY(e).parent().parent(),e=0<t.filter(":visible").length;t.hide(),"firstSelectContainer"!=t.attr("class")&&0!=t.parent().parent().find(".firstSelectContainer").length&&e?(_MTS_JQUERY(".sBar").show(),t.parent().parent().find(".firstSelectContainer").show()):(_MTS_JQUERY(".tTitle").show(),_MTS_JQUERY("#selCat").show()),_MTS_JQUERY(".typeSelect").hide(),_MTS_JQUERY("#"+_selectedMenu).show(),_MTS_JQUERY(".tTitle").each(function(){"none"!==_MTS_JQUERY(this).css("display")&&_MTS_JQUERY(this).parent().show()}),_searchId=-1}function selectSch(e){e.parent().parent().find(".scheduleContainer").each(function(){this.id.split("_")[1]==e.attr("id").split("_")[1]?this.style.display="block":this.style.display="none"}),e.parent().hide(),e.parent().parent().find(".finalSelectContainer").show(),e.parent().parent().find(".buttonContainer")[1].style.display="block"}function findTag(e,t){for(var a=window.parent,n=_MTS_JQUERY(a.document.getElementsByClassName("tagContainer")[0]).find(".tagBlock, .imageTag"),r=0;r<n.length;r++){var i=n[r],l=i.id.split("_")[1];if(null!=i.id&&"tag"==i.id.split("_")[0]&&l==e&&i.id.split("_")[2]==t)return!0;if(l==t&&(i=_MTS_JQUERY(i)).children("input")[0].value==e)return!0}if("undefined"!=typeof _currentImage&&"object"!=typeof _currentImage)for(r=0;r<_currentImage.links.length;r++)if(_currentImage.links[r].linkId==t&&_currentImage.links[r].tagType==e)return!0;return!1}function getTagsByType(e){for(var t=window.parent,a=_MTS_JQUERY(t.document.getElementsByClassName("tagContainer")[0]).find(".tagBlock, .imageTag"),n=[],r=0;r<a.length;r++){var i=a[r],l=i.id.split("_")[1];null!=i.id&&"tag"==i.id.split("_")[0]&&l==e&&n.push(i)}if("undefined"!=typeof _currentImage&&"object"!=typeof _currentImage)for(r=0;r<_currentImage.links.length;r++)_currentImage.links[r].tagType==e&&n.push(_currentImage.links[r]);return n}function selectTag(e,t,a,n){var r,i=window.parent,l=i.document.getElementsByClassName("tagContainer")[0],s='<a href="'+e+'" data-mce-href="'+e+'">'+unescape(t)+"</a>";0<_MTS_JQUERY(l).length?findTag(n,a)||(r=(l.childNodes.length<1?"<div class='portalText'>Current Tags</div>":"")+"<div class='tagBlock' id='tag_"+a+"'><div class='tagTitle'>"+unescape(t)+"</div><div class='tagOptions'><div class='mts_cc_button tagButton' id='tagAdd_"+a+"'>Add Link</div><img class='tagButton' id='tagRem_"+a+"' src='"+_mediaUrl+"images/gratsClose.png' title='remove' /></div><input type='hidden' id='linkType_"+a+"' value='"+n+"' /></div>",_MTS_JQUERY(l).append(r),i.WireUpTag(a,s,n),_MTS_JQUERY(i.document.getElementsByClassName("noTagsYet")).hide(),(_MTS_JQUERY(i.document.getElementById("useAutoTagger")).length<0||!_MTS_JQUERY(i.document.getElementById("useAutoTagger")).prop("checked"))&&("undefined"!=typeof _DoNotSuggestRelated&&_DoNotSuggestRelated||FindRelatedTag(a,n))):"function"==typeof i.AddTagHtml&&i.AddTagHtml(a,t,s,n),null==i.tinymce||"boolean"==typeof i._autoLink&&!i._autoLink||("Image"!=n?i.tinymce.execCommand("mceInsertContent",!1,"PortalVideo"==n?"<iframe src='/api/getPortalVideoPlayer.aspx?videoId="+a+"' frameborder='0' allowFullScreen='true' webkitallowfullscreen='true' mozallowfullscreen='true' width='100%' height='450px' scrolling='no'></iframe>":s):i.insertPhotoCaptionTable(a,'<img src="'+e+'" alt="[Image]" />'))}function FindRelatedTag(id,type){var p=[];p.push({name:"id",value:id}),p.push({name:"type",value:type}),ajax("/api/getRelatedTags.aspx",p,function(ret){var o;eval("o = "+ret),0<o.tags.length&&SuggestTags(o.tags)})}function SuggestTags(e){for(var t,a=e.length-1;0<=a;a--)findTag(e[a].type,e[a].id)||isDeclinedTag(e[a])||(null!=(t=confirm("Would you like to add "+e[a].title+" ("+e[a].type+") as a tag to this story?"))&&t?selectTag(e[a].link,e[a].title,e[a].id,e[a].type):_declinedTags.push(e[a]))}function isDeclinedTag(e){for(var t=_declinedTags.length-1;0<=t;t--)if(e.id==_declinedTags[t].id&&e.type==_declinedTags[t].type)return!0;return!1}function GetMiniCalendar(e,t,a,n){var r=new Date;_cal.clearRecycle(),_cal.mode=e,_cal.wndTitle=t,_cal.setContract(r.getFullYear()-1,0,0),_cal.maxYear=_cal.startContractYear+5,_cal.setCallback(a),_cal.setSelection(r.getMonth()+1,r.getDate(),r.getFullYear()),_cal.show(100,100),_MTS_JQUERY(".listingBg").css({height:_MTS_JQUERY(document).height(),zIndex:113}),_MTS_JQUERY(".listingBg").show()}function GetIdFrom(e,t){if("string"!=typeof e||null==e)return null;if("string"!=typeof t||null==t)return null;if(e.length>=t.length)return null;var a=null;try{a=t.substring(e.length)}catch(e){return null}return a}
﻿var _TIMING_=1e4,_ajax_map=[];function ajax(n,a,t,e,o,r,i){if(null==e&&(e="POST"),!0!==i&&(i=!1),Date.now||(Date.now=function(){return(new Date).valueOf()}),void 0===_ajax_map&&(_ajax_map=[]),!i)for(var l=Date.now(),u=0;u<_ajax_map.length;u++)if(_ajax_map[u].Url==n)if(Date.now()-_ajax_map[u].Time<_TIMING_)return;_ajax_map.push(new ajaxMapEntry(n,l));var _=createAjax();_.onreadystatechange=function(){if(4==_.readyState&&200==_.status){for(var a=-1,e=0;e<_ajax_map.length;e++)if(_ajax_map[e].Url==n){a=e;break}-1<a&&_ajax_map.splice(a,1),"function"==typeof t&&null!=t&&t(_.responseText),null!=o&&"undefined"!=o&&("function"!=typeof o?console.log("An error occurred calling next().\nUrl: "+n+"\ndata: "+data):o())}},("undefined"!=typeof event&&event.which||"boolean"==typeof _MTS_ajaxPending&&_MTS_ajaxPending)&&(_.onloadstart=function(){MTS_startAjax()},_.onloadend=function(){MTS_endAjax(),_MTS_ajaxPending=!1});for(var p="ajax=1",u=0;u<a.length;u++)p+="&"+a[u].name+"="+encodeURIComponent(a[u].value);return"GET"==e?_.open("GET",n+"?"+p,!0):(_.open("POST",n+(null==r||r?"?"+Date.now()+"=r":""),!0),_.setRequestHeader("Content-type","application/x-www-form-urlencoded")),_.send(p),_}function createAjax(){var a=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest;if(null!=a)return a;alert("Your browser does not support the functionality to complete this request.")}function ajaxMapEntry(a,e){this.Url=a,this.Time=e}
﻿/*! jQuery UI - v1.11.1 - 2014-10-07
* http://jqueryui.com
* Includes: core.js, widget.js, mouse.js, resizable.js, sortable.js, slider.js
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */

(function (e) { "function" == typeof define && define.amd ? define(["jquery"], e) : e(typeof _MTS_JQUERY !== 'undefined' ? _MTS_JQUERY : jQuery) })(function (e)
{
   function t(t, s) { var n, a, o, r = t.nodeName.toLowerCase(); return "area" === r ? (n = t.parentNode, a = n.name, t.href && a && "map" === n.nodeName.toLowerCase() ? (o = e("img[usemap='#" + a + "']")[0], !!o && i(o)) : !1) : (/input|select|textarea|button|object/.test(r) ? !t.disabled : "a" === r ? t.href || s : s) && i(t) } function i(t) { return e.expr.filters.visible(t) && !e(t).parents().addBack().filter(function () { return "hidden" === e.css(this, "visibility") }).length } e.ui = e.ui || {}, e.extend(e.ui, { version: "1.11.1", keyCode: { BACKSPACE: 8, COMMA: 188, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, LEFT: 37, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SPACE: 32, TAB: 9, UP: 38} }), e.fn.extend({ scrollParent: function (t) { var i = this.css("position"), s = "absolute" === i, n = t ? /(auto|scroll|hidden)/ : /(auto|scroll)/, a = this.parents().filter(function () { var t = e(this); return s && "static" === t.css("position") ? !1 : n.test(t.css("overflow") + t.css("overflow-y") + t.css("overflow-x")) }).eq(0); return "fixed" !== i && a.length ? a : e(this[0].ownerDocument || document) }, uniqueId: function () { var e = 0; return function () { return this.each(function () { this.id || (this.id = "ui-id-" + ++e) }) } } (), removeUniqueId: function () { return this.each(function () { /^ui-id-\d+$/.test(this.id) && e(this).removeAttr("id") }) } }), e.extend(e.expr[":"], { data: e.expr.createPseudo ? e.expr.createPseudo(function (t) { return function (i) { return !!e.data(i, t) } }) : function (t, i, s) { return !!e.data(t, s[3]) }, focusable: function (i) { return t(i, !isNaN(e.attr(i, "tabindex"))) }, tabbable: function (i) { var s = e.attr(i, "tabindex"), n = isNaN(s); return (n || s >= 0) && t(i, !n) } }), e("<a>").outerWidth(1).jquery || e.each(["Width", "Height"], function (t, i) { function s(t, i, s, a) { return e.each(n, function () { i -= parseFloat(e.css(t, "padding" + this)) || 0, s && (i -= parseFloat(e.css(t, "border" + this + "Width")) || 0), a && (i -= parseFloat(e.css(t, "margin" + this)) || 0) }), i } var n = "Width" === i ? ["Left", "Right"] : ["Top", "Bottom"], a = i.toLowerCase(), o = { innerWidth: e.fn.innerWidth, innerHeight: e.fn.innerHeight, outerWidth: e.fn.outerWidth, outerHeight: e.fn.outerHeight }; e.fn["inner" + i] = function (t) { return void 0 === t ? o["inner" + i].call(this) : this.each(function () { e(this).css(a, s(this, t) + "px") }) }, e.fn["outer" + i] = function (t, n) { return "number" != typeof t ? o["outer" + i].call(this, t) : this.each(function () { e(this).css(a, s(this, t, !0, n) + "px") }) } }), e.fn.addBack || (e.fn.addBack = function (e) { return this.add(null == e ? this.prevObject : this.prevObject.filter(e)) }), e("<a>").data("a-b", "a").removeData("a-b").data("a-b") && (e.fn.removeData = function (t) { return function (i) { return arguments.length ? t.call(this, e.camelCase(i)) : t.call(this) } } (e.fn.removeData)), e.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()), e.fn.extend({ focus: function (t) { return function (i, s) { return "number" == typeof i ? this.each(function () { var t = this; setTimeout(function () { e(t).focus(), s && s.call(t) }, i) }) : t.apply(this, arguments) } } (e.fn.focus), disableSelection: function () { var e = "onselectstart" in document.createElement("div") ? "selectstart" : "mousedown"; return function () { return this.bind(e + ".ui-disableSelection", function (e) { e.preventDefault() }) } } (), enableSelection: function () { return this.unbind(".ui-disableSelection") }, zIndex: function (t) { if (void 0 !== t) return this.css("zIndex", t); if (this.length) for (var i, s, n = e(this[0]); n.length && n[0] !== document; ) { if (i = n.css("position"), ("absolute" === i || "relative" === i || "fixed" === i) && (s = parseInt(n.css("zIndex"), 10), !isNaN(s) && 0 !== s)) return s; n = n.parent() } return 0 } }), e.ui.plugin = { add: function (t, i, s) { var n, a = e.ui[t].prototype; for (n in s) a.plugins[n] = a.plugins[n] || [], a.plugins[n].push([i, s[n]]) }, call: function (e, t, i, s) { var n, a = e.plugins[t]; if (a && (s || e.element[0].parentNode && 11 !== e.element[0].parentNode.nodeType)) for (n = 0; a.length > n; n++) e.options[a[n][0]] && a[n][1].apply(e.element, i) } }; var s = 0, n = Array.prototype.slice; e.cleanData = function (t) { return function (i) { var s, n, a; for (a = 0; null != (n = i[a]); a++) try { s = e._data(n, "events"), s && s.remove && e(n).triggerHandler("remove") } catch (o) { } t(i) } } (e.cleanData), e.widget = function (t, i, s) { var n, a, o, r, h = {}, l = t.split(".")[0]; return t = t.split(".")[1], n = l + "-" + t, s || (s = i, i = e.Widget), e.expr[":"][n.toLowerCase()] = function (t) { return !!e.data(t, n) }, e[l] = e[l] || {}, a = e[l][t], o = e[l][t] = function (e, t) { return this._createWidget ? (arguments.length && this._createWidget(e, t), void 0) : new o(e, t) }, e.extend(o, a, { version: s.version, _proto: e.extend({}, s), _childConstructors: [] }), r = new i, r.options = e.widget.extend({}, r.options), e.each(s, function (t, s) { return e.isFunction(s) ? (h[t] = function () { var e = function () { return i.prototype[t].apply(this, arguments) }, n = function (e) { return i.prototype[t].apply(this, e) }; return function () { var t, i = this._super, a = this._superApply; return this._super = e, this._superApply = n, t = s.apply(this, arguments), this._super = i, this._superApply = a, t } } (), void 0) : (h[t] = s, void 0) }), o.prototype = e.widget.extend(r, { widgetEventPrefix: a ? r.widgetEventPrefix || t : t }, h, { constructor: o, namespace: l, widgetName: t, widgetFullName: n }), a ? (e.each(a._childConstructors, function (t, i) { var s = i.prototype; e.widget(s.namespace + "." + s.widgetName, o, i._proto) }), delete a._childConstructors) : i._childConstructors.push(o), e.widget.bridge(t, o), o }, e.widget.extend = function (t) { for (var i, s, a = n.call(arguments, 1), o = 0, r = a.length; r > o; o++) for (i in a[o]) s = a[o][i], a[o].hasOwnProperty(i) && void 0 !== s && (t[i] = e.isPlainObject(s) ? e.isPlainObject(t[i]) ? e.widget.extend({}, t[i], s) : e.widget.extend({}, s) : s); return t }, e.widget.bridge = function (t, i) { var s = i.prototype.widgetFullName || t; e.fn[t] = function (a) { var o = "string" == typeof a, r = n.call(arguments, 1), h = this; return a = !o && r.length ? e.widget.extend.apply(null, [a].concat(r)) : a, o ? this.each(function () { var i, n = e.data(this, s); return "instance" === a ? (h = n, !1) : n ? e.isFunction(n[a]) && "_" !== a.charAt(0) ? (i = n[a].apply(n, r), i !== n && void 0 !== i ? (h = i && i.jquery ? h.pushStack(i.get()) : i, !1) : void 0) : e.error("no such method '" + a + "' for " + t + " widget instance") : e.error("cannot call methods on " + t + " prior to initialization; " + "attempted to call method '" + a + "'") }) : this.each(function () { var t = e.data(this, s); t ? (t.option(a || {}), t._init && t._init()) : e.data(this, s, new i(a, this)) }), h } }, e.Widget = function () { }, e.Widget._childConstructors = [], e.Widget.prototype = { widgetName: "widget", widgetEventPrefix: "", defaultElement: "<div>", options: { disabled: !1, create: null }, _createWidget: function (t, i) { i = e(i || this.defaultElement || this)[0], this.element = e(i), this.uuid = s++, this.eventNamespace = "." + this.widgetName + this.uuid, this.options = e.widget.extend({}, this.options, this._getCreateOptions(), t), this.bindings = e(), this.hoverable = e(), this.focusable = e(), i !== this && (e.data(i, this.widgetFullName, this), this._on(!0, this.element, { remove: function (e) { e.target === i && this.destroy() } }), this.document = e(i.style ? i.ownerDocument : i.document || i), this.window = e(this.document[0].defaultView || this.document[0].parentWindow)), this._create(), this._trigger("create", null, this._getCreateEventData()), this._init() }, _getCreateOptions: e.noop, _getCreateEventData: e.noop, _create: e.noop, _init: e.noop, destroy: function () { this._destroy(), this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)), this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName + "-disabled " + "ui-state-disabled"), this.bindings.unbind(this.eventNamespace), this.hoverable.removeClass("ui-state-hover"), this.focusable.removeClass("ui-state-focus") }, _destroy: e.noop, widget: function () { return this.element }, option: function (t, i) { var s, n, a, o = t; if (0 === arguments.length) return e.widget.extend({}, this.options); if ("string" == typeof t) if (o = {}, s = t.split("."), t = s.shift(), s.length) { for (n = o[t] = e.widget.extend({}, this.options[t]), a = 0; s.length - 1 > a; a++) n[s[a]] = n[s[a]] || {}, n = n[s[a]]; if (t = s.pop(), 1 === arguments.length) return void 0 === n[t] ? null : n[t]; n[t] = i } else { if (1 === arguments.length) return void 0 === this.options[t] ? null : this.options[t]; o[t] = i } return this._setOptions(o), this }, _setOptions: function (e) { var t; for (t in e) this._setOption(t, e[t]); return this }, _setOption: function (e, t) { return this.options[e] = t, "disabled" === e && (this.widget().toggleClass(this.widgetFullName + "-disabled", !!t), t && (this.hoverable.removeClass("ui-state-hover"), this.focusable.removeClass("ui-state-focus"))), this }, enable: function () { return this._setOptions({ disabled: !1 }) }, disable: function () { return this._setOptions({ disabled: !0 }) }, _on: function (t, i, s) { var n, a = this; "boolean" != typeof t && (s = i, i = t, t = !1), s ? (i = n = e(i), this.bindings = this.bindings.add(i)) : (s = i, i = this.element, n = this.widget()), e.each(s, function (s, o) { function r() { return t || a.options.disabled !== !0 && !e(this).hasClass("ui-state-disabled") ? ("string" == typeof o ? a[o] : o).apply(a, arguments) : void 0 } "string" != typeof o && (r.guid = o.guid = o.guid || r.guid || e.guid++); var h = s.match(/^([\w:-]*)\s*(.*)$/), l = h[1] + a.eventNamespace, u = h[2]; u ? n.delegate(u, l, r) : i.bind(l, r) }) }, _off: function (e, t) { t = (t || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace, e.unbind(t).undelegate(t) }, _delay: function (e, t) { function i() { return ("string" == typeof e ? s[e] : e).apply(s, arguments) } var s = this; return setTimeout(i, t || 0) }, _hoverable: function (t) { this.hoverable = this.hoverable.add(t), this._on(t, { mouseenter: function (t) { e(t.currentTarget).addClass("ui-state-hover") }, mouseleave: function (t) { e(t.currentTarget).removeClass("ui-state-hover") } }) }, _focusable: function (t) { this.focusable = this.focusable.add(t), this._on(t, { focusin: function (t) { e(t.currentTarget).addClass("ui-state-focus") }, focusout: function (t) { e(t.currentTarget).removeClass("ui-state-focus") } }) }, _trigger: function (t, i, s) { var n, a, o = this.options[t]; if (s = s || {}, i = e.Event(i), i.type = (t === this.widgetEventPrefix ? t : this.widgetEventPrefix + t).toLowerCase(), i.target = this.element[0], a = i.originalEvent) for (n in a) n in i || (i[n] = a[n]); return this.element.trigger(i, s), !(e.isFunction(o) && o.apply(this.element[0], [i].concat(s)) === !1 || i.isDefaultPrevented()) } }, e.each({ show: "fadeIn", hide: "fadeOut" }, function (t, i) { e.Widget.prototype["_" + t] = function (s, n, a) { "string" == typeof n && (n = { effect: n }); var o, r = n ? n === !0 || "number" == typeof n ? i : n.effect || i : t; n = n || {}, "number" == typeof n && (n = { duration: n }), o = !e.isEmptyObject(n), n.complete = a, n.delay && s.delay(n.delay), o && e.effects && e.effects.effect[r] ? s[t](n) : r !== t && s[r] ? s[r](n.duration, n.easing, a) : s.queue(function (i) { e(this)[t](), a && a.call(s[0]), i() }) } }), e.widget; var a = !1; e(document).mouseup(function () { a = !1 }), e.widget("ui.mouse", { version: "1.11.1", options: { cancel: "input,textarea,button,select,option", distance: 1, delay: 0 }, _mouseInit: function () { var t = this; this.element.bind("mousedown." + this.widgetName, function (e) { return t._mouseDown(e) }).bind("click." + this.widgetName, function (i) { return !0 === e.data(i.target, t.widgetName + ".preventClickEvent") ? (e.removeData(i.target, t.widgetName + ".preventClickEvent"), i.stopImmediatePropagation(), !1) : void 0 }), this.started = !1 }, _mouseDestroy: function () { this.element.unbind("." + this.widgetName), this._mouseMoveDelegate && this.document.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate) }, _mouseDown: function (t) { if (!a) { this._mouseStarted && this._mouseUp(t), this._mouseDownEvent = t; var i = this, s = 1 === t.which, n = "string" == typeof this.options.cancel && t.target.nodeName ? e(t.target).closest(this.options.cancel).length : !1; return s && !n && this._mouseCapture(t) ? (this.mouseDelayMet = !this.options.delay, this.mouseDelayMet || (this._mouseDelayTimer = setTimeout(function () { i.mouseDelayMet = !0 }, this.options.delay)), this._mouseDistanceMet(t) && this._mouseDelayMet(t) && (this._mouseStarted = this._mouseStart(t) !== !1, !this._mouseStarted) ? (t.preventDefault(), !0) : (!0 === e.data(t.target, this.widgetName + ".preventClickEvent") && e.removeData(t.target, this.widgetName + ".preventClickEvent"), this._mouseMoveDelegate = function (e) { return i._mouseMove(e) }, this._mouseUpDelegate = function (e) { return i._mouseUp(e) }, this.document.bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate), t.preventDefault(), a = !0, !0)) : !0 } }, _mouseMove: function (t) { return e.ui.ie && (!document.documentMode || 9 > document.documentMode) && !t.button ? this._mouseUp(t) : t.which ? this._mouseStarted ? (this._mouseDrag(t), t.preventDefault()) : (this._mouseDistanceMet(t) && this._mouseDelayMet(t) && (this._mouseStarted = this._mouseStart(this._mouseDownEvent, t) !== !1, this._mouseStarted ? this._mouseDrag(t) : this._mouseUp(t)), !this._mouseStarted) : this._mouseUp(t) }, _mouseUp: function (t) { return this.document.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate), this._mouseStarted && (this._mouseStarted = !1, t.target === this._mouseDownEvent.target && e.data(t.target, this.widgetName + ".preventClickEvent", !0), this._mouseStop(t)), a = !1, !1 }, _mouseDistanceMet: function (e) { return Math.max(Math.abs(this._mouseDownEvent.pageX - e.pageX), Math.abs(this._mouseDownEvent.pageY - e.pageY)) >= this.options.distance }, _mouseDelayMet: function () { return this.mouseDelayMet }, _mouseStart: function () { }, _mouseDrag: function () { }, _mouseStop: function () { }, _mouseCapture: function () { return !0 } }), e.widget("ui.resizable", e.ui.mouse, { version: "1.11.1", widgetEventPrefix: "resize", options: { alsoResize: !1, animate: !1, animateDuration: "slow", animateEasing: "swing", aspectRatio: !1, autoHide: !1, containment: !1, ghost: !1, grid: !1, handles: "e,s,se", helper: !1, maxHeight: null, maxWidth: null, minHeight: 10, minWidth: 10, zIndex: 90, resize: null, start: null, stop: null }, _num: function (e) { return parseInt(e, 10) || 0 }, _isNumber: function (e) { return !isNaN(parseInt(e, 10)) }, _hasScroll: function (t, i) { if ("hidden" === e(t).css("overflow")) return !1; var s = i && "left" === i ? "scrollLeft" : "scrollTop", n = !1; return t[s] > 0 ? !0 : (t[s] = 1, n = t[s] > 0, t[s] = 0, n) }, _create: function () { var t, i, s, n, a, o = this, r = this.options; if (this.element.addClass("ui-resizable"), e.extend(this, { _aspectRatio: !!r.aspectRatio, aspectRatio: r.aspectRatio, originalElement: this.element, _proportionallyResizeElements: [], _helper: r.helper || r.ghost || r.animate ? r.helper || "ui-resizable-helper" : null }), this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i) && (this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({ position: this.element.css("position"), width: this.element.outerWidth(), height: this.element.outerHeight(), top: this.element.css("top"), left: this.element.css("left") })), this.element = this.element.parent().data("ui-resizable", this.element.resizable("instance")), this.elementIsWrapper = !0, this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") }), this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0 }), this.originalResizeStyle = this.originalElement.css("resize"), this.originalElement.css("resize", "none"), this._proportionallyResizeElements.push(this.originalElement.css({ position: "static", zoom: 1, display: "block" })), this.originalElement.css({ margin: this.originalElement.css("margin") }), this._proportionallyResize()), this.handles = r.handles || (e(".ui-resizable-handle", this.element).length ? { n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw"} : "e,s,se"), this.handles.constructor === String) for ("all" === this.handles && (this.handles = "n,e,s,w,se,sw,ne,nw"), t = this.handles.split(","), this.handles = {}, i = 0; t.length > i; i++) s = e.trim(t[i]), a = "ui-resizable-" + s, n = e("<div class='ui-resizable-handle " + a + "'></div>"), n.css({ zIndex: r.zIndex }), "se" === s && n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"), this.handles[s] = ".ui-resizable-" + s, this.element.append(n); this._renderAxis = function (t) { var i, s, n, a; t = t || this.element; for (i in this.handles) this.handles[i].constructor === String && (this.handles[i] = this.element.children(this.handles[i]).first().show()), this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i) && (s = e(this.handles[i], this.element), a = /sw|ne|nw|se|n|s/.test(i) ? s.outerHeight() : s.outerWidth(), n = ["padding", /ne|nw|n/.test(i) ? "Top" : /se|sw|s/.test(i) ? "Bottom" : /^e$/.test(i) ? "Right" : "Left"].join(""), t.css(n, a), this._proportionallyResize()), e(this.handles[i]).length }, this._renderAxis(this.element), this._handles = e(".ui-resizable-handle", this.element).disableSelection(), this._handles.mouseover(function () { o.resizing || (this.className && (n = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)), o.axis = n && n[1] ? n[1] : "se") }), r.autoHide && (this._handles.hide(), e(this.element).addClass("ui-resizable-autohide").mouseenter(function () { r.disabled || (e(this).removeClass("ui-resizable-autohide"), o._handles.show()) }).mouseleave(function () { r.disabled || o.resizing || (e(this).addClass("ui-resizable-autohide"), o._handles.hide()) })), this._mouseInit() }, _destroy: function () { this._mouseDestroy(); var t, i = function (t) { e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove() }; return this.elementIsWrapper && (i(this.element), t = this.element, this.originalElement.css({ position: t.css("position"), width: t.outerWidth(), height: t.outerHeight(), top: t.css("top"), left: t.css("left") }).insertAfter(t), t.remove()), this.originalElement.css("resize", this.originalResizeStyle), i(this.originalElement), this }, _mouseCapture: function (t) { var i, s, n = !1; for (i in this.handles) s = e(this.handles[i])[0], (s === t.target || e.contains(s, t.target)) && (n = !0); return !this.options.disabled && n }, _mouseStart: function (t) { var i, s, n, a = this.options, o = this.element; return this.resizing = !0, this._renderProxy(), i = this._num(this.helper.css("left")), s = this._num(this.helper.css("top")), a.containment && (i += e(a.containment).scrollLeft() || 0, s += e(a.containment).scrollTop() || 0), this.offset = this.helper.offset(), this.position = { left: i, top: s }, this.size = this._helper ? { width: this.helper.width(), height: this.helper.height()} : { width: o.width(), height: o.height() }, this.originalSize = this._helper ? { width: o.outerWidth(), height: o.outerHeight()} : { width: o.width(), height: o.height() }, this.sizeDiff = { width: o.outerWidth() - o.width(), height: o.outerHeight() - o.height() }, this.originalPosition = { left: i, top: s }, this.originalMousePosition = { left: t.pageX, top: t.pageY }, this.aspectRatio = "number" == typeof a.aspectRatio ? a.aspectRatio : this.originalSize.width / this.originalSize.height || 1, n = e(".ui-resizable-" + this.axis).css("cursor"), e("body").css("cursor", "auto" === n ? this.axis + "-resize" : n), o.addClass("ui-resizable-resizing"), this._propagate("start", t), !0 }, _mouseDrag: function (t) { var i, s, n = this.originalMousePosition, a = this.axis, o = t.pageX - n.left || 0, r = t.pageY - n.top || 0, h = this._change[a]; return this._updatePrevProperties(), h ? (i = h.apply(this, [t, o, r]), this._updateVirtualBoundaries(t.shiftKey), (this._aspectRatio || t.shiftKey) && (i = this._updateRatio(i, t)), i = this._respectSize(i, t), this._updateCache(i), this._propagate("resize", t), s = this._applyChanges(), !this._helper && this._proportionallyResizeElements.length && this._proportionallyResize(), e.isEmptyObject(s) || (this._updatePrevProperties(), this._trigger("resize", t, this.ui()), this._applyChanges()), !1) : !1 }, _mouseStop: function (t) { this.resizing = !1; var i, s, n, a, o, r, h, l = this.options, u = this; return this._helper && (i = this._proportionallyResizeElements, s = i.length && /textarea/i.test(i[0].nodeName), n = s && this._hasScroll(i[0], "left") ? 0 : u.sizeDiff.height, a = s ? 0 : u.sizeDiff.width, o = { width: u.helper.width() - a, height: u.helper.height() - n }, r = parseInt(u.element.css("left"), 10) + (u.position.left - u.originalPosition.left) || null, h = parseInt(u.element.css("top"), 10) + (u.position.top - u.originalPosition.top) || null, l.animate || this.element.css(e.extend(o, { top: h, left: r })), u.helper.height(u.size.height), u.helper.width(u.size.width), this._helper && !l.animate && this._proportionallyResize()), e("body").css("cursor", "auto"), this.element.removeClass("ui-resizable-resizing"), this._propagate("stop", t), this._helper && this.helper.remove(), !1 }, _updatePrevProperties: function () { this.prevPosition = { top: this.position.top, left: this.position.left }, this.prevSize = { width: this.size.width, height: this.size.height} }, _applyChanges: function () { var e = {}; return this.position.top !== this.prevPosition.top && (e.top = this.position.top + "px"), this.position.left !== this.prevPosition.left && (e.left = this.position.left + "px"), this.size.width !== this.prevSize.width && (e.width = this.size.width + "px"), this.size.height !== this.prevSize.height && (e.height = this.size.height + "px"), this.helper.css(e), e }, _updateVirtualBoundaries: function (e) { var t, i, s, n, a, o = this.options; a = { minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0, maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : 1 / 0, minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0, maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : 1 / 0 }, (this._aspectRatio || e) && (t = a.minHeight * this.aspectRatio, s = a.minWidth / this.aspectRatio, i = a.maxHeight * this.aspectRatio, n = a.maxWidth / this.aspectRatio, t > a.minWidth && (a.minWidth = t), s > a.minHeight && (a.minHeight = s), a.maxWidth > i && (a.maxWidth = i), a.maxHeight > n && (a.maxHeight = n)), this._vBoundaries = a }, _updateCache: function (e) { this.offset = this.helper.offset(), this._isNumber(e.left) && (this.position.left = e.left), this._isNumber(e.top) && (this.position.top = e.top), this._isNumber(e.height) && (this.size.height = e.height), this._isNumber(e.width) && (this.size.width = e.width) }, _updateRatio: function (e) { var t = this.position, i = this.size, s = this.axis; return this._isNumber(e.height) ? e.width = e.height * this.aspectRatio : this._isNumber(e.width) && (e.height = e.width / this.aspectRatio), "sw" === s && (e.left = t.left + (i.width - e.width), e.top = null), "nw" === s && (e.top = t.top + (i.height - e.height), e.left = t.left + (i.width - e.width)), e }, _respectSize: function (e) { var t = this._vBoundaries, i = this.axis, s = this._isNumber(e.width) && t.maxWidth && t.maxWidth < e.width, n = this._isNumber(e.height) && t.maxHeight && t.maxHeight < e.height, a = this._isNumber(e.width) && t.minWidth && t.minWidth > e.width, o = this._isNumber(e.height) && t.minHeight && t.minHeight > e.height, r = this.originalPosition.left + this.originalSize.width, h = this.position.top + this.size.height, l = /sw|nw|w/.test(i), u = /nw|ne|n/.test(i); return a && (e.width = t.minWidth), o && (e.height = t.minHeight), s && (e.width = t.maxWidth), n && (e.height = t.maxHeight), a && l && (e.left = r - t.minWidth), s && l && (e.left = r - t.maxWidth), o && u && (e.top = h - t.minHeight), n && u && (e.top = h - t.maxHeight), e.width || e.height || e.left || !e.top ? e.width || e.height || e.top || !e.left || (e.left = null) : e.top = null, e }, _getPaddingPlusBorderDimensions: function (e) { for (var t = 0, i = [], s = [e.css("borderTopWidth"), e.css("borderRightWidth"), e.css("borderBottomWidth"), e.css("borderLeftWidth")], n = [e.css("paddingTop"), e.css("paddingRight"), e.css("paddingBottom"), e.css("paddingLeft")]; 4 > t; t++) i[t] = parseInt(s[t], 10) || 0, i[t] += parseInt(n[t], 10) || 0; return { height: i[0] + i[2], width: i[1] + i[3]} }, _proportionallyResize: function () { if (this._proportionallyResizeElements.length) for (var e, t = 0, i = this.helper || this.element; this._proportionallyResizeElements.length > t; t++) e = this._proportionallyResizeElements[t], this.outerDimensions || (this.outerDimensions = this._getPaddingPlusBorderDimensions(e)), e.css({ height: i.height() - this.outerDimensions.height || 0, width: i.width() - this.outerDimensions.width || 0 }) }, _renderProxy: function () { var t = this.element, i = this.options; this.elementOffset = t.offset(), this._helper ? (this.helper = this.helper || e("<div style='overflow:hidden;'></div>"), this.helper.addClass(this._helper).css({ width: this.element.outerWidth() - 1, height: this.element.outerHeight() - 1, position: "absolute", left: this.elementOffset.left + "px", top: this.elementOffset.top + "px", zIndex: ++i.zIndex }), this.helper.appendTo("body").disableSelection()) : this.helper = this.element }, _change: { e: function (e, t) { return { width: this.originalSize.width + t} }, w: function (e, t) { var i = this.originalSize, s = this.originalPosition; return { left: s.left + t, width: i.width - t} }, n: function (e, t, i) { var s = this.originalSize, n = this.originalPosition; return { top: n.top + i, height: s.height - i} }, s: function (e, t, i) { return { height: this.originalSize.height + i} }, se: function (t, i, s) { return e.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [t, i, s])) }, sw: function (t, i, s) { return e.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [t, i, s])) }, ne: function (t, i, s) { return e.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [t, i, s])) }, nw: function (t, i, s) { return e.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [t, i, s])) } }, _propagate: function (t, i) { e.ui.plugin.call(this, t, [i, this.ui()]), "resize" !== t && this._trigger(t, i, this.ui()) }, plugins: {}, ui: function () { return { originalElement: this.originalElement, element: this.element, helper: this.helper, position: this.position, size: this.size, originalSize: this.originalSize, originalPosition: this.originalPosition} } }), e.ui.plugin.add("resizable", "animate", { stop: function (t) { var i = e(this).resizable("instance"), s = i.options, n = i._proportionallyResizeElements, a = n.length && /textarea/i.test(n[0].nodeName), o = a && i._hasScroll(n[0], "left") ? 0 : i.sizeDiff.height, r = a ? 0 : i.sizeDiff.width, h = { width: i.size.width - r, height: i.size.height - o }, l = parseInt(i.element.css("left"), 10) + (i.position.left - i.originalPosition.left) || null, u = parseInt(i.element.css("top"), 10) + (i.position.top - i.originalPosition.top) || null; i.element.animate(e.extend(h, u && l ? { top: u, left: l} : {}), { duration: s.animateDuration, easing: s.animateEasing, step: function () { var s = { width: parseInt(i.element.css("width"), 10), height: parseInt(i.element.css("height"), 10), top: parseInt(i.element.css("top"), 10), left: parseInt(i.element.css("left"), 10) }; n && n.length && e(n[0]).css({ width: s.width, height: s.height }), i._updateCache(s), i._propagate("resize", t) } }) } }), e.ui.plugin.add("resizable", "containment", { start: function () { var t, i, s, n, a, o, r, h = e(this).resizable("instance"), l = h.options, u = h.element, d = l.containment, c = d instanceof e ? d.get(0) : /parent/.test(d) ? u.parent().get(0) : d; c && (h.containerElement = e(c), /document/.test(d) || d === document ? (h.containerOffset = { left: 0, top: 0 }, h.containerPosition = { left: 0, top: 0 }, h.parentData = { element: e(document), left: 0, top: 0, width: e(document).width(), height: e(document).height() || document.body.parentNode.scrollHeight }) : (t = e(c), i = [], e(["Top", "Right", "Left", "Bottom"]).each(function (e, s) { i[e] = h._num(t.css("padding" + s)) }), h.containerOffset = t.offset(), h.containerPosition = t.position(), h.containerSize = { height: t.innerHeight() - i[3], width: t.innerWidth() - i[1] }, s = h.containerOffset, n = h.containerSize.height, a = h.containerSize.width, o = h._hasScroll(c, "left") ? c.scrollWidth : a, r = h._hasScroll(c) ? c.scrollHeight : n, h.parentData = { element: c, left: s.left, top: s.top, width: o, height: r })) }, resize: function (t) { var i, s, n, a, o = e(this).resizable("instance"), r = o.options, h = o.containerOffset, l = o.position, u = o._aspectRatio || t.shiftKey, d = { top: 0, left: 0 }, c = o.containerElement, p = !0; c[0] !== document && /static/.test(c.css("position")) && (d = h), l.left < (o._helper ? h.left : 0) && (o.size.width = o.size.width + (o._helper ? o.position.left - h.left : o.position.left - d.left), u && (o.size.height = o.size.width / o.aspectRatio, p = !1), o.position.left = r.helper ? h.left : 0), l.top < (o._helper ? h.top : 0) && (o.size.height = o.size.height + (o._helper ? o.position.top - h.top : o.position.top), u && (o.size.width = o.size.height * o.aspectRatio, p = !1), o.position.top = o._helper ? h.top : 0), n = o.containerElement.get(0) === o.element.parent().get(0), a = /relative|absolute/.test(o.containerElement.css("position")), n && a ? (o.offset.left = o.parentData.left + o.position.left, o.offset.top = o.parentData.top + o.position.top) : (o.offset.left = o.element.offset().left, o.offset.top = o.element.offset().top), i = Math.abs(o.sizeDiff.width + (o._helper ? o.offset.left - d.left : o.offset.left - h.left)), s = Math.abs(o.sizeDiff.height + (o._helper ? o.offset.top - d.top : o.offset.top - h.top)), i + o.size.width >= o.parentData.width && (o.size.width = o.parentData.width - i, u && (o.size.height = o.size.width / o.aspectRatio, p = !1)), s + o.size.height >= o.parentData.height && (o.size.height = o.parentData.height - s, u && (o.size.width = o.size.height * o.aspectRatio, p = !1)), p || (o.position.left = o.prevPosition.left, o.position.top = o.prevPosition.top, o.size.width = o.prevSize.width, o.size.height = o.prevSize.height) }, stop: function () { var t = e(this).resizable("instance"), i = t.options, s = t.containerOffset, n = t.containerPosition, a = t.containerElement, o = e(t.helper), r = o.offset(), h = o.outerWidth() - t.sizeDiff.width, l = o.outerHeight() - t.sizeDiff.height; t._helper && !i.animate && /relative/.test(a.css("position")) && e(this).css({ left: r.left - n.left - s.left, width: h, height: l }), t._helper && !i.animate && /static/.test(a.css("position")) && e(this).css({ left: r.left - n.left - s.left, width: h, height: l }) } }), e.ui.plugin.add("resizable", "alsoResize", { start: function () { var t = e(this).resizable("instance"), i = t.options, s = function (t) { e(t).each(function () { var t = e(this); t.data("ui-resizable-alsoresize", { width: parseInt(t.width(), 10), height: parseInt(t.height(), 10), left: parseInt(t.css("left"), 10), top: parseInt(t.css("top"), 10) }) }) }; "object" != typeof i.alsoResize || i.alsoResize.parentNode ? s(i.alsoResize) : i.alsoResize.length ? (i.alsoResize = i.alsoResize[0], s(i.alsoResize)) : e.each(i.alsoResize, function (e) { s(e) }) }, resize: function (t, i) { var s = e(this).resizable("instance"), n = s.options, a = s.originalSize, o = s.originalPosition, r = { height: s.size.height - a.height || 0, width: s.size.width - a.width || 0, top: s.position.top - o.top || 0, left: s.position.left - o.left || 0 }, h = function (t, s) { e(t).each(function () { var t = e(this), n = e(this).data("ui-resizable-alsoresize"), a = {}, o = s && s.length ? s : t.parents(i.originalElement[0]).length ? ["width", "height"] : ["width", "height", "top", "left"]; e.each(o, function (e, t) { var i = (n[t] || 0) + (r[t] || 0); i && i >= 0 && (a[t] = i || null) }), t.css(a) }) }; "object" != typeof n.alsoResize || n.alsoResize.nodeType ? h(n.alsoResize) : e.each(n.alsoResize, function (e, t) { h(e, t) }) }, stop: function () { e(this).removeData("resizable-alsoresize") } }), e.ui.plugin.add("resizable", "ghost", { start: function () { var t = e(this).resizable("instance"), i = t.options, s = t.size; t.ghost = t.originalElement.clone(), t.ghost.css({ opacity: .25, display: "block", position: "relative", height: s.height, width: s.width, margin: 0, left: 0, top: 0 }).addClass("ui-resizable-ghost").addClass("string" == typeof i.ghost ? i.ghost : ""), t.ghost.appendTo(t.helper) }, resize: function () { var t = e(this).resizable("instance"); t.ghost && t.ghost.css({ position: "relative", height: t.size.height, width: t.size.width }) }, stop: function () { var t = e(this).resizable("instance"); t.ghost && t.helper && t.helper.get(0).removeChild(t.ghost.get(0)) } }), e.ui.plugin.add("resizable", "grid", { resize: function () { var t, i = e(this).resizable("instance"), s = i.options, n = i.size, a = i.originalSize, o = i.originalPosition, r = i.axis, h = "number" == typeof s.grid ? [s.grid, s.grid] : s.grid, l = h[0] || 1, u = h[1] || 1, d = Math.round((n.width - a.width) / l) * l, c = Math.round((n.height - a.height) / u) * u, p = a.width + d, f = a.height + c, m = s.maxWidth && p > s.maxWidth, g = s.maxHeight && f > s.maxHeight, v = s.minWidth && s.minWidth > p, y = s.minHeight && s.minHeight > f; s.grid = h, v && (p += l), y && (f += u), m && (p -= l), g && (f -= u), /^(se|s|e)$/.test(r) ? (i.size.width = p, i.size.height = f) : /^(ne)$/.test(r) ? (i.size.width = p, i.size.height = f, i.position.top = o.top - c) : /^(sw)$/.test(r) ? (i.size.width = p, i.size.height = f, i.position.left = o.left - d) : ((0 >= f - u || 0 >= p - l) && (t = i._getPaddingPlusBorderDimensions(this)), f - u > 0 ? (i.size.height = f, i.position.top = o.top - c) : (f = u - t.height, i.size.height = f, i.position.top = o.top + a.height - f), p - l > 0 ? (i.size.width = p, i.position.left = o.left - d) : (p = u - t.height, i.size.width = p, i.position.left = o.left + a.width - p)) } }), e.ui.resizable, e.widget("ui.sortable", e.ui.mouse, { version: "1.11.1", widgetEventPrefix: "sort", ready: !1, options: { appendTo: "parent", axis: !1, connectWith: !1, containment: !1, cursor: "auto", cursorAt: !1, dropOnEmpty: !0, forcePlaceholderSize: !1, forceHelperSize: !1, grid: !1, handle: !1, helper: "original", items: "> *", opacity: !1, placeholder: !1, revert: !1, scroll: !0, scrollSensitivity: 20, scrollSpeed: 20, scope: "default", tolerance: "intersect", zIndex: 1e3, activate: null, beforeStop: null, change: null, deactivate: null, out: null, over: null, receive: null, remove: null, sort: null, start: null, stop: null, update: null }, _isOverAxis: function (e, t, i) { return e >= t && t + i > e }, _isFloating: function (e) { return /left|right/.test(e.css("float")) || /inline|table-cell/.test(e.css("display")) }, _create: function ()
   {
      var e = this.options; this.containerCache = {}, this.element.addClass("ui-sortable"), this.refresh(), this.floating = this.items.length ? "x" === e.axis || this._isFloating(this.items[0].item) : !1, this.offset = this.element.offset(), this._mouseInit(), this._setHandleClassName(), this.ready = !0
   }, _setOption: function (e, t) { this._super(e, t), "handle" === e && this._setHandleClassName() }, _setHandleClassName: function () { this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"), e.each(this.items, function () { (this.instance.options.handle ? this.item.find(this.instance.options.handle) : this.item).addClass("ui-sortable-handle") }) }, _destroy: function () { this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"), this._mouseDestroy(); for (var e = this.items.length - 1; e >= 0; e--) this.items[e].item.removeData(this.widgetName + "-item"); return this }, _mouseCapture: function (t, i) { var s = null, n = !1, a = this; return this.reverting ? !1 : this.options.disabled || "static" === this.options.type ? !1 : (this._refreshItems(t), e(t.target).parents().each(function () { return e.data(this, a.widgetName + "-item") === a ? (s = e(this), !1) : void 0 }), e.data(t.target, a.widgetName + "-item") === a && (s = e(t.target)), s ? !this.options.handle || i || (e(this.options.handle, s).find("*").addBack().each(function () { this === t.target && (n = !0) }), n) ? (this.currentItem = s, this._removeCurrentsFromItems(), !0) : !1 : !1) }, _mouseStart: function (t, i, s) { var n, a, o = this.options; if (this.currentContainer = this, this.refreshPositions(), this.helper = this._createHelper(t), this._cacheHelperProportions(), this._cacheMargins(), this.scrollParent = this.helper.scrollParent(), this.offset = this.currentItem.offset(), this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }, e.extend(this.offset, { click: { left: t.pageX - this.offset.left, top: t.pageY - this.offset.top }, parent: this._getParentOffset(), relative: this._getRelativeOffset() }), this.helper.css("position", "absolute"), this.cssPosition = this.helper.css("position"), this.originalPosition = this._generatePosition(t), this.originalPageX = t.pageX, this.originalPageY = t.pageY, o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt), this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }, this.helper[0] !== this.currentItem[0] && this.currentItem.hide(), this._createPlaceholder(), o.containment && this._setContainment(), o.cursor && "auto" !== o.cursor && (a = this.document.find("body"), this.storedCursor = a.css("cursor"), a.css("cursor", o.cursor), this.storedStylesheet = e("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(a)), o.opacity && (this.helper.css("opacity") && (this._storedOpacity = this.helper.css("opacity")), this.helper.css("opacity", o.opacity)), o.zIndex && (this.helper.css("zIndex") && (this._storedZIndex = this.helper.css("zIndex")), this.helper.css("zIndex", o.zIndex)), this.scrollParent[0] !== document && "HTML" !== this.scrollParent[0].tagName && (this.overflowOffset = this.scrollParent.offset()), this._trigger("start", t, this._uiHash()), this._preserveHelperProportions || this._cacheHelperProportions(), !s) for (n = this.containers.length - 1; n >= 0; n--) this.containers[n]._trigger("activate", t, this._uiHash(this)); return e.ui.ddmanager && (e.ui.ddmanager.current = this), e.ui.ddmanager && !o.dropBehaviour && e.ui.ddmanager.prepareOffsets(this, t), this.dragging = !0, this.helper.addClass("ui-sortable-helper"), this._mouseDrag(t), !0 }, _mouseDrag: function (t) { var i, s, n, a, o = this.options, r = !1; for (this.position = this._generatePosition(t), this.positionAbs = this._convertPositionTo("absolute"), this.lastPositionAbs || (this.lastPositionAbs = this.positionAbs), this.options.scroll && (this.scrollParent[0] !== document && "HTML" !== this.scrollParent[0].tagName ? (this.overflowOffset.top + this.scrollParent[0].offsetHeight - t.pageY < o.scrollSensitivity ? this.scrollParent[0].scrollTop = r = this.scrollParent[0].scrollTop + o.scrollSpeed : t.pageY - this.overflowOffset.top < o.scrollSensitivity && (this.scrollParent[0].scrollTop = r = this.scrollParent[0].scrollTop - o.scrollSpeed), this.overflowOffset.left + this.scrollParent[0].offsetWidth - t.pageX < o.scrollSensitivity ? this.scrollParent[0].scrollLeft = r = this.scrollParent[0].scrollLeft + o.scrollSpeed : t.pageX - this.overflowOffset.left < o.scrollSensitivity && (this.scrollParent[0].scrollLeft = r = this.scrollParent[0].scrollLeft - o.scrollSpeed)) : (t.pageY - e(document).scrollTop() < o.scrollSensitivity ? r = e(document).scrollTop(e(document).scrollTop() - o.scrollSpeed) : e(window).height() - (t.pageY - e(document).scrollTop()) < o.scrollSensitivity && (r = e(document).scrollTop(e(document).scrollTop() + o.scrollSpeed)), t.pageX - e(document).scrollLeft() < o.scrollSensitivity ? r = e(document).scrollLeft(e(document).scrollLeft() - o.scrollSpeed) : e(window).width() - (t.pageX - e(document).scrollLeft()) < o.scrollSensitivity && (r = e(document).scrollLeft(e(document).scrollLeft() + o.scrollSpeed))), r !== !1 && e.ui.ddmanager && !o.dropBehaviour && e.ui.ddmanager.prepareOffsets(this, t)), this.positionAbs = this._convertPositionTo("absolute"), this.options.axis && "y" === this.options.axis || (this.helper[0].style.left = this.position.left + "px"), this.options.axis && "x" === this.options.axis || (this.helper[0].style.top = this.position.top + "px"), i = this.items.length - 1; i >= 0; i--) if (s = this.items[i], n = s.item[0], a = this._intersectsWithPointer(s), a && s.instance === this.currentContainer && n !== this.currentItem[0] && this.placeholder[1 === a ? "next" : "prev"]()[0] !== n && !e.contains(this.placeholder[0], n) && ("semi-dynamic" === this.options.type ? !e.contains(this.element[0], n) : !0)) { if (this.direction = 1 === a ? "down" : "up", "pointer" !== this.options.tolerance && !this._intersectsWithSides(s)) break; this._rearrange(t, s), this._trigger("change", t, this._uiHash()); break } return this._contactContainers(t), e.ui.ddmanager && e.ui.ddmanager.drag(this, t), this._trigger("sort", t, this._uiHash()), this.lastPositionAbs = this.positionAbs, !1 }, _mouseStop: function (t, i) { if (t) { if (e.ui.ddmanager && !this.options.dropBehaviour && e.ui.ddmanager.drop(this, t), this.options.revert) { var s = this, n = this.placeholder.offset(), a = this.options.axis, o = {}; a && "x" !== a || (o.left = n.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollLeft)), a && "y" !== a || (o.top = n.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === document.body ? 0 : this.offsetParent[0].scrollTop)), this.reverting = !0, e(this.helper).animate(o, parseInt(this.options.revert, 10) || 500, function () { s._clear(t) }) } else this._clear(t, i); return !1 } }, cancel: function () { if (this.dragging) { this._mouseUp({ target: null }), "original" === this.options.helper ? this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper") : this.currentItem.show(); for (var t = this.containers.length - 1; t >= 0; t--) this.containers[t]._trigger("deactivate", null, this._uiHash(this)), this.containers[t].containerCache.over && (this.containers[t]._trigger("out", null, this._uiHash(this)), this.containers[t].containerCache.over = 0) } return this.placeholder && (this.placeholder[0].parentNode && this.placeholder[0].parentNode.removeChild(this.placeholder[0]), "original" !== this.options.helper && this.helper && this.helper[0].parentNode && this.helper.remove(), e.extend(this, { helper: null, dragging: !1, reverting: !1, _noFinalSort: null }), this.domPosition.prev ? e(this.domPosition.prev).after(this.currentItem) : e(this.domPosition.parent).prepend(this.currentItem)), this }, serialize: function (t) { var i = this._getItemsAsjQuery(t && t.connected), s = []; return t = t || {}, e(i).each(function () { var i = (e(t.item || this).attr(t.attribute || "id") || "").match(t.expression || /(.+)[\-=_](.+)/); i && s.push((t.key || i[1] + "[]") + "=" + (t.key && t.expression ? i[1] : i[2])) }), !s.length && t.key && s.push(t.key + "="), s.join("&") }, toArray: function (t) { var i = this._getItemsAsjQuery(t && t.connected), s = []; return t = t || {}, i.each(function () { s.push(e(t.item || this).attr(t.attribute || "id") || "") }), s }, _intersectsWith: function (e) { var t = this.positionAbs.left, i = t + this.helperProportions.width, s = this.positionAbs.top, n = s + this.helperProportions.height, a = e.left, o = a + e.width, r = e.top, h = r + e.height, l = this.offset.click.top, u = this.offset.click.left, d = "x" === this.options.axis || s + l > r && h > s + l, c = "y" === this.options.axis || t + u > a && o > t + u, p = d && c; return "pointer" === this.options.tolerance || this.options.forcePointerForContainers || "pointer" !== this.options.tolerance && this.helperProportions[this.floating ? "width" : "height"] > e[this.floating ? "width" : "height"] ? p : t + this.helperProportions.width / 2 > a && o > i - this.helperProportions.width / 2 && s + this.helperProportions.height / 2 > r && h > n - this.helperProportions.height / 2 }, _intersectsWithPointer: function (e) { var t = "x" === this.options.axis || this._isOverAxis(this.positionAbs.top + this.offset.click.top, e.top, e.height), i = "y" === this.options.axis || this._isOverAxis(this.positionAbs.left + this.offset.click.left, e.left, e.width), s = t && i, n = this._getDragVerticalDirection(), a = this._getDragHorizontalDirection(); return s ? this.floating ? a && "right" === a || "down" === n ? 2 : 1 : n && ("down" === n ? 2 : 1) : !1 }, _intersectsWithSides: function (e) { var t = this._isOverAxis(this.positionAbs.top + this.offset.click.top, e.top + e.height / 2, e.height), i = this._isOverAxis(this.positionAbs.left + this.offset.click.left, e.left + e.width / 2, e.width), s = this._getDragVerticalDirection(), n = this._getDragHorizontalDirection(); return this.floating && n ? "right" === n && i || "left" === n && !i : s && ("down" === s && t || "up" === s && !t) }, _getDragVerticalDirection: function () { var e = this.positionAbs.top - this.lastPositionAbs.top; return 0 !== e && (e > 0 ? "down" : "up") }, _getDragHorizontalDirection: function () { var e = this.positionAbs.left - this.lastPositionAbs.left; return 0 !== e && (e > 0 ? "right" : "left") }, refresh: function (e) { return this._refreshItems(e), this._setHandleClassName(), this.refreshPositions(), this }, _connectWith: function () { var e = this.options; return e.connectWith.constructor === String ? [e.connectWith] : e.connectWith }, _getItemsAsjQuery: function (t) { function i() { r.push(this) } var s, n, a, o, r = [], h = [], l = this._connectWith(); if (l && t) for (s = l.length - 1; s >= 0; s--) for (a = e(l[s]), n = a.length - 1; n >= 0; n--) o = e.data(a[n], this.widgetFullName), o && o !== this && !o.options.disabled && h.push([e.isFunction(o.options.items) ? o.options.items.call(o.element) : e(o.options.items, o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), o]); for (h.push([e.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : e(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]), s = h.length - 1; s >= 0; s--) h[s][0].each(i); return e(r) }, _removeCurrentsFromItems: function () { var t = this.currentItem.find(":data(" + this.widgetName + "-item)"); this.items = e.grep(this.items, function (e) { for (var i = 0; t.length > i; i++) if (t[i] === e.item[0]) return !1; return !0 }) }, _refreshItems: function (t) { this.items = [], this.containers = [this]; var i, s, n, a, o, r, h, l, u = this.items, d = [[e.isFunction(this.options.items) ? this.options.items.call(this.element[0], t, { item: this.currentItem }) : e(this.options.items, this.element), this]], c = this._connectWith(); if (c && this.ready) for (i = c.length - 1; i >= 0; i--) for (n = e(c[i]), s = n.length - 1; s >= 0; s--) a = e.data(n[s], this.widgetFullName), a && a !== this && !a.options.disabled && (d.push([e.isFunction(a.options.items) ? a.options.items.call(a.element[0], t, { item: this.currentItem }) : e(a.options.items, a.element), a]), this.containers.push(a)); for (i = d.length - 1; i >= 0; i--) for (o = d[i][1], r = d[i][0], s = 0, l = r.length; l > s; s++) h = e(r[s]), h.data(this.widgetName + "-item", o), u.push({ item: h, instance: o, width: 0, height: 0, left: 0, top: 0 }) }, refreshPositions: function (t) { this.offsetParent && this.helper && (this.offset.parent = this._getParentOffset()); var i, s, n, a; for (i = this.items.length - 1; i >= 0; i--) s = this.items[i], s.instance !== this.currentContainer && this.currentContainer && s.item[0] !== this.currentItem[0] || (n = this.options.toleranceElement ? e(this.options.toleranceElement, s.item) : s.item, t || (s.width = n.outerWidth(), s.height = n.outerHeight()), a = n.offset(), s.left = a.left, s.top = a.top); if (this.options.custom && this.options.custom.refreshContainers) this.options.custom.refreshContainers.call(this); else for (i = this.containers.length - 1; i >= 0; i--) a = this.containers[i].element.offset(), this.containers[i].containerCache.left = a.left, this.containers[i].containerCache.top = a.top, this.containers[i].containerCache.width = this.containers[i].element.outerWidth(), this.containers[i].containerCache.height = this.containers[i].element.outerHeight(); return this }, _createPlaceholder: function (t) { t = t || this; var i, s = t.options; s.placeholder && s.placeholder.constructor !== String || (i = s.placeholder, s.placeholder = { element: function () { var s = t.currentItem[0].nodeName.toLowerCase(), n = e("<" + s + ">", t.document[0]).addClass(i || t.currentItem[0].className + " ui-sortable-placeholder").removeClass("ui-sortable-helper"); return "tr" === s ? t.currentItem.children().each(function () { e("<td>&#160;</td>", t.document[0]).attr("colspan", e(this).attr("colspan") || 1).appendTo(n) }) : "img" === s && n.attr("src", t.currentItem.attr("src")), i || n.css("visibility", "hidden"), n }, update: function (e, n) { (!i || s.forcePlaceholderSize) && (n.height() || n.height(t.currentItem.innerHeight() - parseInt(t.currentItem.css("paddingTop") || 0, 10) - parseInt(t.currentItem.css("paddingBottom") || 0, 10)), n.width() || n.width(t.currentItem.innerWidth() - parseInt(t.currentItem.css("paddingLeft") || 0, 10) - parseInt(t.currentItem.css("paddingRight") || 0, 10))) } }), t.placeholder = e(s.placeholder.element.call(t.element, t.currentItem)), t.currentItem.after(t.placeholder), s.placeholder.update(t, t.placeholder) }, _contactContainers: function (t) { var i, s, n, a, o, r, h, l, u, d, c = null, p = null; for (i = this.containers.length - 1; i >= 0; i--) if (!e.contains(this.currentItem[0], this.containers[i].element[0])) if (this._intersectsWith(this.containers[i].containerCache)) { if (c && e.contains(this.containers[i].element[0], c.element[0])) continue; c = this.containers[i], p = i } else this.containers[i].containerCache.over && (this.containers[i]._trigger("out", t, this._uiHash(this)), this.containers[i].containerCache.over = 0); if (c) if (1 === this.containers.length) this.containers[p].containerCache.over || (this.containers[p]._trigger("over", t, this._uiHash(this)), this.containers[p].containerCache.over = 1); else { for (n = 1e4, a = null, u = c.floating || this._isFloating(this.currentItem), o = u ? "left" : "top", r = u ? "width" : "height", d = u ? "clientX" : "clientY", s = this.items.length - 1; s >= 0; s--) e.contains(this.containers[p].element[0], this.items[s].item[0]) && this.items[s].item[0] !== this.currentItem[0] && (h = this.items[s].item.offset()[o], l = !1, t[d] - h > this.items[s][r] / 2 && (l = !0), n > Math.abs(t[d] - h) && (n = Math.abs(t[d] - h), a = this.items[s], this.direction = l ? "up" : "down")); if (!a && !this.options.dropOnEmpty) return; if (this.currentContainer === this.containers[p]) return; a ? this._rearrange(t, a, null, !0) : this._rearrange(t, null, this.containers[p].element, !0), this._trigger("change", t, this._uiHash()), this.containers[p]._trigger("change", t, this._uiHash(this)), this.currentContainer = this.containers[p], this.options.placeholder.update(this.currentContainer, this.placeholder), this.containers[p]._trigger("over", t, this._uiHash(this)), this.containers[p].containerCache.over = 1 } }, _createHelper: function (t) { var i = this.options, s = e.isFunction(i.helper) ? e(i.helper.apply(this.element[0], [t, this.currentItem])) : "clone" === i.helper ? this.currentItem.clone() : this.currentItem; return s.parents("body").length || e("parent" !== i.appendTo ? i.appendTo : this.currentItem[0].parentNode)[0].appendChild(s[0]), s[0] === this.currentItem[0] && (this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }), (!s[0].style.width || i.forceHelperSize) && s.width(this.currentItem.width()), (!s[0].style.height || i.forceHelperSize) && s.height(this.currentItem.height()), s }, _adjustOffsetFromHelper: function (t) { "string" == typeof t && (t = t.split(" ")), e.isArray(t) && (t = { left: +t[0], top: +t[1] || 0 }), "left" in t && (this.offset.click.left = t.left + this.margins.left), "right" in t && (this.offset.click.left = this.helperProportions.width - t.right + this.margins.left), "top" in t && (this.offset.click.top = t.top + this.margins.top), "bottom" in t && (this.offset.click.top = this.helperProportions.height - t.bottom + this.margins.top) }, _getParentOffset: function () { this.offsetParent = this.helper.offsetParent(); var t = this.offsetParent.offset(); return "absolute" === this.cssPosition && this.scrollParent[0] !== document && e.contains(this.scrollParent[0], this.offsetParent[0]) && (t.left += this.scrollParent.scrollLeft(), t.top += this.scrollParent.scrollTop()), (this.offsetParent[0] === document.body || this.offsetParent[0].tagName && "html" === this.offsetParent[0].tagName.toLowerCase() && e.ui.ie) && (t = { top: 0, left: 0 }), { top: t.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: t.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)} }, _getRelativeOffset: function () { if ("relative" === this.cssPosition) { var e = this.currentItem.position(); return { top: e.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), left: e.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft()} } return { top: 0, left: 0} }, _cacheMargins: function () { this.margins = { left: parseInt(this.currentItem.css("marginLeft"), 10) || 0, top: parseInt(this.currentItem.css("marginTop"), 10) || 0} }, _cacheHelperProportions: function () { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight()} }, _setContainment: function () { var t, i, s, n = this.options; "parent" === n.containment && (n.containment = this.helper[0].parentNode), ("document" === n.containment || "window" === n.containment) && (this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, e("document" === n.containment ? document : window).width() - this.helperProportions.width - this.margins.left, (e("document" === n.containment ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]), /^(document|window|parent)$/.test(n.containment) || (t = e(n.containment)[0], i = e(n.containment).offset(), s = "hidden" !== e(t).css("overflow"), this.containment = [i.left + (parseInt(e(t).css("borderLeftWidth"), 10) || 0) + (parseInt(e(t).css("paddingLeft"), 10) || 0) - this.margins.left, i.top + (parseInt(e(t).css("borderTopWidth"), 10) || 0) + (parseInt(e(t).css("paddingTop"), 10) || 0) - this.margins.top, i.left + (s ? Math.max(t.scrollWidth, t.offsetWidth) : t.offsetWidth) - (parseInt(e(t).css("borderLeftWidth"), 10) || 0) - (parseInt(e(t).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, i.top + (s ? Math.max(t.scrollHeight, t.offsetHeight) : t.offsetHeight) - (parseInt(e(t).css("borderTopWidth"), 10) || 0) - (parseInt(e(t).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top]) }, _convertPositionTo: function (t, i) { i || (i = this.position); var s = "absolute" === t ? 1 : -1, n = "absolute" !== this.cssPosition || this.scrollParent[0] !== document && e.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent, a = /(html|body)/i.test(n[0].tagName); return { top: i.top + this.offset.relative.top * s + this.offset.parent.top * s - ("fixed" === this.cssPosition ? -this.scrollParent.scrollTop() : a ? 0 : n.scrollTop()) * s, left: i.left + this.offset.relative.left * s + this.offset.parent.left * s - ("fixed" === this.cssPosition ? -this.scrollParent.scrollLeft() : a ? 0 : n.scrollLeft()) * s} }, _generatePosition: function (t) { var i, s, n = this.options, a = t.pageX, o = t.pageY, r = "absolute" !== this.cssPosition || this.scrollParent[0] !== document && e.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent, h = /(html|body)/i.test(r[0].tagName); return "relative" !== this.cssPosition || this.scrollParent[0] !== document && this.scrollParent[0] !== this.offsetParent[0] || (this.offset.relative = this._getRelativeOffset()), this.originalPosition && (this.containment && (t.pageX - this.offset.click.left < this.containment[0] && (a = this.containment[0] + this.offset.click.left), t.pageY - this.offset.click.top < this.containment[1] && (o = this.containment[1] + this.offset.click.top), t.pageX - this.offset.click.left > this.containment[2] && (a = this.containment[2] + this.offset.click.left), t.pageY - this.offset.click.top > this.containment[3] && (o = this.containment[3] + this.offset.click.top)), n.grid && (i = this.originalPageY + Math.round((o - this.originalPageY) / n.grid[1]) * n.grid[1], o = this.containment ? i - this.offset.click.top >= this.containment[1] && i - this.offset.click.top <= this.containment[3] ? i : i - this.offset.click.top >= this.containment[1] ? i - n.grid[1] : i + n.grid[1] : i, s = this.originalPageX + Math.round((a - this.originalPageX) / n.grid[0]) * n.grid[0], a = this.containment ? s - this.offset.click.left >= this.containment[0] && s - this.offset.click.left <= this.containment[2] ? s : s - this.offset.click.left >= this.containment[0] ? s - n.grid[0] : s + n.grid[0] : s)), { top: o - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + ("fixed" === this.cssPosition ? -this.scrollParent.scrollTop() : h ? 0 : r.scrollTop()), left: a - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + ("fixed" === this.cssPosition ? -this.scrollParent.scrollLeft() : h ? 0 : r.scrollLeft())} }, _rearrange: function (e, t, i, s) { i ? i[0].appendChild(this.placeholder[0]) : t.item[0].parentNode.insertBefore(this.placeholder[0], "down" === this.direction ? t.item[0] : t.item[0].nextSibling), this.counter = this.counter ? ++this.counter : 1; var n = this.counter; this._delay(function () { n === this.counter && this.refreshPositions(!s) }) }, _clear: function (e, t) { function i(e, t, i) { return function (s) { i._trigger(e, s, t._uiHash(t)) } } this.reverting = !1; var s, n = []; if (!this._noFinalSort && this.currentItem.parent().length && this.placeholder.before(this.currentItem), this._noFinalSort = null, this.helper[0] === this.currentItem[0]) { for (s in this._storedCSS) ("auto" === this._storedCSS[s] || "static" === this._storedCSS[s]) && (this._storedCSS[s] = ""); this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper") } else this.currentItem.show(); for (this.fromOutside && !t && n.push(function (e) { this._trigger("receive", e, this._uiHash(this.fromOutside)) }), !this.fromOutside && this.domPosition.prev === this.currentItem.prev().not(".ui-sortable-helper")[0] && this.domPosition.parent === this.currentItem.parent()[0] || t || n.push(function (e) { this._trigger("update", e, this._uiHash()) }), this !== this.currentContainer && (t || (n.push(function (e) { this._trigger("remove", e, this._uiHash()) }), n.push(function (e) { return function (t) { e._trigger("receive", t, this._uiHash(this)) } } .call(this, this.currentContainer)), n.push(function (e) { return function (t) { e._trigger("update", t, this._uiHash(this)) } } .call(this, this.currentContainer)))), s = this.containers.length - 1; s >= 0; s--) t || n.push(i("deactivate", this, this.containers[s])), this.containers[s].containerCache.over && (n.push(i("out", this, this.containers[s])), this.containers[s].containerCache.over = 0); if (this.storedCursor && (this.document.find("body").css("cursor", this.storedCursor), this.storedStylesheet.remove()), this._storedOpacity && this.helper.css("opacity", this._storedOpacity), this._storedZIndex && this.helper.css("zIndex", "auto" === this._storedZIndex ? "" : this._storedZIndex), this.dragging = !1, this.cancelHelperRemoval) { if (!t) { for (this._trigger("beforeStop", e, this._uiHash()), s = 0; n.length > s; s++) n[s].call(this, e); this._trigger("stop", e, this._uiHash()) } return this.fromOutside = !1, !1 } if (t || this._trigger("beforeStop", e, this._uiHash()), this.placeholder[0].parentNode.removeChild(this.placeholder[0]), this.helper[0] !== this.currentItem[0] && this.helper.remove(), this.helper = null, !t) { for (s = 0; n.length > s; s++) n[s].call(this, e); this._trigger("stop", e, this._uiHash()) } return this.fromOutside = !1, !0 }, _trigger: function () { e.Widget.prototype._trigger.apply(this, arguments) === !1 && this.cancel() }, _uiHash: function (t) { var i = t || this; return { helper: i.helper, placeholder: i.placeholder || e([]), position: i.position, originalPosition: i.originalPosition, offset: i.positionAbs, item: i.currentItem, sender: t ? t.element : null} } 
   }), e.widget("ui.slider", e.ui.mouse, { version: "1.11.1", widgetEventPrefix: "slide", options: { animate: !1, distance: 0, max: 100, min: 0, orientation: "horizontal", range: !1, step: 1, value: 0, values: null, change: null, slide: null, start: null, stop: null }, numPages: 5, _create: function () { this._keySliding = !1, this._mouseSliding = !1, this._animateOff = !0, this._handleIndex = null, this._detectOrientation(), this._mouseInit(), this.element.addClass("ui-slider ui-slider-" + this.orientation + " ui-widget" + " ui-widget-content" + " ui-corner-all"), this._refresh(), this._setOption("disabled", this.options.disabled), this._animateOff = !1 }, _refresh: function () { this._createRange(), this._createHandles(), this._setupEvents(), this._refreshValue() }, _createHandles: function () { var t, i, s = this.options, n = this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"), a = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>", o = []; for (i = s.values && s.values.length || 1, n.length > i && (n.slice(i).remove(), n = n.slice(0, i)), t = n.length; i > t; t++) o.push(a); this.handles = n.add(e(o.join("")).appendTo(this.element)), this.handle = this.handles.eq(0), this.handles.each(function (t) { e(this).data("ui-slider-handle-index", t) }) }, _createRange: function () { var t = this.options, i = ""; t.range ? (t.range === !0 && (t.values ? t.values.length && 2 !== t.values.length ? t.values = [t.values[0], t.values[0]] : e.isArray(t.values) && (t.values = t.values.slice(0)) : t.values = [this._valueMin(), this._valueMin()]), this.range && this.range.length ? this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({ left: "", bottom: "" }) : (this.range = e("<div></div>").appendTo(this.element), i = "ui-slider-range ui-widget-header ui-corner-all"), this.range.addClass(i + ("min" === t.range || "max" === t.range ? " ui-slider-range-" + t.range : ""))) : (this.range && this.range.remove(), this.range = null) }, _setupEvents: function () { this._off(this.handles), this._on(this.handles, this._handleEvents), this._hoverable(this.handles), this._focusable(this.handles) }, _destroy: function () { this.handles.remove(), this.range && this.range.remove(), this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"), this._mouseDestroy() }, _mouseCapture: function (t) { var i, s, n, a, o, r, h, l, u = this, d = this.options; return d.disabled ? !1 : (this.elementSize = { width: this.element.outerWidth(), height: this.element.outerHeight() }, this.elementOffset = this.element.offset(), i = { x: t.pageX, y: t.pageY }, s = this._normValueFromMouse(i), n = this._valueMax() - this._valueMin() + 1, this.handles.each(function (t) { var i = Math.abs(s - u.values(t)); (n > i || n === i && (t === u._lastChangedValue || u.values(t) === d.min)) && (n = i, a = e(this), o = t) }), r = this._start(t, o), r === !1 ? !1 : (this._mouseSliding = !0, this._handleIndex = o, a.addClass("ui-state-active").focus(), h = a.offset(), l = !e(t.target).parents().addBack().is(".ui-slider-handle"), this._clickOffset = l ? { left: 0, top: 0} : { left: t.pageX - h.left - a.width() / 2, top: t.pageY - h.top - a.height() / 2 - (parseInt(a.css("borderTopWidth"), 10) || 0) - (parseInt(a.css("borderBottomWidth"), 10) || 0) + (parseInt(a.css("marginTop"), 10) || 0) }, this.handles.hasClass("ui-state-hover") || this._slide(t, o, s), this._animateOff = !0, !0)) }, _mouseStart: function () { return !0 }, _mouseDrag: function (e) { var t = { x: e.pageX, y: e.pageY }, i = this._normValueFromMouse(t); return this._slide(e, this._handleIndex, i), !1 }, _mouseStop: function (e) { return this.handles.removeClass("ui-state-active"), this._mouseSliding = !1, this._stop(e, this._handleIndex), this._change(e, this._handleIndex), this._handleIndex = null, this._clickOffset = null, this._animateOff = !1, !1 }, _detectOrientation: function () { this.orientation = "vertical" === this.options.orientation ? "vertical" : "horizontal" }, _normValueFromMouse: function (e) { var t, i, s, n, a; return "horizontal" === this.orientation ? (t = this.elementSize.width, i = e.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0)) : (t = this.elementSize.height, i = e.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0)), s = i / t, s > 1 && (s = 1), 0 > s && (s = 0), "vertical" === this.orientation && (s = 1 - s), n = this._valueMax() - this._valueMin(), a = this._valueMin() + s * n, this._trimAlignValue(a) }, _start: function (e, t) { var i = { handle: this.handles[t], value: this.value() }; return this.options.values && this.options.values.length && (i.value = this.values(t), i.values = this.values()), this._trigger("start", e, i) }, _slide: function (e, t, i) { var s, n, a; this.options.values && this.options.values.length ? (s = this.values(t ? 0 : 1), 2 === this.options.values.length && this.options.range === !0 && (0 === t && i > s || 1 === t && s > i) && (i = s), i !== this.values(t) && (n = this.values(), n[t] = i, a = this._trigger("slide", e, { handle: this.handles[t], value: i, values: n }), s = this.values(t ? 0 : 1), a !== !1 && this.values(t, i))) : i !== this.value() && (a = this._trigger("slide", e, { handle: this.handles[t], value: i }), a !== !1 && this.value(i)) }, _stop: function (e, t) { var i = { handle: this.handles[t], value: this.value() }; this.options.values && this.options.values.length && (i.value = this.values(t), i.values = this.values()), this._trigger("stop", e, i) }, _change: function (e, t) { if (!this._keySliding && !this._mouseSliding) { var i = { handle: this.handles[t], value: this.value() }; this.options.values && this.options.values.length && (i.value = this.values(t), i.values = this.values()), this._lastChangedValue = t, this._trigger("change", e, i) } }, value: function (e) { return arguments.length ? (this.options.value = this._trimAlignValue(e), this._refreshValue(), this._change(null, 0), void 0) : this._value() }, values: function (t, i) { var s, n, a; if (arguments.length > 1) return this.options.values[t] = this._trimAlignValue(i), this._refreshValue(), this._change(null, t), void 0; if (!arguments.length) return this._values(); if (!e.isArray(arguments[0])) return this.options.values && this.options.values.length ? this._values(t) : this.value(); for (s = this.options.values, n = arguments[0], a = 0; s.length > a; a += 1) s[a] = this._trimAlignValue(n[a]), this._change(null, a); this._refreshValue() }, _setOption: function (t, i) { var s, n = 0; switch ("range" === t && this.options.range === !0 && ("min" === i ? (this.options.value = this._values(0), this.options.values = null) : "max" === i && (this.options.value = this._values(this.options.values.length - 1), this.options.values = null)), e.isArray(this.options.values) && (n = this.options.values.length), "disabled" === t && this.element.toggleClass("ui-state-disabled", !!i), this._super(t, i), t) { case "orientation": this._detectOrientation(), this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-" + this.orientation), this._refreshValue(), this.handles.css("horizontal" === i ? "bottom" : "left", ""); break; case "value": this._animateOff = !0, this._refreshValue(), this._change(null, 0), this._animateOff = !1; break; case "values": for (this._animateOff = !0, this._refreshValue(), s = 0; n > s; s += 1) this._change(null, s); this._animateOff = !1; break; case "min": case "max": this._animateOff = !0, this._refreshValue(), this._animateOff = !1; break; case "range": this._animateOff = !0, this._refresh(), this._animateOff = !1 } }, _value: function () { var e = this.options.value; return e = this._trimAlignValue(e) }, _values: function (e) { var t, i, s; if (arguments.length) return t = this.options.values[e], t = this._trimAlignValue(t); if (this.options.values && this.options.values.length) { for (i = this.options.values.slice(), s = 0; i.length > s; s += 1) i[s] = this._trimAlignValue(i[s]); return i } return [] }, _trimAlignValue: function (e) { if (this._valueMin() >= e) return this._valueMin(); if (e >= this._valueMax()) return this._valueMax(); var t = this.options.step > 0 ? this.options.step : 1, i = (e - this._valueMin()) % t, s = e - i; return 2 * Math.abs(i) >= t && (s += i > 0 ? t : -t), parseFloat(s.toFixed(5)) }, _valueMin: function () { return this.options.min }, _valueMax: function () { return this.options.max }, _refreshValue: function ()
   {
      var t, i, s, n, a, o = this.options.range, r = this.options, h = this, l = this._animateOff ? !1 : r.animate, u = {}; this.options.values && this.options.values.length ? this.handles.each(function (s) { i = 100 * ((h.values(s) - h._valueMin()) / (h._valueMax() - h._valueMin())), u["horizontal" === h.orientation ? "left" : "bottom"] = i + "%", e(this).stop(1, 1)[l ? "animate" : "css"](u, r.animate), h.options.range === !0 && ("horizontal" === h.orientation ? (0 === s && h.range.stop(1, 1)[l ? "animate" : "css"]({ left: i + "%" }, r.animate), 1 === s && h.range[l ? "animate" : "css"]({ width: i - t + "%" }, { queue: !1, duration: r.animate })) : (0 === s && h.range.stop(1, 1)[l ? "animate" : "css"]({ bottom: i + "%" }, r.animate), 1 === s && h.range[l ? "animate" : "css"]({ height: i - t + "%" }, { queue: !1, duration: r.animate }))), t = i }) : (s = this.value(), n = this._valueMin(), a = this._valueMax(), i = a !== n ? 100 * ((s - n) / (a - n)) : 0, u["horizontal" === this.orientation ? "left" : "bottom"] = i + "%", this.handle.stop(1, 1)[l ? "animate" : "css"](u, r.animate), "min" === o && "horizontal" === this.orientation && this.range.stop(1, 1)[l ? "animate" : "css"]({ width: i + "%" }, r.animate), "max" === o && "horizontal" === this.orientation && this.range[l ? "animate" : "css"]({ width: 100 - i + "%" }, { queue: !1, duration: r.animate }), "min" === o && "vertical" === this.orientation && this.range.stop(1, 1)[l ? "animate" : "css"]({ height: i + "%" }, r.animate), "max" === o && "vertical" === this.orientation && this.range[l ? "animate" : "css"]({ height: 100 - i + "%" }, { queue: !1, duration: r.animate }))
   }, _handleEvents: { keydown: function (t) { var i, s, n, a, o = e(t.target).data("ui-slider-handle-index"); switch (t.keyCode) { case e.ui.keyCode.HOME: case e.ui.keyCode.END: case e.ui.keyCode.PAGE_UP: case e.ui.keyCode.PAGE_DOWN: case e.ui.keyCode.UP: case e.ui.keyCode.RIGHT: case e.ui.keyCode.DOWN: case e.ui.keyCode.LEFT: if (t.preventDefault(), !this._keySliding && (this._keySliding = !0, e(t.target).addClass("ui-state-active"), i = this._start(t, o), i === !1)) return } switch (a = this.options.step, s = n = this.options.values && this.options.values.length ? this.values(o) : this.value(), t.keyCode) { case e.ui.keyCode.HOME: n = this._valueMin(); break; case e.ui.keyCode.END: n = this._valueMax(); break; case e.ui.keyCode.PAGE_UP: n = this._trimAlignValue(s + (this._valueMax() - this._valueMin()) / this.numPages); break; case e.ui.keyCode.PAGE_DOWN: n = this._trimAlignValue(s - (this._valueMax() - this._valueMin()) / this.numPages); break; case e.ui.keyCode.UP: case e.ui.keyCode.RIGHT: if (s === this._valueMax()) return; n = this._trimAlignValue(s + a); break; case e.ui.keyCode.DOWN: case e.ui.keyCode.LEFT: if (s === this._valueMin()) return; n = this._trimAlignValue(s - a) } this._slide(t, o, n) }, keyup: function (t) { var i = e(t.target).data("ui-slider-handle-index"); this._keySliding && (this._keySliding = !1, this._stop(t, i), this._change(t, i), e(t.target).removeClass("ui-state-active")) } }
   })
});
﻿!function(t){function e(o,t){var e,u;1<o.originalEvent.touches.length||(o.preventDefault(),e=o.originalEvent.changedTouches[0],(u=document.createEvent("MouseEvents")).initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,!1,!1,!1,!1,0,null),o.target.dispatchEvent(u))}var u,o,n,c;t.support.touch="ontouchend"in document,t.support.touch&&(o=t.ui.mouse.prototype,n=o._mouseInit,c=o._mouseDestroy,o._touchStart=function(o){!u&&this._mouseCapture(o.originalEvent.changedTouches[0])&&(u=!0,this._touchMoved=!1,e(o,"mouseover"),e(o,"mousemove"),e(o,"mousedown"))},o._touchMove=function(o){u&&(this._touchMoved=!0,e(o,"mousemove"))},o._touchEnd=function(o){u&&(e(o,"mouseup"),e(o,"mouseout"),this._touchMoved||e(o,"click"),u=!1)},o._mouseInit=function(){var o=this;o.element.bind({touchstart:t.proxy(o,"_touchStart"),touchmove:t.proxy(o,"_touchMove"),touchend:t.proxy(o,"_touchEnd")}),n.call(o)},o._mouseDestroy=function(){var o=this;o.element.unbind({touchstart:t.proxy(o,"_touchStart"),touchmove:t.proxy(o,"_touchMove"),touchend:t.proxy(o,"_touchEnd")}),c.call(o)})}(jQuery);
﻿/*!
 * Lazy Load - jQuery plugin for lazy loading images
 *
 * Copyright (c) 2007-2015 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   http://www.appelsiini.net/projects/lazyload
 *
 * Version:  1.9.7
 *
 */

(function($, window, document, undefined) {
    var $window = $(window);

    $.fn.lazyload = function(options) {
        var elements = this;
        var $container;
        var settings = {
            threshold       : 0,
            failure_limit   : 0,
            event           : "scroll",
            effect          : "show",
            container       : window,
            data_attribute  : "original",
            skip_invisible  : false,
            appear          : null,
            load            : null,
            placeholder     : _MTS_MEDIAURL + "images/busySpinner.gif",
            error           : _MTS_MEDIAURL + "images/noImage.png"
        };

        function update() {
            var counter = 0;

            elements.each(function() {
                var $this = $(this);
                if (settings.skip_invisible && !$this.is(":visible")) {
                    return;
                }
                if ($.abovethetop(this, settings) ||
                    $.leftofbegin(this, settings)) {
                        /* Nothing. */
                } else if (!$.belowthefold(this, settings) &&
                    !$.rightoffold(this, settings)) {
                        $this.trigger("appear");
                        /* if we found an image we'll load, reset the counter */
                        counter = 0;
                } else {
                    if (++counter > settings.failure_limit) {
                        return false;
                    }
                }
            });

        }

        if(options) {
            /* Maintain BC for a couple of versions. */
            if (undefined !== options.failurelimit) {
                options.failure_limit = options.failurelimit;
                delete options.failurelimit;
            }
            if (undefined !== options.effectspeed) {
                options.effect_speed = options.effectspeed;
                delete options.effectspeed;
            }

            $.extend(settings, options);
        }

        /* Cache container as jQuery as object. */
        $container = (settings.container === undefined ||
                      settings.container === window) ? $window : $(settings.container);

        /* Fire one scroll event per scroll. Not one scroll event per image. */
        if (0 === settings.event.indexOf("scroll")) {
            $container.bind(settings.event, function() {
                return update();
            });
        }

        this.each(function() {
            var self = this;
            var $self = $(self);

            self.loaded = false;

            /* If no src attribute given use data:uri. */
            if ($self.attr("src") === undefined || $self.attr("src") === false) {
                if ($self.is("img")) {
                    $self.attr("src", settings.placeholder);
                }
            }

            /* When appear is triggered load original image. */
            $self.one("appear", function() {
                if (!this.loaded) {
                    if (settings.appear) {
                        var elements_left = elements.length;
                        settings.appear.call(self, elements_left, settings);
                    }
                    $("<img />")
                        .bind("load", function() {
                            var original = $self.attr("data-" + settings.data_attribute);
                            $self.hide();
                            if ($self.is("img")) {
                                $self.attr("src", original);
                            } else {
                                $self.css("background-image", "url('" + original + "')");
                            }
                            $self[settings.effect](settings.effect_speed);

                            self.loaded = true;

                            /* Remove image from array so it is not looped next time. */
                            var temp = $.grep(elements, function(element) {
                                return !element.loaded;
                            });
                            elements = $(temp);

                            if (settings.load) {
                                var elements_left = elements.length;
                                settings.load.call(self, elements_left, settings);
                            }
                        })
                     .bind("error", function () { 
                           $self.attr("src", settings.error); 
                        })
                        .attr("src", $self.attr("data-" + settings.data_attribute));
                }
            });

            /* When wanted event is triggered load original image */
            /* by triggering appear.                              */
            if (0 !== settings.event.indexOf("scroll")) {
                $self.bind(settings.event, function() {
                    if (!self.loaded) {
                        $self.trigger("appear");
                    }
                });
            }
        });

        /* Check if something appears when window is resized. */
        $window.bind("resize", function() {
            update();
        });

        /* With IOS5 force loading images when navigating with back button. */
        /* Non optimal workaround. */
        if ((/(?:iphone|ipod|ipad).*os 5/gi).test(navigator.appVersion)) {
            $window.bind("pageshow", function(event) {
                if (event.originalEvent && event.originalEvent.persisted) {
                    elements.each(function() {
                        $(this).trigger("appear");
                    });
                }
            });
        }

        /* Force initial check if images should appear. */
        $(document).ready(function() {
            update();
        });

        return this;
    };

    /* Convenience methods in jQuery namespace.           */
    /* Use as  $.belowthefold(element, {threshold : 100, container : window}) */

    $.belowthefold = function(element, settings) {
        var fold;

        if (settings.container === undefined || settings.container === window) {
            fold = (window.innerHeight ? window.innerHeight : $window.height()) + $window.scrollTop();
        } else {
            fold = $(settings.container).offset().top + $(settings.container).height();
        }

        return fold <= $(element).offset().top - settings.threshold;
    };

    $.rightoffold = function(element, settings) {
        var fold;

        if (settings.container === undefined || settings.container === window) {
            fold = $window.width() + $window.scrollLeft();
        } else {
            fold = $(settings.container).offset().left + $(settings.container).width();
        }

        return fold <= $(element).offset().left - settings.threshold;
    };

    $.abovethetop = function(element, settings) {
        var fold;

        if (settings.container === undefined || settings.container === window) {
            fold = $window.scrollTop();
        } else {
            fold = $(settings.container).offset().top;
        }

        return fold >= $(element).offset().top + settings.threshold  + $(element).height();
    };

    $.leftofbegin = function(element, settings) {
        var fold;

        if (settings.container === undefined || settings.container === window) {
            fold = $window.scrollLeft();
        } else {
            fold = $(settings.container).offset().left;
        }

        return fold >= $(element).offset().left + settings.threshold + $(element).width();
    };

    $.inviewport = function(element, settings) {
         return !$.rightoffold(element, settings) && !$.leftofbegin(element, settings) &&
                !$.belowthefold(element, settings) && !$.abovethetop(element, settings);
     };

    /* Custom selectors for your convenience.   */
    /* Use as $("img:below-the-fold").something() or */
    /* $("img").filter(":below-the-fold").something() which is faster */

    $.extend($.expr[":"], {
        "below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0}); },
        "above-the-top"  : function(a) { return !$.belowthefold(a, {threshold : 0}); },
        "right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0}); },
        "left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0}); },
        "in-viewport"    : function(a) { return $.inviewport(a, {threshold : 0}); },
        /* Maintain BC for couple of versions. */
        "above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0}); },
        "right-of-fold"  : function(a) { return $.rightoffold(a, {threshold : 0}); },
        "left-of-fold"   : function(a) { return !$.rightoffold(a, {threshold : 0}); }
    });

})(jQuery, window, document);

﻿/* Chosen v1.7.0 | (c) 2011-2017 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
(function () { var a, b, c, d, e, f = function (a, b) { return function () { return a.apply(b, arguments) } }, g = {}.hasOwnProperty, h = function (a, b) { function c() { this.constructor = a } for (var d in b) g.call(b, d) && (a[d] = b[d]); return c.prototype = b.prototype, a.prototype = new c, a.__super__ = b.prototype, a }; d = function () { function a() { this.options_index = 0, this.parsed = [] } return a.prototype.add_node = function (a) { return "OPTGROUP" === a.nodeName.toUpperCase() ? this.add_group(a) : this.add_option(a) }, a.prototype.add_group = function (a) { var b, c, d, e, f, g; for (b = this.parsed.length, this.parsed.push({ array_index: b, group: !0, label: this.escapeExpression(a.label), title: a.title ? a.title : void 0, children: 0, disabled: a.disabled, classes: a.className }), f = a.childNodes, g = [], d = 0, e = f.length; e > d; d++)c = f[d], g.push(this.add_option(c, b, a.disabled)); return g }, a.prototype.add_option = function (a, b, c) { return "OPTION" === a.nodeName.toUpperCase() ? ("" !== a.text ? (null != b && (this.parsed[b].children += 1), this.parsed.push({ array_index: this.parsed.length, options_index: this.options_index, value: a.value, text: a.text, html: a.innerHTML, title: a.title ? a.title : void 0, selected: a.selected, disabled: c === !0 ? c : a.disabled, group_array_index: b, group_label: null != b ? this.parsed[b].label : null, classes: a.className, style: a.style.cssText })) : this.parsed.push({ array_index: this.parsed.length, options_index: this.options_index, empty: !0 }), this.options_index += 1) : void 0 }, a.prototype.escapeExpression = function (a) { var b, c; return null == a || a === !1 ? "" : /[\&\<\>\"\'\`]/.test(a) ? (b = { "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" }, c = /&(?!\w+;)|[\<\>\"\'\`]/g, a.replace(c, function (a) { return b[a] || "&amp;" })) : a }, a }(), d.select_to_array = function (a) { var b, c, e, f, g; for (c = new d, g = a.childNodes, e = 0, f = g.length; f > e; e++)b = g[e], c.add_node(b); return c.parsed }, b = function () { function a(b, c) { this.form_field = b, this.options = null != c ? c : {}, this.label_click_handler = f(this.label_click_handler, this), a.browser_is_supported() && (this.is_multiple = this.form_field.multiple, this.set_default_text(), this.set_default_values(), this.setup(), this.set_up_html(), this.register_observers(), this.on_ready()) } return a.prototype.set_default_values = function () { var a = this; return this.click_test_action = function (b) { return a.test_active_click(b) }, this.activate_action = function (b) { return a.activate_field(b) }, this.active_field = !1, this.mouse_on_container = !1, this.results_showing = !1, this.result_highlighted = null, this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className), this.allow_single_deselect = null != this.options.allow_single_deselect && null != this.form_field.options[0] && "" === this.form_field.options[0].text ? this.options.allow_single_deselect : !1, this.disable_search_threshold = this.options.disable_search_threshold || 0, this.disable_search = this.options.disable_search || !1, this.enable_split_word_search = null != this.options.enable_split_word_search ? this.options.enable_split_word_search : !0, this.group_search = null != this.options.group_search ? this.options.group_search : !0, this.search_contains = this.options.search_contains || !1, this.single_backstroke_delete = null != this.options.single_backstroke_delete ? this.options.single_backstroke_delete : !0, this.max_selected_options = this.options.max_selected_options || 1 / 0, this.inherit_select_classes = this.options.inherit_select_classes || !1, this.display_selected_options = null != this.options.display_selected_options ? this.options.display_selected_options : !0, this.display_disabled_options = null != this.options.display_disabled_options ? this.options.display_disabled_options : !0, this.include_group_label_in_selected = this.options.include_group_label_in_selected || !1, this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY, this.case_sensitive_search = this.options.case_sensitive_search || !1, this.hide_results_on_select = null != this.options.hide_results_on_select ? this.options.hide_results_on_select : !0 }, a.prototype.set_default_text = function () { return this.form_field.getAttribute("data-placeholder") ? this.default_text = this.form_field.getAttribute("data-placeholder") : this.is_multiple ? this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || a.default_multiple_text : this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || a.default_single_text, this.default_text = this.escape_html(this.default_text), this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || a.default_no_result_text }, a.prototype.choice_label = function (a) { return this.include_group_label_in_selected && null != a.group_label ? "<b class='group-name'>" + a.group_label + "</b>" + a.html : a.html }, a.prototype.mouse_enter = function () { return this.mouse_on_container = !0 }, a.prototype.mouse_leave = function () { return this.mouse_on_container = !1 }, a.prototype.input_focus = function (a) { var b = this; if (this.is_multiple) { if (!this.active_field) return setTimeout(function () { return b.container_mousedown() }, 50) } else if (!this.active_field) return this.activate_field() }, a.prototype.input_blur = function (a) { var b = this; return this.mouse_on_container ? void 0 : (this.active_field = !1, setTimeout(function () { return b.blur_test() }, 100)) }, a.prototype.label_click_handler = function (a) { return this.is_multiple ? this.container_mousedown(a) : this.activate_field() }, a.prototype.results_option_build = function (a) { var b, c, d, e, f, g, h; for (b = "", e = 0, h = this.results_data, f = 0, g = h.length; g > f && (c = h[f], d = "", d = c.group ? this.result_add_group(c) : this.result_add_option(c), "" !== d && (e++ , b += d), (null != a ? a.first : void 0) && (c.selected && this.is_multiple ? this.choice_build(c) : c.selected && !this.is_multiple && this.single_set_selected_text(this.choice_label(c))), !(e >= this.max_shown_results)); f++); return b }, a.prototype.result_add_option = function (a) { var b, c; return a.search_match && this.include_option_in_results(a) ? (b = [], a.disabled || a.selected && this.is_multiple || b.push("active-result"), !a.disabled || a.selected && this.is_multiple || b.push("disabled-result"), a.selected && b.push("result-selected"), null != a.group_array_index && b.push("group-option"), "" !== a.classes && b.push(a.classes), c = document.createElement("li"), c.className = b.join(" "), c.style.cssText = a.style, c.setAttribute("data-option-array-index", a.array_index), c.innerHTML = a.search_text, a.title && (c.title = a.title), this.outerHTML(c)) : "" }, a.prototype.result_add_group = function (a) { var b, c; return (a.search_match || a.group_match) && a.active_options > 0 ? (b = [], b.push("group-result"), a.classes && b.push(a.classes), c = document.createElement("li"), c.className = b.join(" "), c.innerHTML = a.search_text, a.title && (c.title = a.title), this.outerHTML(c)) : "" }, a.prototype.results_update_field = function () { return this.set_default_text(), this.is_multiple || this.results_reset_cleanup(), this.result_clear_highlight(), this.results_build(), this.results_showing ? this.winnow_results() : void 0 }, a.prototype.reset_single_select_options = function () { var a, b, c, d, e; for (d = this.results_data, e = [], b = 0, c = d.length; c > b; b++)a = d[b], a.selected ? e.push(a.selected = !1) : e.push(void 0); return e }, a.prototype.results_toggle = function () { return this.results_showing ? this.results_hide() : this.results_show() }, a.prototype.results_search = function (a) { return this.results_showing ? this.winnow_results() : this.results_show() }, a.prototype.winnow_results = function () { var a, b, c, d, e, f, g, h, i, j, k, l; for (this.no_results_clear(), e = 0, g = this.get_search_text(), a = g.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), d = this.get_search_regex(a), b = this.get_highlight_regex(a), l = this.results_data, j = 0, k = l.length; k > j; j++)c = l[j], c.search_match = !1, f = null, this.include_option_in_results(c) && (c.group && (c.group_match = !1, c.active_options = 0), null != c.group_array_index && this.results_data[c.group_array_index] && (f = this.results_data[c.group_array_index], 0 === f.active_options && f.search_match && (e += 1), f.active_options += 1), c.search_text = c.group ? c.label : c.html, (!c.group || this.group_search) && (c.search_match = this.search_string_match(c.search_text, d), c.search_match && !c.group && (e += 1), c.search_match ? (g.length && (h = c.search_text.search(b), i = c.search_text.substr(0, h + g.length) + "</em>" + c.search_text.substr(h + g.length), c.search_text = i.substr(0, h) + "<em>" + i.substr(h)), null != f && (f.group_match = !0)) : null != c.group_array_index && this.results_data[c.group_array_index].search_match && (c.search_match = !0))); return this.result_clear_highlight(), 1 > e && g.length ? (this.update_results_content(""), this.no_results(g)) : (this.update_results_content(this.results_option_build()), this.winnow_results_set_highlight()) }, a.prototype.get_search_regex = function (a) { var b, c; return b = this.search_contains ? "" : "^", c = this.case_sensitive_search ? "" : "i", new RegExp(b + a, c) }, a.prototype.get_highlight_regex = function (a) { var b, c; return b = this.search_contains ? "" : "\\b", c = this.case_sensitive_search ? "" : "i", new RegExp(b + a, c) }, a.prototype.search_string_match = function (a, b) { var c, d, e, f; if (b.test(a)) return !0; if (this.enable_split_word_search && (a.indexOf(" ") >= 0 || 0 === a.indexOf("[")) && (d = a.replace(/\[|\]/g, "").split(" "), d.length)) for (e = 0, f = d.length; f > e; e++)if (c = d[e], b.test(c)) return !0 }, a.prototype.choices_count = function () { var a, b, c, d; if (null != this.selected_option_count) return this.selected_option_count; for (this.selected_option_count = 0, d = this.form_field.options, b = 0, c = d.length; c > b; b++)a = d[b], a.selected && (this.selected_option_count += 1); return this.selected_option_count }, a.prototype.choices_click = function (a) { return a.preventDefault(), this.activate_field(), this.results_showing || this.is_disabled ? void 0 : this.results_show() }, a.prototype.keydown_checker = function (a) { var b, c; switch (b = null != (c = a.which) ? c : a.keyCode, this.search_field_scale(), 8 !== b && this.pending_backstroke && this.clear_backstroke(), b) { case 8: this.backstroke_length = this.get_search_field_value().length; break; case 9: this.results_showing && !this.is_multiple && this.result_select(a), this.mouse_on_container = !1; break; case 13: this.results_showing && a.preventDefault(); break; case 27: this.results_showing && a.preventDefault(); break; case 32: this.disable_search && a.preventDefault(); break; case 38: a.preventDefault(), this.keyup_arrow(); break; case 40: a.preventDefault(), this.keydown_arrow() } }, a.prototype.keyup_checker = function (a) { var b, c; switch (b = null != (c = a.which) ? c : a.keyCode, this.search_field_scale(), b) { case 8: this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0 ? this.keydown_backstroke() : this.pending_backstroke || (this.result_clear_highlight(), this.results_search()); break; case 13: a.preventDefault(), this.results_showing && this.result_select(a); break; case 27: this.results_showing && this.results_hide(); break; case 9: case 16: case 17: case 18: case 38: case 40: case 91: break; default: this.results_search() } }, a.prototype.clipboard_event_checker = function (a) { var b = this; if (!this.is_disabled) return setTimeout(function () { return b.results_search() }, 50) }, a.prototype.container_width = function () { return null != this.options.width ? this.options.width : "" + this.form_field.offsetWidth + "px" }, a.prototype.include_option_in_results = function (a) { return this.is_multiple && !this.display_selected_options && a.selected ? !1 : !this.display_disabled_options && a.disabled ? !1 : a.empty ? !1 : !0 }, a.prototype.search_results_touchstart = function (a) { return this.touch_started = !0, this.search_results_mouseover(a) }, a.prototype.search_results_touchmove = function (a) { return this.touch_started = !1, this.search_results_mouseout(a) }, a.prototype.search_results_touchend = function (a) { return this.touch_started ? this.search_results_mouseup(a) : void 0 }, a.prototype.outerHTML = function (a) { var b; return a.outerHTML ? a.outerHTML : (b = document.createElement("div"), b.appendChild(a), b.innerHTML) }, a.prototype.get_single_html = function () { return '<a class="chosen-single chosen-default">\n  <span>' + this.default_text + '</span>\n  <div><b></b></div>\n</a>\n<div class="chosen-drop">\n  <div class="chosen-search">\n    <input class="chosen-search-input" type="text" autocomplete="off" />\n  </div>\n  <ul class="chosen-results"></ul>\n</div>' }, a.prototype.get_multi_html = function () { return '<ul class="chosen-choices">\n  <li class="search-field">\n    <input class="chosen-search-input" type="text" autocomplete="off" value="' + this.default_text + '" />\n  </li>\n</ul>\n<div class="chosen-drop">\n  <ul class="chosen-results"></ul>\n</div>' }, a.prototype.get_no_results_html = function (a) { return '<li class="no-results">\n  ' + this.results_none_found + " <span>" + a + "</span>\n</li>" }, a.browser_is_supported = function () { return "Microsoft Internet Explorer" === window.navigator.appName ? document.documentMode >= 8 : /iP(od|hone)/i.test(window.navigator.userAgent) || /IEMobile/i.test(window.navigator.userAgent) || /Windows Phone/i.test(window.navigator.userAgent) || /BlackBerry/i.test(window.navigator.userAgent) || /BB10/i.test(window.navigator.userAgent) || /Android.*Mobile/i.test(window.navigator.userAgent) ? !1 : !0 }, a.default_multiple_text = "Select Some Options", a.default_single_text = "Select an Option", a.default_no_result_text = "No results match", a }(), a = _MTS_JQUERY, a.fn.extend({ chosen: function (d) { return b.browser_is_supported() ? this.each(function (b) { var e, f; return e = a(this), f = e.data("chosen"), "destroy" === d ? void (f instanceof c && f.destroy()) : void (f instanceof c || e.data("chosen", new c(this, d))) }) : this } }), c = function (b) { function c() { return e = c.__super__.constructor.apply(this, arguments) } return h(c, b), c.prototype.setup = function () { return this.form_field_jq = a(this.form_field), this.current_selectedIndex = this.form_field.selectedIndex }, c.prototype.set_up_html = function () { var b, c; return b = ["chosen-container"], b.push("chosen-container-" + (this.is_multiple ? "multi" : "single")), this.inherit_select_classes && this.form_field.className && b.push(this.form_field.className), this.is_rtl && b.push("chosen-rtl"), c = { "class": b.join(" "), title: this.form_field.title }, this.form_field.id.length && (c.id = this.form_field.id.replace(/[^\w]/g, "_") + "_chosen"), this.container = a("<div />", c), this.container.width(this.container_width()), this.is_multiple ? this.container.html(this.get_multi_html()) : this.container.html(this.get_single_html()), this.form_field_jq.hide().after(this.container), this.dropdown = this.container.find("div.chosen-drop").first(), this.search_field = this.container.find("input").first(), this.search_results = this.container.find("ul.chosen-results").first(), this.search_field_scale(), this.search_no_results = this.container.find("li.no-results").first(), this.is_multiple ? (this.search_choices = this.container.find("ul.chosen-choices").first(), this.search_container = this.container.find("li.search-field").first()) : (this.search_container = this.container.find("div.chosen-search").first(), this.selected_item = this.container.find(".chosen-single").first()), this.results_build(), this.set_tab_index(), this.set_label_behavior() }, c.prototype.on_ready = function () { return this.form_field_jq.trigger("chosen:ready", { chosen: this }) }, c.prototype.register_observers = function () { var a = this; return this.container.bind("touchstart.chosen", function (b) { a.container_mousedown(b) }), this.container.bind("touchend.chosen", function (b) { a.container_mouseup(b) }), this.container.bind("mousedown.chosen", function (b) { a.container_mousedown(b) }), this.container.bind("mouseup.chosen", function (b) { a.container_mouseup(b) }), this.container.bind("mouseenter.chosen", function (b) { a.mouse_enter(b) }), this.container.bind("mouseleave.chosen", function (b) { a.mouse_leave(b) }), this.search_results.bind("mouseup.chosen", function (b) { a.search_results_mouseup(b) }), this.search_results.bind("mouseover.chosen", function (b) { a.search_results_mouseover(b) }), this.search_results.bind("mouseout.chosen", function (b) { a.search_results_mouseout(b) }), this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen", function (b) { a.search_results_mousewheel(b) }), this.search_results.bind("touchstart.chosen", function (b) { a.search_results_touchstart(b) }), this.search_results.bind("touchmove.chosen", function (b) { a.search_results_touchmove(b) }), this.search_results.bind("touchend.chosen", function (b) { a.search_results_touchend(b) }), this.form_field_jq.bind("chosen:updated.chosen", function (b) { a.results_update_field(b) }), this.form_field_jq.bind("chosen:activate.chosen", function (b) { a.activate_field(b) }), this.form_field_jq.bind("chosen:open.chosen", function (b) { a.container_mousedown(b) }), this.form_field_jq.bind("chosen:close.chosen", function (b) { a.close_field(b) }), this.search_field.bind("blur.chosen", function (b) { a.input_blur(b) }), this.search_field.bind("keyup.chosen", function (b) { a.keyup_checker(b) }), this.search_field.bind("keydown.chosen", function (b) { a.keydown_checker(b) }), this.search_field.bind("focus.chosen", function (b) { a.input_focus(b) }), this.search_field.bind("cut.chosen", function (b) { a.clipboard_event_checker(b) }), this.search_field.bind("paste.chosen", function (b) { a.clipboard_event_checker(b) }), this.is_multiple ? this.search_choices.bind("click.chosen", function (b) { a.choices_click(b) }) : this.container.bind("click.chosen", function (a) { a.preventDefault() }) }, c.prototype.destroy = function () { return a(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action), this.form_field_label.length > 0 && this.form_field_label.unbind("click.chosen"), this.search_field[0].tabIndex && (this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex), this.container.remove(), this.form_field_jq.removeData("chosen"), this.form_field_jq.show() }, c.prototype.search_field_disabled = function () { return this.is_disabled = this.form_field.disabled || this.form_field_jq.parents("fieldset").is(":disabled"), this.container.toggleClass("chosen-disabled", this.is_disabled), this.search_field[0].disabled = this.is_disabled, this.is_multiple || this.selected_item.unbind("focus.chosen", this.activate_field), this.is_disabled ? this.close_field() : this.is_multiple ? void 0 : this.selected_item.bind("focus.chosen", this.activate_field) }, c.prototype.container_mousedown = function (b) { var c; if (!this.is_disabled) return !b || "mousedown" !== (c = b.type) && "touchstart" !== c || this.results_showing || b.preventDefault(), null != b && a(b.target).hasClass("search-choice-close") ? void 0 : (this.active_field ? this.is_multiple || !b || a(b.target)[0] !== this.selected_item[0] && !a(b.target).parents("a.chosen-single").length || (b.preventDefault(), this.results_toggle()) : (this.is_multiple && this.search_field.val(""), a(this.container[0].ownerDocument).bind("click.chosen", this.click_test_action), this.results_show()), this.activate_field()) }, c.prototype.container_mouseup = function (a) { return "ABBR" !== a.target.nodeName || this.is_disabled ? void 0 : this.results_reset(a) }, c.prototype.search_results_mousewheel = function (a) { var b; return a.originalEvent && (b = a.originalEvent.deltaY || -a.originalEvent.wheelDelta || a.originalEvent.detail), null != b ? (a.preventDefault(), "DOMMouseScroll" === a.type && (b = 40 * b), this.search_results.scrollTop(b + this.search_results.scrollTop())) : void 0 }, c.prototype.blur_test = function (a) { return !this.active_field && this.container.hasClass("chosen-container-active") ? this.close_field() : void 0 }, c.prototype.close_field = function () { return a(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action), this.active_field = !1, this.results_hide(), this.container.removeClass("chosen-container-active"), this.clear_backstroke(), this.show_search_field_default(), this.search_field_scale(), this.search_field.blur() }, c.prototype.activate_field = function () { return this.is_disabled ? void 0 : (this.container.addClass("chosen-container-active"), this.active_field = !0, this.search_field.val(this.search_field.val()), this.search_field.focus()) }, c.prototype.test_active_click = function (b) { var c; return c = a(b.target).closest(".chosen-container"), c.length && this.container[0] === c[0] ? this.active_field = !0 : this.close_field() }, c.prototype.results_build = function () { return this.parsing = !0, this.selected_option_count = null, this.results_data = d.select_to_array(this.form_field), this.is_multiple ? this.search_choices.find("li.search-choice").remove() : this.is_multiple || (this.single_set_selected_text(), this.disable_search || this.form_field.options.length <= this.disable_search_threshold ? (this.search_field[0].readOnly = !0, this.container.addClass("chosen-container-single-nosearch")) : (this.search_field[0].readOnly = !1, this.container.removeClass("chosen-container-single-nosearch"))), this.update_results_content(this.results_option_build({ first: !0 })), this.search_field_disabled(), this.show_search_field_default(), this.search_field_scale(), this.parsing = !1 }, c.prototype.result_do_highlight = function (a) { var b, c, d, e, f; if (a.length) { if (this.result_clear_highlight(), this.result_highlight = a, this.result_highlight.addClass("highlighted"), d = parseInt(this.search_results.css("maxHeight"), 10), f = this.search_results.scrollTop(), e = d + f, c = this.result_highlight.position().top + this.search_results.scrollTop(), b = c + this.result_highlight.outerHeight(), b >= e) return this.search_results.scrollTop(b - d > 0 ? b - d : 0); if (f > c) return this.search_results.scrollTop(c) } }, c.prototype.result_clear_highlight = function () { return this.result_highlight && this.result_highlight.removeClass("highlighted"), this.result_highlight = null }, c.prototype.results_show = function () { return this.is_multiple && this.max_selected_options <= this.choices_count() ? (this.form_field_jq.trigger("chosen:maxselected", { chosen: this }), !1) : (this.container.addClass("chosen-with-drop"), this.results_showing = !0, this.search_field.focus(), this.search_field.val(this.get_search_field_value()), this.winnow_results(), this.form_field_jq.trigger("chosen:showing_dropdown", { chosen: this })) }, c.prototype.update_results_content = function (a) { return this.search_results.html(a) }, c.prototype.results_hide = function () { return this.results_showing && (this.result_clear_highlight(), this.container.removeClass("chosen-with-drop"), this.form_field_jq.trigger("chosen:hiding_dropdown", { chosen: this })), this.results_showing = !1 }, c.prototype.set_tab_index = function (a) { var b; return this.form_field.tabIndex ? (b = this.form_field.tabIndex, this.form_field.tabIndex = -1, this.search_field[0].tabIndex = b) : void 0 }, c.prototype.set_label_behavior = function () { return this.form_field_label = this.form_field_jq.parents("label"), !this.form_field_label.length && this.form_field.id.length && (this.form_field_label = a("label[for='" + this.form_field.id + "']")), this.form_field_label.length > 0 ? this.form_field_label.bind("click.chosen", this.label_click_handler) : void 0 }, c.prototype.show_search_field_default = function () { return this.is_multiple && this.choices_count() < 1 && !this.active_field ? (this.search_field.val(this.default_text), this.search_field.addClass("default")) : (this.search_field.val(""), this.search_field.removeClass("default")) }, c.prototype.search_results_mouseup = function (b) { var c; return c = a(b.target).hasClass("active-result") ? a(b.target) : a(b.target).parents(".active-result").first(), c.length ? (this.result_highlight = c, this.result_select(b), this.search_field.focus()) : void 0 }, c.prototype.search_results_mouseover = function (b) { var c; return c = a(b.target).hasClass("active-result") ? a(b.target) : a(b.target).parents(".active-result").first(), c ? this.result_do_highlight(c) : void 0 }, c.prototype.search_results_mouseout = function (b) { return a(b.target).hasClass("active-result") ? this.result_clear_highlight() : void 0 }, c.prototype.choice_build = function (b) { var c, d, e = this; return c = a("<li />", { "class": "search-choice" }).html("<span>" + this.choice_label(b) + "</span>"), b.disabled ? c.addClass("search-choice-disabled") : (d = a("<a />", { "class": "search-choice-close", "data-option-array-index": b.array_index }), d.bind("click.chosen", function (a) { return e.choice_destroy_link_click(a) }), c.append(d)), this.search_container.before(c) }, c.prototype.choice_destroy_link_click = function (b) { return b.preventDefault(), b.stopPropagation(), this.is_disabled ? void 0 : this.choice_destroy(a(b.target)) }, c.prototype.choice_destroy = function (a) { return this.result_deselect(a[0].getAttribute("data-option-array-index")) ? (this.active_field ? this.search_field.focus() : this.show_search_field_default(), this.is_multiple && this.choices_count() > 0 && this.get_search_field_value().length < 1 && this.results_hide(), a.parents("li").first().remove(), this.search_field_scale()) : void 0 }, c.prototype.results_reset = function () { return this.reset_single_select_options(), this.form_field.options[0].selected = !0, this.single_set_selected_text(), this.show_search_field_default(), this.results_reset_cleanup(), this.trigger_form_field_change(), this.active_field ? this.results_hide() : void 0 }, c.prototype.results_reset_cleanup = function () { return this.current_selectedIndex = this.form_field.selectedIndex, this.selected_item.find("abbr").remove() }, c.prototype.result_select = function (a) { var b, c; return this.result_highlight ? (b = this.result_highlight, this.result_clear_highlight(), this.is_multiple && this.max_selected_options <= this.choices_count() ? (this.form_field_jq.trigger("chosen:maxselected", { chosen: this }), !1) : (this.is_multiple ? b.removeClass("active-result") : this.reset_single_select_options(), b.addClass("result-selected"), c = this.results_data[b[0].getAttribute("data-option-array-index")], c.selected = !0, this.form_field.options[c.options_index].selected = !0, this.selected_option_count = null, this.is_multiple ? this.choice_build(c) : this.single_set_selected_text(this.choice_label(c)), (!this.is_multiple || this.hide_results_on_select && !a.metaKey && !a.ctrlKey) && (this.results_hide(), this.show_search_field_default()), (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) && this.trigger_form_field_change({ selected: this.form_field.options[c.options_index].value }), this.current_selectedIndex = this.form_field.selectedIndex, a.preventDefault(), this.search_field_scale())) : void 0 }, c.prototype.single_set_selected_text = function (a) { return null == a && (a = this.default_text), a === this.default_text ? this.selected_item.addClass("chosen-default") : (this.single_deselect_control_build(), this.selected_item.removeClass("chosen-default")), this.selected_item.find("span").html(a) }, c.prototype.result_deselect = function (a) { var b; return b = this.results_data[a], this.form_field.options[b.options_index].disabled ? !1 : (b.selected = !1, this.form_field.options[b.options_index].selected = !1, this.selected_option_count = null, this.result_clear_highlight(), this.results_showing && this.winnow_results(), this.trigger_form_field_change({ deselected: this.form_field.options[b.options_index].value }), this.search_field_scale(), !0) }, c.prototype.single_deselect_control_build = function () { return this.allow_single_deselect ? (this.selected_item.find("abbr").length || this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'), this.selected_item.addClass("chosen-single-with-deselect")) : void 0 }, c.prototype.get_search_field_value = function () { return this.search_field.val() }, c.prototype.get_search_text = function () { return this.escape_html(a.trim(this.get_search_field_value())) }, c.prototype.escape_html = function (b) { return a("<div/>").text(b).html() }, c.prototype.winnow_results_set_highlight = function () { var a, b; return b = this.is_multiple ? [] : this.search_results.find(".result-selected.active-result"), a = b.length ? b.first() : this.search_results.find(".active-result").first(), null != a ? this.result_do_highlight(a) : void 0 }, c.prototype.no_results = function (a) { var b; return b = this.get_no_results_html(a), this.search_results.append(b), this.form_field_jq.trigger("chosen:no_results", { chosen: this }) }, c.prototype.no_results_clear = function () { return this.search_results.find(".no-results").remove() }, c.prototype.keydown_arrow = function () { var a; return this.results_showing && this.result_highlight ? (a = this.result_highlight.nextAll("li.active-result").first()) ? this.result_do_highlight(a) : void 0 : this.results_show() }, c.prototype.keyup_arrow = function () { var a; return this.results_showing || this.is_multiple ? this.result_highlight ? (a = this.result_highlight.prevAll("li.active-result"), a.length ? this.result_do_highlight(a.first()) : (this.choices_count() > 0 && this.results_hide(), this.result_clear_highlight())) : void 0 : this.results_show() }, c.prototype.keydown_backstroke = function () { var a; return this.pending_backstroke ? (this.choice_destroy(this.pending_backstroke.find("a").first()), this.clear_backstroke()) : (a = this.search_container.siblings("li.search-choice").last(), a.length && !a.hasClass("search-choice-disabled") ? (this.pending_backstroke = a, this.single_backstroke_delete ? this.keydown_backstroke() : this.pending_backstroke.addClass("search-choice-focus")) : void 0) }, c.prototype.clear_backstroke = function () { return this.pending_backstroke && this.pending_backstroke.removeClass("search-choice-focus"), this.pending_backstroke = null }, c.prototype.search_field_scale = function () { var b, c, d, e, f, g, h, i; if (this.is_multiple) { for (e = { position: "absolute", left: "-1000px", top: "-1000px", display: "none", whiteSpace: "pre" }, f = ["fontSize", "fontStyle", "fontWeight", "fontFamily", "lineHeight", "textTransform", "letterSpacing"], h = 0, i = f.length; i > h; h++)d = f[h], e[d] = this.search_field.css(d); return c = a("<div />").css(e), c.text(this.get_search_field_value()), a("body").append(c), g = c.width() + 25, c.remove(), b = this.container.outerWidth(), g = Math.min(b - 10, g), this.search_field.width(g) } }, c.prototype.trigger_form_field_change = function (a) { return this.form_field_jq.trigger("input", a), this.form_field_jq.trigger("change", a) }, c }(b) }).call(this);
﻿var mobileTab="news",_autocompIdx=-1,_acTimer=-1,_ajaxSpinTimer=null;$(document).on("click","#twitterConnect",function(){window.open("https://twitter.com/"+("undefined"!=typeof _twitterName&&0<_twitterName.length?_twitterName:"myteamscoop"),"_blank")}),$(document).on("click","#facebookConnect, #facebookClick",function(){window.open("https://www.facebook.com/"+("undefined"!=typeof _facebookName&&0<_facebookName.length?_facebookName:"MyTeamScoop"),"_blank")});var _submenu=[],_iPad=0<=navigator.userAgent.toLowerCase().search(/ipad/)||0<=navigator.userAgent.toLowerCase().search(/iphone/),_event="click",_event2="mouseenter",_curShareId=-1,_emailFrom="From (Required)",_emailReq="Recipients (Required)",_emailMsg="Check out this story I found at "+("undefined"!=typeof _portalName&&0<_portalName.length?_portalName+"!":"My Team Scoop!"),_emailMsgOpt="Personal Message (Optional)",_reqColor="#BBBBBB",_blkColor="#1D1D1D",_errorTxt="",_focusErr="",_typeCon=null,_showMenu=!1,_menuItem=[],_justSlided=!1,_adClicks=[],_defaultPortalSport=0,_doneLoading=!1,_hitTimer=!1,_filterPages=[],_filterKeys=[["#msNews","#newsInsert, #featuredContent, #news, #features, .fpvHeadHolder, .fPContainer, .videoWrap"],["#msMyTeams",".teamsFollowWrap"],["#msTeams","#teamList"],["#msStats","#filterMenu, #stats, .note1"],["#msScores","#scores, .note1, #scoreGridWidget"],["#msSchedules","#upcoming, #ucEvents, #upEvents, .note1"],["#msStandings","#filterMenu, #standings"],["#msSchools","#schoolList"]],_keyException=[8,37,38,39,40],_sm=0,_jsCachedSequence=[],_jsCacheBusy=!1,_chosenSupported="Microsoft Internet Explorer"===window.navigator.appName?8<=document.documentMode:!/iP(od|hone)/i.test(window.navigator.userAgent)&&(!/Android/i.test(window.navigator.userAgent)||!/Mobile/i.test(window.navigator.userAgent));function debounce(i,o,a){var r;return function(){var e=this,t=arguments,n=a&&!r;clearTimeout(r),r=setTimeout(function(){r=null,a||i.apply(e,t)},o),n&&i.apply(e,t)}}function isMobileMedia(){return window.matchMedia?window.matchMedia("(min-width: 320px)").matches&&window.matchMedia("(max-width: 767px)").matches:320<=window.innerWidth&&window.innerWidth<=767}function isTabletMedia(){return window.matchMedia?window.matchMedia("(min-width: 768px)").matches&&window.matchMedia("(max-width: 1024px)").matches:768<=window.innerWidth&&window.innerWidth<=1024}function isDesktopMedia(){return window.matchMedia?window.matchMedia("(min-width: 1025px)").matches:1025<=window.innerWidth}function GetQueryArrayFromUrl(e){var t=e.indexOf("?");if(""==e||t<0)return{};e=e.substr(t+1).split("&");for(var n={},i=0;i<e.length;++i){var o=e[i].split("=");2==o.length&&(n[o[0]]=decodeURIComponent(o[1].replace(/\+/g," ")))}return n}$.fn.center=function(){this.css("position","absolute");var e=($(window).height()-this.height())/2+$(window).scrollTop(),t=($(window).width()-this.width())/2+$(window).scrollLeft();return this.css("top",(0<e?e:0)+"px"),this.css("left",(0<t?t:0)+"px"),this},jQuery.Query=GetQueryArrayFromUrl(window.location.search),jQuery.urlName=function(e){return e.replace(_MTS_urlRegex,"-").replace(/ /g,"-").replace(/\-+/g,"-")};var _isFileInputSupported=!navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0)|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|Pre\/1.2|Kindle\/(1.0|2.0|2.5|3.0))/),_noFileReaderSupport=void 0===window.FileReader||void 0===window.File||void 0===window.FileList||void 0===window.Blob;function AlertCycle(){this.parent=null,this.frames=0,this.callback=function(){},this.last=new Date,this.index=0,this.delay=0,this.drop=0}AlertCycle.prototype={init:function(e,t){this.index=0,this.frames=$(".alertItem").length,this.delay=5e3,this.drop=7500,this.last=new Date;var n=this;setInterval(function(){n.timer()},this.delay)},timer:function(){var e,t=new Date;t-this.last>this.drop||(this.last=t,e=this.index++,this.index>=this.frames&&(this.index=0),this.index!=e&&(this.anim(),this.last=t))},anim:function(){var e=this;$("#alertsBody").animate({"margin-top":"30px"},100,"swing",function(){$("#alertsBody").html($("#alert_item_"+e.index).html()),$("#alertsBody").animate({"margin-top":"0px"},100,"swing",function(){})})}},"refresh"==window.name&&(window.stop(),window.location.replace(window.location.pathname+window.location.search+window.location.hash),window.name="");var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version",this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(e){for(var t=0;t<e.length;t++){var n=e[t].string,i=e[t].prop;if(this.versionSearchString=e[t].versionSearch||e[t].identity,n){if(-1!=n.indexOf(e[t].subString))return e[t].identity}else if(i)return e[t].identity}},searchVersion:function(e){var t=e.indexOf(this.versionSearchString);if(-1!=t)return parseFloat(e.substring(t+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera",versionSearch:"Version"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Internet Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.userAgent,subString:"iPad",identity:"iPad"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};function partial(t){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.concat(Array.prototype.slice.call(arguments));return t.apply(this,e)}}function mts_lazyloading(){$("img.mts_lazy").lazyload({failure_limit:$("img.mts_lazy").length-1,event:"mts_lazy"}),$(".mts_lazy:in-viewport").removeClass("mts_lazy")}function set_MTS_SaveHistoryState(e){"undefined"==typeof _MTS_SaveHistoryState&&(_MTS_SaveHistoryState=[]),_MTS_SaveHistoryState.push(e)}function _MTS_commonWidgetInit(){var e=$(".mobileSelectors");if(0<e.length&&"none"!=e.css("display")){switch(mobileTab){case"schedules":$("#msSchedules").click();break;case"scores":$("#msScores").click();break;default:$("#msNews").click()}0<$(".scores_list_widget:visible").length&&$(".scores_grid_widget").hide()}}function resizeNav(){isDesktopMedia()&&($("#mainContainer").show(),$("#content").show())}function resizeOnLoad(){"boolean"==typeof _registrationPop&&_registrationPop&&GetRegistrationPop(),resizeNav();var e=new Image;e.src=$("#logo").attr("src"),e.onload=function(){$("#headContainer"),$("#logo").outerHeight(),$(".navigationContainer"),$(".masterMcWrap"),$(".sportsContainer"),$(".centeredAd"),$(".hpCtr"),$("#page"),$("#logo");var e=$(".searchBar"),e=($(".searchBar .chosen-container, .searchBar select"),$(".hSignLog"),e.position().left,$("#header"));parseInt(e.css("padding-left"));$(".mts_widget:empty").hide();e=$(".teamsFollowWrap");0==e.children().length&&(e.hide(),$(".myTeamsHeader").hide())}}function GetRegistrationPop(){null==readCookie("popupTimeout")&&ajax("/Content/regPromo.aspx",[],function(e){$("body").append(e),$("#regPromoContentCtr, .rpBg").click(function(){HideRegistrationPop(7)}),$("#regPromoContentCtr #signUpNow").click(function(e){e.stopPropagation(),GotoRegistration()}),$("#regPromoContentCtr #signInNow").click(function(e){e.stopPropagation(),GotoLogin()}),$("#regPromoContentCtr #never").click(function(e){e.stopPropagation(),HideRegistrationPop(365)})})}function createCookie(e,t,n){var i;i=n?((i=new Date).setTime(i.getTime()+24*n*60*60*1e3),"; expires="+i.toGMTString()):"",document.cookie=e+"="+t+i+"; path=/"}function readCookie(e){for(var t=e+"=",n=document.cookie.split(";"),i=0;i<n.length;i++){for(var o=n[i];" "==o.charAt(0);)o=o.substring(1,o.length);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return null}function HideRegistrationPop(e){createCookie("popupTimeout","",e),$(".rpBg, #regPromoContentCtr").fadeTo(1e3,0,function(){$(this).hide()})}function GotoRegistration(){window.location="/user/register/"}function GotoLogin(){window.location=$("#loginBottom").attr("href")}function HighlightAutoComplete(e,t){for(var n=e-1;0<=n;n--){var i=$(t.children()[n]);n==_autocompIdx?i.addClass("highlight"):i.removeClass("highlight")}}function SubmitSearch(){var e=$("#searchFrm"),t=$("#searchType"),t=0<t.length?t[0].options:"";0<t.length&&e.attr("action",ReplaceQueryParameter(e.attr("action"),"type",t[t.selectedIndex].value)),e.submit()}function StartAutoComplete(me,a,action,attach){if(0<me.value.length){var p=[];p.push({name:"phrase",value:me.value}),p.push({name:"ac",value:1}),p.push({name:"gz",value:"t"}),p.push({name:"s",value:"0"}),p.push({name:"rt",value:-1}),p.push({name:"n",value:5}),p.push({name:"sport",value:-1}),p.push({name:"incHid",value:"f"});var filters=$("#searchType");if(0<filters.length){var types=[],options=filters[0].options;if("All"==filters.val())for(var i=options.length-1;1<=i;i--)types.push(options[i].value);else types.push(options[options.selectedIndex].value);0<types.length&&p.push({name:"types",value:types}),ajax("/api/search.aspx",p,function(r){var o;if(eval("o = "+r+";"),0!=o.items.length){a.html("");var attachTarget=void 0!==attach?attach:$(".searchBar"),sbh=attachTarget.height(),sbt=attachTarget.offset().top,sbl=attachTarget.offset().left;a.css({top:sbt+sbh+10+"px"}),a.css({left:sbl+"px"}),a.show();for(var e=null,i=0;i<o.items.length;i++)e=document.createElement("a"),e.className="itm",e.innerHTML=o.items[i].title,e.id=o.items[i].id,e.href=o.items[i].link,a.append(e)}else $("#acomp").css({display:"none"})})}}}function GetSportFromId(e){if(null==typeof _sports)return e;for(var t=_sports.length-1;0<=t;t--)if(_sports[t].Id==e)return _sports[t].UrlName;return e}function GetLevelFromId(e){if(null==typeof _levels)return e;for(var t=_levels.length-1;0<=t;t--)if(_levels[t].Id==e)return _levels[t].UrlName;return e}function GetGenderFromId(e){return null==typeof _genders||_genders.length<e?e:_genders[e]}function CreateMenuClick(e,t){var n,i=t.split(",");for(n in i)if(!(i[n].length<=0)){var o,a=!1;for(o in _filterPages)if($.trim(i[n])==_filterPages[o]){a=!0;break}a||_filterPages.push($.trim(i[n]))}$(e).click(function(){FilterContent(t)})}function ToggleMobileMenu(){$(".topTabs").toggleClass("topTabsO")}function FilterContent(e){for(var t=_filterPages.length-1;0<=t;t--)$(_filterPages[t]).hide();$(e).show()}function TrackImpression(e,t){TrackingEvent("impression","DFP Impression",e,1)}function TrackClick(e){TrackingEvent("click","DFP Click",e,1)}function TrackPhoto(e){TrackingEvent("click","Photo Click","IMG "+e,1)}function TrackingEvent(e,t,n,i){"undefined"!=typeof ga&&ga("send","event",n,e,t,i,!0),"undefined"!=typeof _gaq&&_gaq.push(["_trackEvent",t,n])}function HideAd(){var e=$(".fullAdView"),t=$(".fullPageAd");e.fadeTo(600,0,function(){e.hide()}),t.fadeTo(600,0,function(){t.hide()})}function AdHeight(e){var t=e-100;0<t&&setTimeout(function(){AdHeight(e)},t)}function AdjustAdHeight(){var e=$(".fullAdView");0<e.length&&e.css({height:window.innerHeight+window.outerHeight||document.height||$(document).height()})}function PositionDropdown(e,t){var n=$(e),e=(t.offset(),$("#mainContainer").offset());t.css({top:n.offset().top+n.outerHeight()-e.top+"px",left:n.offset().left-e.left+"px"})}function CreateSearchButton(t,e,n){t.focus(function(){var t=$(this);t.select(),window.setTimeout(function(){t.select()},1),t.mouseup(function e(){return t.off("mouseup",e),!1})}),e.click(function(){PerformSearch(t,n)}),t.keyup(function(e){13==e.keyCode&&PerformSearch(t,n)})}function PerformSearch(e,t){e=$.trim(e.val());0<e.length&&(window.location=t+encodeURIComponent(escape(e)))}function CheckAdClick(e){for(var t=_adClicks.length-1;0<=t;t--)if(e==_adClicks[t])return!1;return _adClicks.push(e),!0}function SaveToHistory(){try{if(window.self!==window.top)return}catch(e){return}var e=JSON.parse(sessionStorage.getItem("history"));null==e&&(e=[]);var t=parseInt(sessionStorage.getItem("lastPg")),n="true"==sessionStorage.getItem("back"),i=parseInt(sessionStorage.getItem("histLength"));if(0==window.performance.navigation.type&&null!=t&&!n){for(var o=-1,a=e.length-1;0<=a;a--)if(e[a].id==t){o=a;break}0<=a&&(e=e.splice(0,a+1))}if(null!=history&&"object"==typeof history&&null!==history.state){var r=$.grep(history.state,function(e){return"historyId"==e.name}),n=$.grep(history.state,function(e){return"histCount"==e.name});0<r.length&&(_MTS_pageId=r[0].value);for(o=-1,a=e.length-1;0<=a;a--)if(e[a].id==_MTS_pageId&&e[a].pg==_MTS_pageVP){o=a;break}0<n.length&&0<=o&&(_MTS_histCount=n[0].value,e[o].count=n[0].value)}else 0==window.performance.navigation.type&&(0<e.length&&e[e.length-1].pg==_MTS_pageVP?(_MTS_pageId=e[e.length-1].id,history.length!==i&&e[e.length-1].count++,_MTS_histCount=e[e.length-1].count):(0<e.length&&(_MTS_pageId=e[e.length-1].id+1),_MTS_histCount=1,e.push({id:_MTS_pageId,pg:_MTS_pageVP,count:_MTS_histCount})));sessionStorage.setItem("history",JSON.stringify(e)),sessionStorage.setItem("lastPg",_MTS_pageId),sessionStorage.setItem("back",!1),sessionStorage.setItem("histLength",history.length)}function BackAndRefresh(){if("undefined"==typeof mts_androidApp){(null==window.history||window.history.length<=1)&&window.close();var e=JSON.parse(sessionStorage.getItem("history")),t=-1;if(null!=e){for(var n=0,i=e.length-1;0<=i&&(e[i].id==_MTS_pageId||e[i].pg==_MTS_pageVP||0<=e[i].pg.indexOf("~/Login.aspx")||0<=e[i].pg.indexOf("~/Register.aspx"));i--)n--;t=n}window.name="refresh",sessionStorage.setItem("back",!0),window.history.go(t)}else mts_androidApp.BackAndRefresh()}function HoverMenu(e,t,n){if($(window).width()<=768)return!1;for(var i=-1,o=_menuItem.length-1;0<=o;o--)if(_menuItem[o].id==e&&_menuItem[o].type==t&&_menuItem[o].gender==n){i=o;break}-1==i&&(_menuItem.push({id:e,type:t,show:!1,loaded:!1,loading:!1,gender:n}),i=_menuItem.length-1),LoadMenu(i,t,n)}function UnhoverMenu(e,t,n){for(var i=_menuItem.length-1;0<=i;i--)if(_menuItem[i].id==e&&_menuItem[i].type==t&&(null==n||_menuItem[i].gender==n))return _menuItem[i].show=!1}function holdMenu(){_justSlided=_showMenu=!0,setTimeout(function(){_justSlided=!1},400)}function slideMenu(e,t){var n;null!=_typeCon&&(n=_typeCon[0].scrollHeight-_typeCon[0].clientHeight,_typeCon.scrollTop(n-n*(t.value/100)))}function LoadMenu(t,n,i){return 1!=_menuItem[t].show&&(_menuItem[t].show=!0,!_menuItem[t].loading&&(_menuItem[t].loading=!0,void setTimeout(function(){var e;1==_menuItem[t].show?((e=$(".menuDrop")).find(".featuredStoryContainer").remove(),e.find(".recentHeadlinesContainer").remove(),e.find(".noHeadlines").remove(),1==_menuItem[t].loaded?(e.append($("#"+n+"_"+_menuItem[t].id+(null!=i?"_"+i:"")).html()),_menuItem[t].loading=!1):((e=[]).push({name:"mode",value:n}),e.push({name:"menuId",value:_menuItem[t].id}),null!=_menuItem[t].gender&&e.push({name:"gender",value:_menuItem[t].gender}))):_menuItem[t].loading=!1},400)))}function HidePopupMenu(e){return!_justSlided&&(_showMenu=!1,e?($(".menuDropBg").removeClass("menuDropBgShow").removeAttr("style"),!1):void setTimeout(function(){_showMenu||($(".menuDropBg").removeClass("menuDropBgShow"),$("#div-gpt-ad-728x90_ad_container").show())},125))}function CheckEmailAddress(e){var t=new RegExp(/^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i);return!!e.match(t)}function CheckForm(e,t){if(e==_emailReq)return _errorTxt="You have entered an invalid email address.",_focusErr=$("#emailList"),!1;if(-1==_userId&&t==_emailFrom)return _errorTxt="The from field is required when not logged in.",_focusErr=$("#emailFrom"),!1;for(var n=e.split(";"),i=0;i<n.length;i++)for(var o=n[i].split(","),a=0;a<o.length;a++)if(!CheckEmailAddress(o[a].trim()))return _errorTxt="You have entered an invalid email address.",_focusErr=$("#emailList"),!1;return!0}BrowserDetect.init(),"boolean"==typeof _MTS_fireCommon&&!_MTS_fireCommon||(window.fbAsyncInit=function(){FB.init({appId:_fbClientId,channelUrl:_baseUri+"auth/facebook/channel.htm",status:!0,cookie:!0,xfbml:!0})},function(e){var t="facebook-jssdk",n=e.getElementsByTagName("script")[0];e.getElementById(t)||((e=e.createElement("script")).id=t,e.async=!0,e.src="//connect.facebook.net/en_US/all.js",n.parentNode.insertBefore(e,n))}(document),"boolean"==typeof _loadTwitterSDK&&null!=_loadTwitterSDK&&!1===_loadTwitterSDK&&(void 0===window.FileReader||"Opera"==BrowserDetect.browser||_iPad||"Safari"==BrowserDetect.browser||(_loadTwitterSDK=!0)),"boolean"==typeof _loadTwitterSDK&&null!=_loadTwitterSDK&&!_loadTwitterSDK||function(e,t,n){var i=e.getElementsByTagName(t)[0];e.getElementById(n)||((t=e.createElement(t)).id=n,t.src="https://platform.twitter.com/widgets.js",i.parentNode.insertBefore(t,i))}(document,"script","twitter-wjs")),$(window).bind("load",function(){_doneLoading=!0,_hitTimer&&HideAd(),AdjustAdHeight()}),$(document).on("widgetsloaded",mts_lazyloading),$(window).on("unload",function(){var e;"undefined"!=typeof _MTS_SaveHistoryState&&$(_MTS_SaveHistoryState).each(function(e,t){t()}),null!=history&&"object"==typeof history&&null!=history.replaceState&&"function"==typeof history.replaceState&&(null==(e=history.state)&&(e=[]),0==$.grep(e,function(e){return"historyId"==e.name}).length&&"undefined"!=typeof _MTS_pageId&&e.push({name:"historyId",value:_MTS_pageId}),0==$.grep(e,function(e){return"histCount"==e.name}).length&&"undefined"!=typeof _MTS_histcount&&e.push({name:"histCount",value:_MTS_histCount}),history.replaceState(e,""))}),$(document).one("widgetsloaded",function(){if(SaveToHistory(),leftRight(),$(window).resize(function(){leftRight(),window.matchMedia("(min-width: 1024px)").matches&&($(".hpCtr, .navigationContainer").removeClass("mainNavO"),"boolean"==typeof _MTS_customDropdown&&!_MTS_customDropdown||ToggleCustomDropdowns())}),$(".betaIndicator").click(function(){$(this).hide()}),WireLockingNotice(),"boolean"==typeof _MTS_fireCommon&&!_MTS_fireCommon)return!1;var er,appUrl;"boolean"==typeof _warnAboutRejected&&_warnAboutRejected&&(er=$(".emailRejected"),er.show(),$(".rejectHide").click(function(){er.hide()})),"boolean"==typeof _MTS_customDropdown&&!_MTS_customDropdown||ToggleCustomDropdowns(),"function"==typeof $.smartbanner&&(appUrl=_webUri+"images/custom/"+_portalId+"/AppIcon40.png",$.smartbanner()),$(window).width()<768&&319<$(window).width()&&$(".note1").click(function(){var e=$("#options");"none"==e.css("display")?e.show():e.hide()});var fav=$(".fullAdView"),adLength=5e3,sa;AdHeight(adLength),0<fav.length&&(sa=$("#skipAd"),sa.slideToggle(),sa.click(function(){HideAd()}),setTimeout(function(){_hitTimer=!0,_doneLoading&&HideAd()},adLength));var bbr=$("#backBtnRef");(null==window.history||window.history.length<=1)&&bbr.html("Close"),bbr.click(function(){BackAndRefresh()}),21!=_portalId&&$(document).on(_event,".grdImgBot",function(){var e=$(".sportsContainer");e.animate({scrollTop:e.scrollTop()+e.height()})}),$(".closeSpinner, .busySpinnerBg").click(function(){$(".busySpinnerBg").hide()}),$(document).on(_event,"#linkToScores",function(){var e,t,n=$("#scoreLink"),i=$("#sport"),o=0<i.length?i.val():void 0!==_sm?_sm:-1;0<n.length&&o<=0?window.location=n.attr("href"):(t="object"==typeof _date&&null!=_date?_date:new Date,e="object"==typeof _endDate&&null!=_endDate?_endDate:new Date(t.getFullYear(),t.getMonth(),t.getDate()-6),i=t.getMonth()+1+"-"+t.getDate()+"-"+t.getFullYear(),n=e.getMonth()+1+"-"+e.getDate()+"-"+e.getFullYear(),e=t="","undefined"!=typeof _filterType&&"undefined"!=typeof _filterId&&"school"===_filterType.toLowerCase()&&(e=_filterId),t="undefined"!=typeof _curGender?getDescription(o,0<$("#level option").length?$("#level").val():1,e,_curGender,!1)+"?start="+n+"&end="+i:0<_defaultPortalSport?getDescription(_defaultPortalSport,1,e,0,!1)+"?start="+n+"&end="+i:getDescription(0,1,e,0,!1)+"?start="+i+"&end="+i,window.location=_MTS_SITEURL+"scores"+t)}),$("#fbLogin, #fbCont").click(function(){FB.login(function(t){t.authResponse&&FB.api("/me?fields=first_name,last_name,gender,email",function(e){window.location="/auth/facebook/oauth2.aspx?fbId="+t.authResponse.userID+"&email="+e.email+"&first="+e.first_name+"&last="+e.last_name+"&gender="+e.gender+"&ret="+_fbTarget})},{scope:"email"})});var search="#searchTxt";$(document).on("keypress",search,function(e){var t=$("#acomp");return 0!=t.length&&"none"!=t.attr("display")&&0!=t.children(".highlight").length||13!=e.keyCode||SubmitSearch(),!0}),$(document).on("keyup",search,function(e){var t=$("#acomp");0==t.length&&(t=$("<div id='acomp' />"),$(document.body).append(t));var n=t.children().length;hasChildren=0<n,altKeyCodes=[38,40,13],isUsingAltCode=!1;for(var i=altKeyCodes.length-1;0<=i;i--)if(altKeyCodes[i]==e.keyCode){isUsingAltCode=!0;break}isUsingAltCode&&hasChildren&&"none"!=t.css("display")?38==e.keyCode?(0==_autocompIdx?_autocompIdx=n-1:_autocompIdx--,HighlightAutoComplete(n,t)):40==e.keyCode?(_autocompIdx==n-1?_autocompIdx=0:_autocompIdx++,HighlightAutoComplete(n,t)):13==e.keyCode&&$(t.children()[_autocompIdx])[0].click():isUsingAltCode||(-1!=_acTimer&&(clearTimeout(_acTimer),_acTimer=-1),t=partial(StartAutoComplete,this,t),MTS_searchHelper(t))}),$(document).click(function(e){var t=$("#acomp");"none"!=t.css("display")&&e.target.id!=t.attr("id")&&t.hide()}),$(document).on(_event,"#searchBarBtn",function(){SubmitSearch()}),$(".subNav").hide(),$("#alertsArrow").click(function(){"0px"!=$("#alertDD").css("height")?$("#alertDD").css("height","0px"):$("#alertDD").css("height","auto")}),(new AlertCycle).init(),$(document).on(_event,".shareIcons",function(){var e=(t=this.id).split("_")[0],t=t.split("_")[1];"eShare"===e&&emailShare(t)}),$(document).on(_event,".shareIconsEmail, .emShare",function(){emailShare(this.id.split("_")[1])}),$(document).on(_event,"#emailCancel",function(){$(".emailBg").remove(),$(".emailTemplate").remove()}),$(document).on(_event,"#emailSend",function(){emailSend($.trim($("#emailList").val()),$.trim($("#emailMsg").val()),0<_userId?"":$.trim($("#emailFrom").val()),$(this).parent().find("#shareMode").val())}),$(document).on("focusin",".emailTxt",function(){this.value!=_emailReq&&this.value!=_emailMsg&&this.value!=_emailMsgOpt&&this.value!=_emailFrom||(this.value="",this.style.color=_blkColor)}),$(document).on("focusout",".emailTxt",function(){""==this.value&&(this.value="emailList"==this.id?_emailReq:"emailFrom"==this.id?_emailFrom:_emailMsgOpt,this.style.color=_reqColor)}),$(document).on("mouseenter",".itemAdd",function(){clearTimeout(timerRemove),$(".moreListCtr").show()});var dlc=$(".menuDropBg"),timerRemove=null,showClass="menuDropBgShow";function _MTS_handleMouseNav(e){var t,n,i,o,a;""!=$.trim(e.innerHTML)&&(e.parentNode.attributes.id&&"navbar"==e.parentNode.attributes.id.value||$(e).parent().hasClass("moreList"))&&($(e).hasClass("categoryItem")||$(e).hasClass("headerItem"))&&(clearTimeout(timerRemove),a=$(".mainNavContainerO"),i=$.trim($(e).find(".navType").html().replace(/<div>|<\/div>/gi,"")),t=e.id.split("_")[1],n=$(".featuredStoryContainer, .recentHeadlinesContainer"),"Sports"==i||"Schools"==i||"Leagues"==i||"District"==i?n.show():n.hide(),$(".mt").hide(),0<(_typeCon=$(".list_"+t)).length&&(_typeCon.show(),a.css({height:"0px"}),_showMenu=!0,-1==(a=$(".menuDropBg")).attr("class").indexOf("menuDropBgShow")&&(a.toggleClass("menuDropBgShow"),a.css({left:$(e).offset().left+"px"})),$("#menuText").html(i.toUpperCase()),a=$(".menuDropBgShow"),window.matchMedia("(min-width: 1024px)").matches?(o=$(e).position().left,0<$(e).parent(".moreList").length&&(o+=$(".moreListCtr").outerWidth()),i=$(".menuDropBgShow"),$(e).parent().hasClass("moreList")?i.css({right:"200px",left:"auto"}):i.css({left:o+"px"})):(a.removeAttr("style"),a.css({height:"100%"}),$(".masterMcwrap").toggleClass("menuDropBgShow")),21!=_portalId&&(o=$(".mt:visible").children(".mdItem").length,(a=$(".grdImgBot")).removeClass("grdImgBotHide"),o<9?a.addClass("grdImgBotHide"):a.removeClass("grdImgBotHide"))))}$(document).on("mouseleave",".mainNavContainer .item, .menuDropBg, .moreListCtr",function(){0<$(this).parent(".moreList").length||(clearTimeout(timerRemove),timerRemove=setTimeout(function(){window.matchMedia("(min-width: 1024px)").matches&&(dlc.removeClass(showClass),$(".moreListCtr").hide())},250))}),$(document).on("mouseenter",".menuDropBg, .moreListCtr",function(){clearTimeout(timerRemove)}),$(document).on(_event,".navCaret",function(e){e.preventDefault()}),$(document).on({click:function(){isDesktopMedia()||_MTS_handleMouseNav(this)},mouseenter:function(){isDesktopMedia()&&_MTS_handleMouseNav(this)}},".item"),$(document).on("mouseleave",".item",function(){HidePopupMenu()}),$(".menuDropBg").hover(function(){_showMenu=!0},function(){HidePopupMenu()}),$(".scrollerContainer").slider({create:slideMenu,orientation:"vertical",slide:slideMenu,stop:holdMenu,min:0,max:100,value:100}),$(document).on({mouseenter:function(){HoverMenu(this.id.split("_")[2],this.id.split("_")[1])},mouseleave:function(){UnhoverMenu(this.id.split("_")[2],this.id.split("_")[1])}},".dropDownElement, .dropDownArr"),$(document).on(_event,"#menuHeader",function(e){e.stopPropagation(),HidePopupMenu(!0),$(".mainNavContainerO").css({height:"auto"})});var myProfile=$(".myProfile"),phl;0<myProfile.length&&(phl=$(".myProfile").position().left,$(".profileHover").css({left:phl}),$(".myProfile").hover(function(){$(".profileHover").fadeTo("fast",1)},function(){$(".profileHover").fadeTo("fast",0)})),$(".shareTopIcon").click(function(){0==$(".sharingIcons").width()?$(".sharingIcons").animate({width:"192px"}):$(".sharingIcons").animate({width:"0px"})}),$(document).on(_event,".iA",function(e){e.stopPropagation();var e=$(this),t=$(e.parent().find("iframe")[0].contentWindow.document.body).find("a").attr("href"),e=e.width()+"x"+e.height();if(CheckAdClick(e))try{TrackClick("DFP-"+e)}catch(e){}setTimeout(function(){0<t.length&&window.open(t)},100)}),$("#OASFlashPeel").mousedown(function(e){if(CheckAdClick("peel"))try{TrackClick("DFP-Peel")}catch(e){}}),0<$("#dfp-pagepeel-oop_ad_container").length&&(($(window).width()<=1024||_iPad)&&$("#dfp-pagepeel-oop_ad_container").hide(),$(window).resize(function(){$(window).width()<=1024?$("#dfp-pagepeel-oop_ad_container").hide():$("#dfp-pagepeel-oop_ad_container").show()})),$(document).on(_event,".mobileMenuBtn",function(){$(".navigationContainer, .hpCtr").toggleClass("mainNavO").removeAttr("style"),$(".navigationContainer").show();var e=$("#mainContainer");"none"!==e.css("display")?e.hide():e.show();e=$("#content");"none"!==e.css("display")?e.hide():e.show()}),$(".msBtn").click(function(){$("#features").hide()});for(var i=_filterKeys.length-1;0<=i;i--)CreateMenuClick(_filterKeys[i][0],_filterKeys[i][1]);$(".mOptBtn").click(function(){$(".optionsContainer").toggleClass("optionsContainerO")});var masterBackBtn=$(".masterBackButton"),lg,hhpc,hc;null!=window.history&&1<window.history.length?masterBackBtn.click(function(){null!=window.history&&2<window.history.length&&(null!=document.referrer&&0<=document.referrer.indexOf("user/login")?window.history.go(-2):window.history.go(-1))}):masterBackBtn.hide(),$("#mctMnuBtn").click(function(){$(".topTabs").toggleClass("tto")}),$("#showMoreScoresMobile").click(function(){_MTS_ajaxPending=!0,$.ajax("/api/getPortalScoresMobile",[],function(e){alert(e)})}),$(document).on(_event,"#portalPost, #mPortalPost",function(){window.location="/news/editor/?mode=portal&sTag="+_sm}),$(document).on(_event,"#portalAdmin, #mPortalAdmin",function(){window.location="/admin/"}),$(document).on("DOMNodeInserted",".pac-container",function(){$(".pac-item, .pac-item span",this).addClass("needsclick")}),$(".layoutPreviewOverlay").click(function(){var p=confirm("Do you want to push this preview live?"),p;p?(p=[],p.param("id",$("#previewVal").val()),ajax("/api/portalAdmin/saveCustomLayout.aspx",p,function(ret){var o;eval("o = "+ret),o.ok?window.close():alert("Error : "+o.error)})):window.close()}),_portalId<1&&1024<$(window).width()&&(lg=$("#logo_image"),hhpc=$(".hpCtr"),hc=$("#headContainer, #headContainerL"),hhpc.css({top:"4px"}),hhpc.css({transform:"none","-webkit-transform":"none","-moz-transform":"none","-ms-transform":"none"})),resizeOnLoad(),$(".sportsContainer").scroll(function(){0<$(this).scrollTop()?$(".grdImgBot").addClass("grdImgBotHide"):$(".grdImgBot").removeClass("grdImgBotHide")}),noPortalVertNav(),setNav(),targetFirefoxHeader(),$(window).resize(setNav)}),_MTS_widgetsReady?_MTS_commonWidgetInit():$(document).bind(_MTS_widgetsReady,_MTS_commonWidgetInit);var _recaptchaLoaded=!1;function requireCaptcha(e,t){if(_recaptchaLoaded)return sendRecaptcha(n,t,e,0),!1;_recaptchaLoaded=!0;var n="6LfGm-cUAAAAADpBRiNHbpTrOzZMn9JcB2UPwhW2";(function(e,t){var n,i=document.createElement("script");i.setAttribute("src",e),t&&(i.onreadystatechange=i.onload=function(){n||t(),n=!0}),document.getElementsByTagName("head")[0].appendChild(i)})("https://www.google.com/recaptcha/api.js?render="+n,function(){sendRecaptcha(n,t,e,0)})}function sendRecaptcha(e,t,n,i){if(void 0===i)i=0;else if(20<i)return;"function"==typeof grecaptcha.execute?grecaptcha.execute(e,{action:t}).then(function(e){n(e)}):(i++,setTimeout(function(){sendRecaptcha(e,t,n,i)},250))}function emailSend(n,i,o,a){var e,r;CheckForm(n,o)?(e="number"==typeof _teamId&&0<_teamId,requireCaptcha(function(e){i==_emailMsgOpt&&(i="");var t=[];t.push({name:"shareId",value:_curShareId}),t.push({name:"emailList",value:n}),t.push({name:"emailMsg",value:i}),t.push({name:"from",value:o}),t.push({name:"recaptcha",value:e}),t.push({name:"action",value:r}),t.push({name:"mode",value:r}),"video"==a&&t.push({name:"playlistId",value:_playlistId}),_MTS_JQUERY.post("/api/sendShareEmail.aspx",t,function(e){e.ok&&($(".emailBg").remove(),$(".emailTemplate").remove())},"json")},r=a||(e?"newsItem":"portalNews"))):(alert(_errorTxt),_focusErr.focus(),_focusErr.select())}function emailShare(e){_curShareId=e;e="<div class='emailBg'><div class='emailTemplate' id='sendEmail'><div class='emailTempHead'>Share This Story</div>"+(0<_userId?"":"<input title='E-mail From' type='text' class='emailTxt' id='emailFrom' value='"+_emailFrom+"' />")+"<input title='E-mail List' type='text' class='emailTxt' id='emailList' value='"+_emailReq+"' /><textarea title='Email Message' class='emailTxtArea' id='emailMsg'>"+_emailMsg+"</textarea><div class='tempButtons'><div class='mts_cc_button tempButton' id='emailSend'>Send</div><div class='mts_cc_button tempButton' id='emailCancel'>Cancel</div></div></div > </div";$("body").append(e),$(".emailBg").show()}function DbToHtml(e){var t=[];return t.push({oldValue:"\n",newValue:"<br />"}),replace(e,t)}function HtmlToDb(e){var t=[];return t.push({oldValue:"<br />",newValue:"\n"}),t.push({oldValue:"<br>",newValue:"\n"}),t.push({oldValue:"<BR />",newValue:"\n"}),t.push({oldValue:"<BR>",newValue:"\n"}),replace(e,t)}function htmlEncode(e){return e?jQuery("<div />").text(e).html():""}function htmlDecode(e){return e?$("<div />").html(e).text():""}function replace(e,t){for(var n,i=0;i<t.length;i++)n=new RegExp(t[i].oldValue,"g"),e=e.replace(n,t[i].newValue);return e}function CenterElement(e){var t,n,i,o=$(e);0!==o.length&&(o[0].parentNode!==document.body&&(o[0].parentNode.removeChild(o[0]),document.body.appendChild(o[0])),n=$(window).width(),t=$(window).height(),i=o.outerWidth(),e=t/2-o.outerHeight()/2,t=n/2-i/2,n=$(document).scrollTop(),i=$(document).scrollLeft(),e+=n,o.css({left:(t+=i).toString()+"px",top:e.toString()+"px"}))}function getDescription(e,t,n,i,o){var a="/";if(0!=t?o?a+="Varsity":0<$("#level").length&&0<$("#level option").length?a+=$.trim($("#level option:selected").text()).replace(/ /g,"-"):"1"==t&&(a+="Varsity"):a+="All",0!=i||0!=n)switch(a+="/",i){default:a+="All";break;case 1:a+="Boys";break;case 2:a+="Girls";break;case 3:a+="Coed"}return 0!=e?(e="",a+="/",o?e=_defaultPortalSportName:0<$(".sportBanner").length?e=$(".sportBanner").text():0<$("#sport").length?0<=(e=$("#sport option:selected").text()).indexOf("Boys")||0<=e.indexOf("Coed")?e=e.substring(5):0<=e.indexOf("Girls")&&(e=e.substring(6)):e=_defaultPortalSportName,a+=$.trim(e).replace(/ /g,"-")):a+="/All",0!=n&&(n="",n=0<$(".schoolName").length?$.trim($(".schoolName").text()):(0<$("#school").length?$("#school option:selected"):$("#schoolDrop option:selected")).text(),a+="/"+$.trim(n).replace(/ /g,"-")),(a=""==(a=a.replace(/ /g,"-"))?"undefined":a).toLowerCase()}function mainLogClick(){(new PopupDialog).NewYesNoPrompt("Are you sure you want to log out?","Log Out",null,function(e,t,n){e&&(window.location="/SignOut.aspx")})}Array.prototype.param=function(e,t){this.push({name:e,value:t})},Array.prototype.contains=function(e){for(var t=this.length-1;0<=t;--t)if(this[t]===e)return!0;return!1};var _resizeSelectors=[],_readySpool=[],_spoolTimer=null;function SpoolTimeout(){if(0===_readySpool.length)return clearInterval(_spoolTimer),void(_spoolTimer=null);var e=_readySpool.pop();HeightResizer(e.selector,e.size,e.callback)}function PushToSpool(e,t,n){for(var i=!1,o=0;o<_readySpool.length;o++)if(_readySpool[o].selector===e&&_readySpool[o].size===t){i=!0;break}i||_readySpool.push({selector:e,size:t,callback:n}),null==_spoolTimer&&(_spoolTimer=setInterval(SpoolTimeout,10))}function AddResizeSelector(e,t,n){for(var i=!1,o=0;o<_resizeSelectors.length;o++)if(_resizeSelectors[o].selector===e&&_resizeSelectors[o].size===t){i=!0;break}i||(_resizeSelectors.push({selector:e,size:t,callback:n}),HeightResizer(e,t,n))}function SetThumbnailHeightFromWidth(e,t){AddResizeSelector(e,0,t)}function SetSlideHeightFromWidth(e){AddResizeSelector(e,1)}function SetTeamLogoHeightFromWidth(e){AddResizeSelector(e,3)}function HeightResizer(i,o,a){var r=$(i+":visible");0!==r.length&&("IMG"!=r[0].nodeName||r[0].complete&&void 0!==r[0].naturalWidth&&0!=r[0].naturalWidth)&&("IMG"==r[0].nodeName||0!=r.find("img").length&&r.find("img")[0].complete&&void 0!==r.find("img")[0].naturalWidth&&0!=r.find("img")[0].naturalWidth)?$(i).ready(function(){var e;if(0===o)e=_imageSizes.ThumbnailMxW,n=_imageSizes.ThumbnailMxH;else if(1===o)e=_imageSizes.SlideShowMxW,n=_imageSizes.SlideShowMxH;else{if(3!==o)return;e=_imageSizes.TeamLogoMxW,n=_imageSizes.TeamLogoMxH}var t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("id","customHeightcss"),document.getElementsByTagName("head")[0].appendChild(t),r.contents().filter(function(){return 3===this.nodeType}).remove(),r.children().contents().filter(function(){return 3===this.nodeType}).remove(),r.children().children().contents().filter(function(){return 3===this.nodeType}).remove();var n=document.createTextNode(i+" { height: "+Math.floor($($(i+":visible")[0]).width()/(e/n))+"px; }");$("#customHeightcss").append(n),"function"==typeof a&&a()}):PushToSpool(i,o,a)}function AdjustWrap(e,t){var n=$(e),i=$(t);0<n.length&&0<i.length&&(t=(e=GetElementWithMaxHeight(n)).outerHeight(!0),i.height("auto"),n.outerHeight(e.outerHeight()),e=Math.ceil(i.outerHeight(!0)/t),i.outerHeight(e*t-GrabMarginHeight(i)))}function GetElementWithMaxHeight(e){for(var t=null,n=null,i=e.length-1;0<=i;i--){var o=$(e[i]).outerHeight();(null==n||n<o)&&(t=i,n=o)}return $(e[t])}function GrabMarginHeight(e){var t=parseInt(e.css("margin-top")),e=parseInt(e.css("margin-bottom"));return(isNaN(t)?0:t)+(isNaN(e)?0:e)}function ValidateNumber(e){for(var e=e||window.event,t=e.keyCode||e.which,n=_keyException.length-1;0<=n;n--)if(_keyException[n]==t)return!1;t=String.fromCharCode(t);/[0-9]|\./.test(t)||(e.returnValue=!1,e.preventDefault&&e.preventDefault())}function loadJSCached(e){for(var t=$("script"),n=e.toLowerCase(),i=t.length-1;0<=i;i--)if(0<=t[i].src.toLowerCase().indexOf(n))return!1;_jsCachedSequence.push(e),startJSGrab()}function startJSGrab(){!_jsCacheBusy&&0<_jsCachedSequence.length&&loadJSCachedSequenced(_jsCachedSequence.shift())}function loadJSCachedSequenced(e){_jsCacheBusy=!0;var t=document.createElement("script");t.type="text/javascript",t.src=e,t.async=!1,document.getElementsByTagName("head")[0].appendChild(t),_jsCacheBusy=!1,startJSGrab()}function CreateAlertsCookie(){for(var e=$(".alertItem"),t="",n=0;n<e.length;n++)t+=e[n].id.split("_")[2]+(n!=e.length-1?",":"");var i=new Date;i.setTime(i.getTime()+2592e6);i="; expires="+i.toGMTString();document.cookie="alerts="+t+i+"; path=/"}function ToggleCustomDropdowns(e,t,n){$().chosen&&$(null==t?"select:visible":t).chosen({width:"number"==typeof e?e+"px":"240px",disable_search:null==n||n})}function ReplaceQueryParameter(e,t,n){var i=new RegExp("([?&])"+t+"=.*?(&|$)","i"),o=-1!==e.indexOf("?")?"&":"?";return e.match(i)?e.replace(i,"$1"+t+"="+n+"$2"):e+o+t+"="+n}function noPortalVertNav(){}function fireEmailRejected(){ajax("/api/changeEmailRejected.aspx",{},function(){alert("Your notifications have been turned off."),$(".emailRejected").hide()})}function WireLockingNotice(){var e=$("#mts_unlockstory");0<e.length&&e.click(function(){unlockStory()})}function unlockStory(t,e,n){var i=$("#mts_unlockstory"),o=[];o.push({name:"itemId",value:e}),o.push({name:"tagType",value:n}),$.post("/api/portalAdmin/unlockPortalNews.aspx",o,function(e){e.ok&&(i.slideToggle(),"function"==typeof t&&t())},"json")}function setNav(){if(!$("body").hasClass("vertical")&&!$("body").hasClass("mVertical")){var e=$(".navigationContainer"),t=$("#navbar.mainNavContainer"),n=$(".navigation_admin_menu_widget");if(window.matchMedia("(min-width: 1024px)").matches){$(".mobileNavItem, .mobileNavSection").hide(),$(".desktopNavItem").css("display","inline-block"),$(".desktopNavSection").css("display","block");for(var i=getHNavItemWidth(),o=i+(25==_MTS_PORTALID?0:n.outerWidth());o>e.outerWidth()&&1!=t.children(".item:visible:not('.mobileNavItem')").length;){var a=$("#navbar.mainNavContainer").children(".mnuHeading").last(),r=$("#navbar.mainNavContainer a.item:visible:not('.mobileNavItem, .moreList .item')").last();$(r).data("itemWidth",r.outerWidth()),a.prev().hasClass("itemAdd")||a.before("<div class='itemAdd'><span class='navType'>More</span><i class='fas fa-chevron-down moreItems'></i><div class='moreListCtr'><div class='moreList'></div></div></div>");var s=$(".moreList");r.detach(),r.prependTo(s),$(".itemAdd").show(),o=i=getHNavItemWidth()}for(r=(s=$(".moreList")).children(".item:not('.mobileNavItem')").first();o+$(r).data("itemWidth")<e.outerWidth();){if(r.detach(),$(".itemAdd").before(r),0==s.children(".item").length){$(".itemAdd").hide();break}o=i=getHNavItemWidth(),r=s.children(".item:not('.mobileNavItem')").first()}}else $(".mobileNavItem, .mobileNavSection").show(),$(".desktopNavItem, .desktopNavSection").hide(),(r=(s=$(".moreList")).children(".item")).detach(),$(".itemAdd").before(r),$(".itemAdd").hide()}}function getHNavItemWidth(){var e=$("#navbar.mainNavContainer a.item:visible:not('.mobileNavItem, .moreList .item')"),t=0;return e.each(function(){t+=$(this).outerWidth()}),0<$(".itemAdd:visible").length&&(t+=$(".itemAdd:visible").outerWidth()),t}function leftRight(){var e,t,n;window.matchMedia("(min-width: 768px)").matches?(t=$(".leftSide, #lcol, #user_container"),n=$(".rightSide, #rcol, #right_container"),e=$(".innerSec").width(),t.css({width:e-360+"px"}),n.removeAttr("style")):(t=$(".leftSide, #lcol, #user_container"),n=$(".rightSide, #rcol, #right_container"),t.removeAttr("style"),t.css({width:"100%"}),n.css({width:"100%"}))}function targetFirefoxHeader(){-1<navigator.userAgent.toLowerCase().indexOf("firefox")&&$(".horizontal .navigationContainer").css({"white-space":"normal"})}function MTS_startAjax(){MTS_clearAjaxTimer(),_ajaxSpinTimer=setTimeout(function(){$(".busySpinnerBg").show()},600)}function MTS_endAjax(){MTS_clearAjaxTimer(),$(".busySpinnerBg").hide()}function MTS_clearAjaxTimer(){null!=_ajaxSpinTimer&&(clearTimeout(_ajaxSpinTimer),_ajaxSpinTimer=null)}function MTS_routeApiCall(e,t,n,i){var o=[];o.push({name:"path",value:t}),o.push({name:"map",value:e+"&portal_id="+_MTS_PORTALID}),i&&$.ajaxSetup({async:!1}),$.getJSON("/api/portalAdmin/sendApiRequest.aspx?",o,n),i&&$.ajaxSetup({async:!0})}function MTS_validateEmail(e){return/^[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$/gi.test(e)}function getImageLink(e,t){var n=GetCloudUrl(e),i=e.id,o=_MTS_PHOTO_TEMPLATE.replace("%%IMG_ID%%",i).replace("%%SIZE%%",t).replace("%%TEAM_ID%%",e.teamId).replace("%%USER_ID%%",e.uploaderId).replace("%%TYPE%%",0);return e.inCloud&&null!=n&&0<n.length&&(o=n+"/"+getBigInt(e.id)+i+(2<=t?"":"_"+t),1<e.webActiveVersion&&(o=o+"_v"+e.webActiveVersion)),o}function getBigInt(e){for(var t=[0,0,0,0,0,0],n=t.length-1;t[n]=0==n?Math.floor(e):Math.floor(e%1e3),e/=1e3,0<=--n;);var i,o="";for(i in t)isNaN(parseInt(i))||(o+=parseInt(t[i])+"/");return o}function GetCloudUrl(e){var t="";if("undefined"!=typeof _activeContainer)for(var n=_activeContainer.portals.length-1;0<=n;n--)if(_activeContainer.portals[n].id==e.container){t=_activeContainer.portals[n].url;break}return t}$(window).resize(function(){0<$("#customHeightcss").length&&$("#customHeightcss").remove(),$.each(_resizeSelectors,function(e,t){HeightResizer(t.selector,t.size)})}),Date.prototype.formatDate=function(){return this.getMonth()+1+"/"+this.getDate()+"/"+this.getFullYear()},Date.prototype.formatTime=function(){var e=this.getHours(),t=11<e;12<e&&(e-=12),0==e&&(e=12);var n=this.getMinutes();return e+":"+(n<10?"0":"")+n+" "+(t?"PM":"AM")},Array.prototype.removeIf=function(e){for(var t=this.length;t--;)e(this[t],t)&&this.splice(t,1)};
﻿/*!
 * jQuery Smart Banner
 * Copyright (c) 2012 Arnold Daniels <arnold@jasny.net>
 * Based on 'jQuery Smart Web App Banner' by Kurt Zenisek @ kzeni.com
 */
!function ($) {
    var SmartBanner = function (options) {
//        this.origHtmlMargin = parseFloat($('html').css('margin-top')) // Get the original margin-top of the HTML element so we can take that into account
        this.options = $.extend({}, $.smartbanner.defaults, options)

        var standalone = navigator.standalone // Check if it's already a standalone web app or running within a webui view of an app (not mobile safari)
          , UA = navigator.userAgent

        // Detect banner type (iOS or Android)
        if (this.options.force) {
            this.type = this.options.force
        } else if (UA.match(/iPhone|iPod/i) != null || (UA.match(/iPad/) && this.options.iOSUniversalApp)) {
            if (UA.match(/Safari/i) != null &&
               (UA.match(/CriOS/i) != null ||
               window.Number(UA.substr(UA.indexOf('OS ') + 3, 3).replace('_', '.')) < 6)) this.type = 'ios' // Check webview and native smart banner support (iOS 6+)
        } else if (UA.match(/\bSilk\/(.*\bMobile Safari\b)?/) || UA.match(/\bKF\w/) || UA.match('Kindle Fire')) {
            this.type = 'kindle'
        } else if (UA.match(/Android/i) != null) {
            this.type = 'android'
        } else if (UA.match(/Windows NT 6.2/i) != null && UA.match(/Touch/i) !== null) {
            this.type = 'windows'
        }

        // Don't show banner if device isn't iOS or Android, website is loaded in app or user dismissed banner
        if (!this.type || standalone || this.getCookie('sb-closed') || this.getCookie('sb-installed')) {
            return
        }

        // Calculate scale
        this.scale = this.options.scale == 'auto' ? $(window).width() / window.screen.width : this.options.scale
        if (this.scale < 1) this.scale = 1

        // Get info from meta data
        var meta = $(this.type == 'android' ? 'meta[name="google-play-app"]' :
            this.type == 'ios' ? 'meta[name="apple-itunes-app"]' :
            this.type == 'kindle' ? 'meta[name="kindle-fire-app"]' : 'meta[name="msApplication-ID"]');
        if (meta.length == 0) return

        // For Windows Store apps, get the PackageFamilyName for protocol launch
        if (this.type == 'windows') {
            this.pfn = $('meta[name="msApplication-PackageFamilyName"]').attr('content');
            this.appId = meta.attr('content')[1]
        } else {
            this.appId = /app-id=([^\s,]+)/.exec(meta.attr('content'))[1]
        }

        this.title = this.options.title ? this.options.title : meta.data('title') || $('title').text().replace(/\s*[|\-·].*$/, '')
        this.author = this.options.author ? this.options.author : meta.data('author') || ($('meta[name="author"]').length ? $('meta[name="author"]').attr('content') : window.location.hostname)
        this.iconUrl = meta.data('icon-url');
        this.price = meta.data('price');

        // Create banner
        this.create()
        this.show()
        this.listen()
    }

    SmartBanner.prototype = {

        constructor: SmartBanner

      , create: function() {
            var iconURL
              , link=(this.options.url ? this.options.url : (this.type == 'windows' ? 'ms-windows-store:PDP?PFN=' + this.pfn : (this.type == 'android' ? 'market://details?id=' : (this.type == 'kindle' ? 'amzn://apps/android?asin=' : 'https://itunes.apple.com/' + this.options.appStoreLanguage + '/app/id'))) + this.appId)
              , price = this.price || this.options.price
              , inStore=price ? price + ' - ' + (this.type == 'android' ? this.options.inGooglePlay : this.type == 'kindle' ? this.options.inAmazonAppStore : this.type == 'ios' ? this.options.inAppStore : this.options.inWindowsStore) : ''
              , gloss=this.options.iconGloss === null ? (this.type=='ios') : this.options.iconGloss
            if(this.options.url)
              link = this.options.url
            else {
              if(this.type=='android') {
                link = 'market://details?id=' + this.appId
                if(this.options.GooglePlayParams)
                  link = link + '&referrer=' + this.options.GooglePlayParams
              }
              else
              link = 'https://itunes.apple.com/' + this.options.appStoreLanguage + '/app/id' + this.appId
            }

            var banner = '<div id="smartbanner" class="'+this.type+'"><div class="sb-container"><a title="" href="#" class="sb-close">&times;</a><span class="sb-icon"></span><div class="sb-info"><strong>'+this.title+'</strong><span>'+this.author+'</span><span>'+inStore+'</span></div><a href="'+link+'" class="sb-button"><span>'+this.options.button+'</span></a></div></div>';
            (this.options.layer) ? $(this.options.appendToSelector).append(banner) : $(this.options.appendToSelector).prepend(banner);

            if (this.options.icon) {
                iconURL = this.options.icon
            } else if(this.iconUrl) {
                iconURL = this.iconUrl;
            } else if ($('link[rel="apple-touch-icon-precomposed"]').length > 0) {
                iconURL = $('link[rel="apple-touch-icon-precomposed"]').attr('href')
                if (this.options.iconGloss === null) gloss = false
            } else if ($('link[rel="apple-touch-icon"]').length > 0) {
                iconURL = $('link[rel="apple-touch-icon"]').attr('href')
            } else if ($('meta[name="msApplication-TileImage"]').length > 0) {
              iconURL = $('meta[name="msApplication-TileImage"]').attr('content')
            } else if ($('meta[name="msapplication-TileImage"]').length > 0) { /* redundant because ms docs show two case usages */
              iconURL = $('meta[name="msapplication-TileImage"]').attr('content')
            }

            if (iconURL) {
                $('#smartbanner .sb-icon').css('background-image','url('+iconURL+')')
                if (gloss) $('#smartbanner .sb-icon').addClass('gloss')
            } else{
                $('#smartbanner').addClass('no-icon')
            }

            this.bannerHeight = $('#smartbanner').outerHeight() + 2

            if (this.scale > 1) {
                $('#smartbanner')
                    .css('top', parseFloat($('#smartbanner').css('top')) * this.scale)
                    .css('height', parseFloat($('#smartbanner').css('height')) * this.scale)
                    .hide()
                $('#smartbanner .sb-container')
                    .css('-webkit-transform', 'scale('+this.scale+')')
                    .css('-msie-transform', 'scale('+this.scale+')')
                    .css('-moz-transform', 'scale('+this.scale+')')
                    .css('width', $(window).width() / this.scale)
            }
//            $('#smartbanner').css('position', (this.options.layer) ? 'absolute' : 'static')
        }

      , listen: function () {
            $('#smartbanner .sb-close').on('click',$.proxy(this.close, this))
            $('#smartbanner .sb-button').on('click',$.proxy(this.install, this))
        }

      , show: function(callback) {
            var banner = $('#smartbanner');
            banner.stop();

            if (this.options.layer) {
                banner.animate({top: 0, display: 'block'}, this.options.speedIn).addClass('shown').show();
                $('html').animate({marginTop: this.origHtmlMargin + (this.bannerHeight * this.scale)}, this.options.speedIn, 'swing', callback);
            } else {
                if ($.support.transition) {
                    banner.animate({top:0},this.options.speedIn).addClass('shown');
                    var transitionCallback = function() {
                        $('html').removeClass('sb-animation');
                        if (callback) {
                            callback();
                        }
                    };
                    $('html').addClass('sb-animation').one($.support.transition.end, transitionCallback).emulateTransitionEnd(this.options.speedIn).css('margin-top', this.origHtmlMargin+(this.bannerHeight*this.scale));
                } else {
                    banner.slideDown(this.options.speedIn).addClass('shown');
                }
            }
        }

      , hide: function(callback) {
            var banner = $('#smartbanner');
            banner.stop();

            if (this.options.layer) {
                banner.animate({top: -1 * this.bannerHeight * this.scale, display: 'block'}, this.options.speedIn).removeClass('shown');
                $('html').animate({marginTop: this.origHtmlMargin}, this.options.speedIn, 'swing', callback);
            } else {
               banner.slideUp(this.options.speedOut).removeClass('shown');
            }
        }

      , close: function(e) {
            e.preventDefault()
            this.hide()
            this.setCookie('sb-closed','true',this.options.daysHidden);
        }

      , install: function(e) {
			if (this.options.hideOnInstall) {
				this.hide()
			}
            this.setCookie('sb-installed','true',this.options.daysReminder)
        }

      , setCookie: function(name, value, exdays) {
            var exdate = new Date()
            exdate.setDate(exdate.getDate()+exdays)
            value=encodeURI(value)+((exdays==null)?'':'; expires='+exdate.toUTCString())
            document.cookie=name+'='+value+'; path=/;'
        }

      , getCookie: function(name) {
            var i,x,y,ARRcookies = document.cookie.split(";")
            for(i=0;i<ARRcookies.length;i++) {
                x = ARRcookies[i].substr(0,ARRcookies[i].indexOf("="))
                y = ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1)
                x = x.replace(/^\s+|\s+$/g,"")
                if (x==name) {
                    return decodeURI(y)
                }
            }
            return null
        }

      // Demo only
      , switchType: function() {
          var that = this

          this.hide(function () {
              that.type = that.type == 'android' ? 'ios' : 'android'
              var meta = $(that.type == 'android' ? 'meta[name="google-play-app"]' : 'meta[name="apple-itunes-app"]').attr('content')
              that.appId = /app-id=([^\s,]+)/.exec(meta)[1]

              $('#smartbanner').detach()
              that.create()
              that.show()
          })
      }
    }

    $.smartbanner = function (option) {
        var $window = $(window)
        , data = $window.data('smartbanner')
        , options = typeof option == 'object' && option
        if (!data) $window.data('smartbanner', (data = new SmartBanner(options)))
        if (typeof option == 'string') data[option]()
    }

    // override these globally if you like (they are all optional)
    $.smartbanner.defaults = {
        title: null, // What the title of the app should be in the banner (defaults to <title>)
        author: null, // What the author of the app should be in the banner (defaults to <meta name="author"> or hostname)
        price: 'FREE', // Price of the app
        appStoreLanguage: 'us', // Language code for App Store
        inAppStore: 'On the App Store', // Text of price for iOS
        inGooglePlay: 'In Google Play', // Text of price for Android
        inAmazonAppStore: 'In the Amazon Appstore',
        inWindowsStore: 'In the Windows Store', //Text of price for Windows
        GooglePlayParams: null, // Aditional parameters for the market
        icon: null, // The URL of the icon (defaults to <meta name="apple-touch-icon">)
        iconGloss: null, // Force gloss effect for iOS even for precomposed
        button: 'VIEW', // Text for the install button
        url: null, // The URL for the button. Keep null if you want the button to link to the app store.
        scale: 'auto', // Scale based on viewport size (set to 1 to disable)
        speedIn: 300, // Show animation speed of the banner
        speedOut: 400, // Close animation speed of the banner
        daysHidden: 15, // Duration to hide the banner after being closed (0 = always show banner)
        daysReminder: 90, // Duration to hide the banner after "VIEW" is clicked *separate from when the close button is clicked* (0 = always show banner)
        force: null, // Choose 'ios', 'android' or 'windows'. Don't do a browser check, just always show this banner
        hideOnInstall: true, // Hide the banner after "VIEW" is clicked.
        layer: false, // Display as overlay layer or slide down the page
        iOSUniversalApp: true, // If the iOS App is a universal app for both iPad and iPhone, display Smart Banner to iPad users, too.
        appendToSelector: 'body' //Append the banner to a specific selector
    }

    $.smartbanner.Constructor = SmartBanner;


    // ============================================================
    // Bootstrap transition
    // Copyright 2011-2014 Twitter, Inc.
    // Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)

    function transitionEnd() {
        var el = document.createElement('smartbanner')

        var transEndEventNames = {
            WebkitTransition: 'webkitTransitionEnd',
            MozTransition: 'transitionend',
            OTransition: 'oTransitionEnd otransitionend',
            transition: 'transitionend'
        }

        for (var name in transEndEventNames) {
            if (el.style[name] !== undefined) {
                return {end: transEndEventNames[name]}
            }
        }

        return false // explicit for ie8 (  ._.)
    }

    if ($.support.transition !== undefined)
        return  // Prevent conflict with Twitter Bootstrap

    // http://blog.alexmaccaw.com/css-transitions
    $.fn.emulateTransitionEnd = function(duration) {
        var called = false, $el = this
        $(this).one($.support.transition.end, function() {
            called = true
        })
        var callback = function() {
            if (!called) $($el).trigger($.support.transition.end)
        }
        setTimeout(callback, duration)
        return this
    }

    $(function() {
        $.support.transition = transitionEnd()
    })
    // ============================================================

}(window.jQuery);

﻿/******************************************************************************************************************************************************
   Return value in findXMPinJPEG function was edited that is not present in the version on the site.
   Function now returns { doc: $.parseXML(xmpString), obj: xml2Object(domDocument) }.
   If replacing this file with updated version from site, these changes will need to be added again along with using xmpdata.obj where xmpdata is used.
******************************************************************************************************************************************************/

(function ()
{

   var debug = false;

   var root = this;

   var EXIF = function (obj)
   {
      if (obj instanceof EXIF) return obj;
      if (!(this instanceof EXIF)) return new EXIF(obj);
      this.EXIFwrapped = obj;
   };

   if (typeof exports !== 'undefined')
   {
      if (typeof module !== 'undefined' && module.exports)
      {
         exports = module.exports = EXIF;
      }
      exports.EXIF = EXIF;
   } else
   {
      root.EXIF = EXIF;
   }

   var ExifTags = EXIF.Tags = {

      // version tags
      0x9000: "ExifVersion",             // EXIF version
      0xA000: "FlashpixVersion",         // Flashpix format version

      // colorspace tags
      0xA001: "ColorSpace",              // Color space information tag

      // image configuration
      0xA002: "PixelXDimension",         // Valid width of meaningful image
      0xA003: "PixelYDimension",         // Valid height of meaningful image
      0x9101: "ComponentsConfiguration", // Information about channels
      0x9102: "CompressedBitsPerPixel",  // Compressed bits per pixel

      // user information
      0x927C: "MakerNote",               // Any desired information written by the manufacturer
      0x9286: "UserComment",             // Comments by user

      // related file
      0xA004: "RelatedSoundFile",        // Name of related sound file

      // date and time
      0x9003: "DateTimeOriginal",        // Date and time when the original image was generated
      0x9004: "DateTimeDigitized",       // Date and time when the image was stored digitally
      0x9290: "SubsecTime",              // Fractions of seconds for DateTime
      0x9291: "SubsecTimeOriginal",      // Fractions of seconds for DateTimeOriginal
      0x9292: "SubsecTimeDigitized",     // Fractions of seconds for DateTimeDigitized

      // picture-taking conditions
      0x829A: "ExposureTime",            // Exposure time (in seconds)
      0x829D: "FNumber",                 // F number
      0x8822: "ExposureProgram",         // Exposure program
      0x8824: "SpectralSensitivity",     // Spectral sensitivity
      0x8827: "ISOSpeedRatings",         // ISO speed rating
      0x8828: "OECF",                    // Optoelectric conversion factor
      0x9201: "ShutterSpeedValue",       // Shutter speed
      0x9202: "ApertureValue",           // Lens aperture
      0x9203: "BrightnessValue",         // Value of brightness
      0x9204: "ExposureBias",            // Exposure bias
      0x9205: "MaxApertureValue",        // Smallest F number of lens
      0x9206: "SubjectDistance",         // Distance to subject in meters
      0x9207: "MeteringMode",            // Metering mode
      0x9208: "LightSource",             // Kind of light source
      0x9209: "Flash",                   // Flash status
      0x9214: "SubjectArea",             // Location and area of main subject
      0x920A: "FocalLength",             // Focal length of the lens in mm
      0xA20B: "FlashEnergy",             // Strobe energy in BCPS
      0xA20C: "SpatialFrequencyResponse",    //
      0xA20E: "FocalPlaneXResolution",   // Number of pixels in width direction per FocalPlaneResolutionUnit
      0xA20F: "FocalPlaneYResolution",   // Number of pixels in height direction per FocalPlaneResolutionUnit
      0xA210: "FocalPlaneResolutionUnit",    // Unit for measuring FocalPlaneXResolution and FocalPlaneYResolution
      0xA214: "SubjectLocation",         // Location of subject in image
      0xA215: "ExposureIndex",           // Exposure index selected on camera
      0xA217: "SensingMethod",           // Image sensor type
      0xA300: "FileSource",              // Image source (3 == DSC)
      0xA301: "SceneType",               // Scene type (1 == directly photographed)
      0xA302: "CFAPattern",              // Color filter array geometric pattern
      0xA401: "CustomRendered",          // Special processing
      0xA402: "ExposureMode",            // Exposure mode
      0xA403: "WhiteBalance",            // 1 = auto white balance, 2 = manual
      0xA404: "DigitalZoomRation",       // Digital zoom ratio
      0xA405: "FocalLengthIn35mmFilm",   // Equivalent foacl length assuming 35mm film camera (in mm)
      0xA406: "SceneCaptureType",        // Type of scene
      0xA407: "GainControl",             // Degree of overall image gain adjustment
      0xA408: "Contrast",                // Direction of contrast processing applied by camera
      0xA409: "Saturation",              // Direction of saturation processing applied by camera
      0xA40A: "Sharpness",               // Direction of sharpness processing applied by camera
      0xA40B: "DeviceSettingDescription",    //
      0xA40C: "SubjectDistanceRange",    // Distance to subject

      // other tags
      0xA005: "InteroperabilityIFDPointer",
      0xA420: "ImageUniqueID"            // Identifier assigned uniquely to each image
   };

   var TiffTags = EXIF.TiffTags = {
      0x0100: "ImageWidth",
      0x0101: "ImageHeight",
      0x8769: "ExifIFDPointer",
      0x8825: "GPSInfoIFDPointer",
      0xA005: "InteroperabilityIFDPointer",
      0x0102: "BitsPerSample",
      0x0103: "Compression",
      0x0106: "PhotometricInterpretation",
      0x0112: "Orientation",
      0x0115: "SamplesPerPixel",
      0x011C: "PlanarConfiguration",
      0x0212: "YCbCrSubSampling",
      0x0213: "YCbCrPositioning",
      0x011A: "XResolution",
      0x011B: "YResolution",
      0x0128: "ResolutionUnit",
      0x0111: "StripOffsets",
      0x0116: "RowsPerStrip",
      0x0117: "StripByteCounts",
      0x0201: "JPEGInterchangeFormat",
      0x0202: "JPEGInterchangeFormatLength",
      0x012D: "TransferFunction",
      0x013E: "WhitePoint",
      0x013F: "PrimaryChromaticities",
      0x0211: "YCbCrCoefficients",
      0x0214: "ReferenceBlackWhite",
      0x0132: "DateTime",
      0x010E: "ImageDescription",
      0x010F: "Make",
      0x0110: "Model",
      0x0131: "Software",
      0x013B: "Artist",
      0x8298: "Copyright"
   };

   var GPSTags = EXIF.GPSTags = {
      0x0000: "GPSVersionID",
      0x0001: "GPSLatitudeRef",
      0x0002: "GPSLatitude",
      0x0003: "GPSLongitudeRef",
      0x0004: "GPSLongitude",
      0x0005: "GPSAltitudeRef",
      0x0006: "GPSAltitude",
      0x0007: "GPSTimeStamp",
      0x0008: "GPSSatellites",
      0x0009: "GPSStatus",
      0x000A: "GPSMeasureMode",
      0x000B: "GPSDOP",
      0x000C: "GPSSpeedRef",
      0x000D: "GPSSpeed",
      0x000E: "GPSTrackRef",
      0x000F: "GPSTrack",
      0x0010: "GPSImgDirectionRef",
      0x0011: "GPSImgDirection",
      0x0012: "GPSMapDatum",
      0x0013: "GPSDestLatitudeRef",
      0x0014: "GPSDestLatitude",
      0x0015: "GPSDestLongitudeRef",
      0x0016: "GPSDestLongitude",
      0x0017: "GPSDestBearingRef",
      0x0018: "GPSDestBearing",
      0x0019: "GPSDestDistanceRef",
      0x001A: "GPSDestDistance",
      0x001B: "GPSProcessingMethod",
      0x001C: "GPSAreaInformation",
      0x001D: "GPSDateStamp",
      0x001E: "GPSDifferential"
   };

   // EXIF 2.3 Spec
   var IFD1Tags = EXIF.IFD1Tags = {
      0x0100: "ImageWidth",
      0x0101: "ImageHeight",
      0x0102: "BitsPerSample",
      0x0103: "Compression",
      0x0106: "PhotometricInterpretation",
      0x0111: "StripOffsets",
      0x0112: "Orientation",
      0x0115: "SamplesPerPixel",
      0x0116: "RowsPerStrip",
      0x0117: "StripByteCounts",
      0x011A: "XResolution",
      0x011B: "YResolution",
      0x011C: "PlanarConfiguration",
      0x0128: "ResolutionUnit",
      0x0201: "JpegIFOffset",    // When image format is JPEG, this value show offset to JPEG data stored.(aka "ThumbnailOffset" or "JPEGInterchangeFormat")
      0x0202: "JpegIFByteCount", // When image format is JPEG, this value shows data size of JPEG image (aka "ThumbnailLength" or "JPEGInterchangeFormatLength")
      0x0211: "YCbCrCoefficients",
      0x0212: "YCbCrSubSampling",
      0x0213: "YCbCrPositioning",
      0x0214: "ReferenceBlackWhite"
   };

   var StringValues = EXIF.StringValues = {
      ExposureProgram: {
         0: "Not defined",
         1: "Manual",
         2: "Normal program",
         3: "Aperture priority",
         4: "Shutter priority",
         5: "Creative program",
         6: "Action program",
         7: "Portrait mode",
         8: "Landscape mode"
      },
      MeteringMode: {
         0: "Unknown",
         1: "Average",
         2: "CenterWeightedAverage",
         3: "Spot",
         4: "MultiSpot",
         5: "Pattern",
         6: "Partial",
         255: "Other"
      },
      LightSource: {
         0: "Unknown",
         1: "Daylight",
         2: "Fluorescent",
         3: "Tungsten (incandescent light)",
         4: "Flash",
         9: "Fine weather",
         10: "Cloudy weather",
         11: "Shade",
         12: "Daylight fluorescent (D 5700 - 7100K)",
         13: "Day white fluorescent (N 4600 - 5400K)",
         14: "Cool white fluorescent (W 3900 - 4500K)",
         15: "White fluorescent (WW 3200 - 3700K)",
         17: "Standard light A",
         18: "Standard light B",
         19: "Standard light C",
         20: "D55",
         21: "D65",
         22: "D75",
         23: "D50",
         24: "ISO studio tungsten",
         255: "Other"
      },
      Flash: {
         0x0000: "Flash did not fire",
         0x0001: "Flash fired",
         0x0005: "Strobe return light not detected",
         0x0007: "Strobe return light detected",
         0x0009: "Flash fired, compulsory flash mode",
         0x000D: "Flash fired, compulsory flash mode, return light not detected",
         0x000F: "Flash fired, compulsory flash mode, return light detected",
         0x0010: "Flash did not fire, compulsory flash mode",
         0x0018: "Flash did not fire, auto mode",
         0x0019: "Flash fired, auto mode",
         0x001D: "Flash fired, auto mode, return light not detected",
         0x001F: "Flash fired, auto mode, return light detected",
         0x0020: "No flash function",
         0x0041: "Flash fired, red-eye reduction mode",
         0x0045: "Flash fired, red-eye reduction mode, return light not detected",
         0x0047: "Flash fired, red-eye reduction mode, return light detected",
         0x0049: "Flash fired, compulsory flash mode, red-eye reduction mode",
         0x004D: "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",
         0x004F: "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",
         0x0059: "Flash fired, auto mode, red-eye reduction mode",
         0x005D: "Flash fired, auto mode, return light not detected, red-eye reduction mode",
         0x005F: "Flash fired, auto mode, return light detected, red-eye reduction mode"
      },
      SensingMethod: {
         1: "Not defined",
         2: "One-chip color area sensor",
         3: "Two-chip color area sensor",
         4: "Three-chip color area sensor",
         5: "Color sequential area sensor",
         7: "Trilinear sensor",
         8: "Color sequential linear sensor"
      },
      SceneCaptureType: {
         0: "Standard",
         1: "Landscape",
         2: "Portrait",
         3: "Night scene"
      },
      SceneType: {
         1: "Directly photographed"
      },
      CustomRendered: {
         0: "Normal process",
         1: "Custom process"
      },
      WhiteBalance: {
         0: "Auto white balance",
         1: "Manual white balance"
      },
      GainControl: {
         0: "None",
         1: "Low gain up",
         2: "High gain up",
         3: "Low gain down",
         4: "High gain down"
      },
      Contrast: {
         0: "Normal",
         1: "Soft",
         2: "Hard"
      },
      Saturation: {
         0: "Normal",
         1: "Low saturation",
         2: "High saturation"
      },
      Sharpness: {
         0: "Normal",
         1: "Soft",
         2: "Hard"
      },
      SubjectDistanceRange: {
         0: "Unknown",
         1: "Macro",
         2: "Close view",
         3: "Distant view"
      },
      FileSource: {
         3: "DSC"
      },

      Components: {
         0: "",
         1: "Y",
         2: "Cb",
         3: "Cr",
         4: "R",
         5: "G",
         6: "B"
      }
   };

   function addEvent(element, event, handler)
   {
      if (element.addEventListener)
      {
         element.addEventListener(event, handler, false);
      } else if (element.attachEvent)
      {
         element.attachEvent("on" + event, handler);
      }
   }

   function imageHasData(img)
   {
      return !!(img.exifdata);
   }


   function base64ToArrayBuffer(base64, contentType)
   {
      contentType = contentType || base64.match(/^data\:([^\;]+)\;base64,/mi)[1] || ''; // e.g. 'data:image/jpeg;base64,...' => 'image/jpeg'
      base64 = base64.replace(/^data\:([^\;]+)\;base64,/gmi, '');
      var binary = atob(base64);
      var len = binary.length;
      var buffer = new ArrayBuffer(len);
      var view = new Uint8Array(buffer);
      for (var i = 0; i < len; i++)
      {
         view[i] = binary.charCodeAt(i);
      }
      return buffer;
   }

   function objectURLToBlob(url, callback)
   {
      var http = new XMLHttpRequest();
      http.open("GET", url, true);
      http.responseType = "blob";
      http.onload = function (e)
      {
         if (this.status == 200 || this.status === 0)
         {
            callback(this.response);
         }
      };
      http.send();
   }

   function getImageData(img, callback)
   {
      function handleBinaryFile(binFile)
      {
         var data = findEXIFinJPEG(binFile);
         img.exifdata = data || {};
         var iptcdata = findIPTCinJPEG(binFile);
         img.iptcdata = iptcdata || {};
         if (EXIF.isXmpEnabled)
         {
            var xmpdata = {};
            try
            {
               xmpdata = findXMPinJPEG(binFile);
            }
            catch (ex)
            {

            }
            img.xmpdata = xmpdata || {};
         }
         if (callback)
         {
            callback.call(img);
         }
      }

      if (img.src)
      {
         if (/^data\:/i.test(img.src))
         { // Data URI
            var arrayBuffer = base64ToArrayBuffer(img.src);
            handleBinaryFile(arrayBuffer);

         } else if (/^blob\:/i.test(img.src))
         { // Object URL
            var fileReader = new FileReader();
            fileReader.onload = function (e)
            {
               handleBinaryFile(e.target.result);
            };
            objectURLToBlob(img.src, function (blob)
            {
               fileReader.readAsArrayBuffer(blob);
            });
         } else
         {
            var http = new XMLHttpRequest();
            http.onload = function ()
            {
               if (this.status == 200 || this.status === 0)
               {
                  handleBinaryFile(http.response);
               } else
               {
                  throw "Could not load image";
               }
               http = null;
            };
            http.open("GET", img.src, true);
            http.responseType = "arraybuffer";
            http.send(null);
         }
      } else if (self.FileReader && (img instanceof self.Blob || img instanceof self.File))
      {
         var fileReader = new FileReader();
         fileReader.onload = function (e)
         {
            if (debug) console.log("Got file of length " + e.target.result.byteLength);
            handleBinaryFile(e.target.result);
         };

         fileReader.readAsArrayBuffer(img);
      }
   }

   function findEXIFinJPEG(file)
   {
      var dataView = new DataView(file);

      if (debug) console.log("Got file of length " + file.byteLength);
      if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8))
      {
         if (debug) console.log("Not a valid JPEG");
         return false; // not a valid jpeg
      }

      var offset = 2,
          length = file.byteLength,
          marker;

      while (offset < length)
      {
         if (dataView.getUint8(offset) != 0xFF)
         {
            if (debug) console.log("Not a valid marker at offset " + offset + ", found: " + dataView.getUint8(offset));
            return false; // not a valid marker, something is wrong
         }

         marker = dataView.getUint8(offset + 1);
         if (debug) console.log(marker);

         // we could implement handling for other markers here,
         // but we're only looking for 0xFFE1 for EXIF data

         if (marker == 225)
         {
            if (debug) console.log("Found 0xFFE1 marker");

            return readEXIFData(dataView, offset + 4, dataView.getUint16(offset + 2) - 2);

            // offset += 2 + file.getShortAt(offset+2, true);

         } else
         {
            offset += 2 + dataView.getUint16(offset + 2);
         }

      }

   }

   function findIPTCinJPEG(file)
   {
      var dataView = new DataView(file);

      if (debug) console.log("Got file of length " + file.byteLength);
      if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8))
      {
         if (debug) console.log("Not a valid JPEG");
         return false; // not a valid jpeg
      }

      var offset = 2,
          length = file.byteLength;


      var isFieldSegmentStart = function (dataView, offset)
      {
         return (
             dataView.getUint8(offset) === 0x38 &&
             dataView.getUint8(offset + 1) === 0x42 &&
             dataView.getUint8(offset + 2) === 0x49 &&
             dataView.getUint8(offset + 3) === 0x4D &&
             dataView.getUint8(offset + 4) === 0x04 &&
             dataView.getUint8(offset + 5) === 0x04
         );
      };

      while (offset < length)
      {

         if (isFieldSegmentStart(dataView, offset))
         {

            // Get the length of the name header (which is padded to an even number of bytes)
            var nameHeaderLength = dataView.getUint8(offset + 7);
            if (nameHeaderLength % 2 !== 0) nameHeaderLength += 1;
            // Check for pre photoshop 6 format
            if (nameHeaderLength === 0)
            {
               // Always 4
               nameHeaderLength = 4;
            }

            var startOffset = offset + 8 + nameHeaderLength;
            var sectionLength = dataView.getUint16(offset + 6 + nameHeaderLength);

            return readIPTCData(file, startOffset, sectionLength);

            break;

         }


         // Not the marker, continue searching
         offset++;

      }

   }
   var IptcFieldMap = {
      0x78: 'caption',
      0x6E: 'credit',
      0x19: 'keywords',
      0x37: 'dateCreated',
      0x50: 'byline',
      0x55: 'bylineTitle',
      0x7A: 'captionWriter',
      0x69: 'headline',
      0x74: 'copyright',
      0x0F: 'category'
   };
   function readIPTCData(file, startOffset, sectionLength)
   {
      var dataView = new DataView(file);
      var data = {};
      var fieldValue, fieldName, dataSize, segmentType, segmentSize;
      var segmentStartPos = startOffset;
      while (segmentStartPos < startOffset + sectionLength)
      {
         if (dataView.getUint8(segmentStartPos) === 0x1C && dataView.getUint8(segmentStartPos + 1) === 0x02)
         {
            segmentType = dataView.getUint8(segmentStartPos + 2);
            if (segmentType in IptcFieldMap)
            {
               dataSize = dataView.getInt16(segmentStartPos + 3);
               segmentSize = dataSize + 5;
               fieldName = IptcFieldMap[segmentType];
               fieldValue = getStringFromDB(dataView, segmentStartPos + 5, dataSize);
               // Check if we already stored a value with this name
               if (data.hasOwnProperty(fieldName))
               {
                  // Value already stored with this name, create multivalue field
                  if (data[fieldName] instanceof Array)
                  {
                     data[fieldName].push(fieldValue);
                  }
                  else
                  {
                     data[fieldName] = [data[fieldName], fieldValue];
                  }
               }
               else
               {
                  data[fieldName] = fieldValue;
               }
            }

         }
         segmentStartPos++;
      }
      return data;
   }



   function readTags(file, tiffStart, dirStart, strings, bigEnd)
   {
      var entries = file.getUint16(dirStart, !bigEnd),
          tags = {},
          entryOffset, tag,
          i;

      for (i = 0; i < entries; i++)
      {
         entryOffset = dirStart + i * 12 + 2;
         tag = strings[file.getUint16(entryOffset, !bigEnd)];
         if (!tag && debug) console.log("Unknown tag: " + file.getUint16(entryOffset, !bigEnd));
         try
         {
            tags[tag] = readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd);
         }
         catch (ex)
         {

         }
      }
      return tags;
   }


   function readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd)
   {
      var type = file.getUint16(entryOffset + 2, !bigEnd),
          numValues = file.getUint32(entryOffset + 4, !bigEnd),
          valueOffset = file.getUint32(entryOffset + 8, !bigEnd) + tiffStart,
          offset,
          vals, val, n,
          numerator, denominator;

      switch (type)
      {
         case 1: // byte, 8-bit unsigned int
         case 7: // undefined, 8-bit byte, value depending on field
            if (numValues == 1)
            {
               return file.getUint8(entryOffset + 8, !bigEnd);
            } else
            {
               offset = numValues > 4 ? valueOffset : (entryOffset + 8);
               vals = [];
               for (n = 0; n < numValues; n++)
               {
                  vals[n] = file.getUint8(offset + n);
               }
               return vals;
            }

         case 2: // ascii, 8-bit byte
            offset = numValues > 4 ? valueOffset : (entryOffset + 8);
            return getStringFromDB(file, offset, numValues - 1);

         case 3: // short, 16 bit int
            if (numValues == 1)
            {
               return file.getUint16(entryOffset + 8, !bigEnd);
            } else
            {
               offset = numValues > 2 ? valueOffset : (entryOffset + 8);
               vals = [];
               for (n = 0; n < numValues; n++)
               {
                  vals[n] = file.getUint16(offset + 2 * n, !bigEnd);
               }
               return vals;
            }

         case 4: // long, 32 bit int
            if (numValues == 1)
            {
               return file.getUint32(entryOffset + 8, !bigEnd);
            } else
            {
               vals = [];
               for (n = 0; n < numValues; n++)
               {
                  vals[n] = file.getUint32(valueOffset + 4 * n, !bigEnd);
               }
               return vals;
            }

         case 5:    // rational = two long values, first is numerator, second is denominator
            if (numValues == 1)
            {
               numerator = file.getUint32(valueOffset, !bigEnd);
               denominator = file.getUint32(valueOffset + 4, !bigEnd);
               val = new Number(numerator / denominator);
               val.numerator = numerator;
               val.denominator = denominator;
               return val;
            } else
            {
               vals = [];
               for (n = 0; n < numValues; n++)
               {
                  numerator = file.getUint32(valueOffset + 8 * n, !bigEnd);
                  denominator = file.getUint32(valueOffset + 4 + 8 * n, !bigEnd);
                  vals[n] = new Number(numerator / denominator);
                  vals[n].numerator = numerator;
                  vals[n].denominator = denominator;
               }
               return vals;
            }

         case 9: // slong, 32 bit signed int
            if (numValues == 1)
            {
               return file.getInt32(entryOffset + 8, !bigEnd);
            } else
            {
               vals = [];
               for (n = 0; n < numValues; n++)
               {
                  vals[n] = file.getInt32(valueOffset + 4 * n, !bigEnd);
               }
               return vals;
            }

         case 10: // signed rational, two slongs, first is numerator, second is denominator
            if (numValues == 1)
            {
               return file.getInt32(valueOffset, !bigEnd) / file.getInt32(valueOffset + 4, !bigEnd);
            } else
            {
               vals = [];
               for (n = 0; n < numValues; n++)
               {
                  vals[n] = file.getInt32(valueOffset + 8 * n, !bigEnd) / file.getInt32(valueOffset + 4 + 8 * n, !bigEnd);
               }
               return vals;
            }
      }
   }

   /**
   * Given an IFD (Image File Directory) start offset
   * returns an offset to next IFD or 0 if it's the last IFD.
   */
   function getNextIFDOffset(dataView, dirStart, bigEnd)
   {
      //the first 2bytes means the number of directory entries contains in this IFD
      var entries = dataView.getUint16(dirStart, !bigEnd);

      // After last directory entry, there is a 4bytes of data,
      // it means an offset to next IFD.
      // If its value is '0x00000000', it means this is the last IFD and there is no linked IFD.

      return dataView.getUint32(dirStart + 2 + entries * 12, !bigEnd); // each entry is 12 bytes long
   }

   function readThumbnailImage(dataView, tiffStart, firstIFDOffset, bigEnd)
   {
      // get the IFD1 offset
      var IFD1OffsetPointer = getNextIFDOffset(dataView, tiffStart + firstIFDOffset, bigEnd);

      if (!IFD1OffsetPointer)
      {
         // console.log('******** IFD1Offset is empty, image thumb not found ********');
         return {};
      }
      else if (IFD1OffsetPointer > dataView.byteLength)
      { // this should not happen
         // console.log('******** IFD1Offset is outside the bounds of the DataView ********');
         return {};
      }
      // console.log('*******  thumbnail IFD offset (IFD1) is: %s', IFD1OffsetPointer);

      var thumbTags = readTags(dataView, tiffStart, tiffStart + IFD1OffsetPointer, IFD1Tags, bigEnd)

      // EXIF 2.3 specification for JPEG format thumbnail

      // If the value of Compression(0x0103) Tag in IFD1 is '6', thumbnail image format is JPEG.
      // Most of Exif image uses JPEG format for thumbnail. In that case, you can get offset of thumbnail
      // by JpegIFOffset(0x0201) Tag in IFD1, size of thumbnail by JpegIFByteCount(0x0202) Tag.
      // Data format is ordinary JPEG format, starts from 0xFFD8 and ends by 0xFFD9. It seems that
      // JPEG format and 160x120pixels of size are recommended thumbnail format for Exif2.1 or later.

      if (thumbTags['Compression'])
      {
         // console.log('Thumbnail image found!');

         switch (thumbTags['Compression'])
         {
            case 6:
               // console.log('Thumbnail image format is JPEG');
               if (thumbTags.JpegIFOffset && thumbTags.JpegIFByteCount)
               {
                  // extract the thumbnail
                  var tOffset = tiffStart + thumbTags.JpegIFOffset;
                  var tLength = thumbTags.JpegIFByteCount;
                  thumbTags['blob'] = new Blob([new Uint8Array(dataView.buffer, tOffset, tLength)], {
                     type: 'image/jpeg'
                  });
               }
               break;

            case 1:
               console.log("Thumbnail image format is TIFF, which is not implemented.");
               break;
            default:
               console.log("Unknown thumbnail image format '%s'", thumbTags['Compression']);
         }
      }
      else if (thumbTags['PhotometricInterpretation'] == 2)
      {
         console.log("Thumbnail image format is RGB, which is not implemented.");
      }
      return thumbTags;
   }

   function getStringFromDB(buffer, start, length)
   {
      var outstr = "";
      for (var n = start; n < start + length; n++)
      {
         outstr += String.fromCharCode(buffer.getUint8(n));
      }
      return outstr;
   }

   function readEXIFData(file, start)
   {
      if (getStringFromDB(file, start, 4) != "Exif")
      {
         if (debug) console.log("Not valid EXIF data! " + getStringFromDB(file, start, 4));
         return false;
      }

      var bigEnd,
          tags, tag,
          exifData, gpsData,
          tiffOffset = start + 6;

      // test for TIFF validity and endianness
      if (file.getUint16(tiffOffset) == 0x4949)
      {
         bigEnd = false;
      } else if (file.getUint16(tiffOffset) == 0x4D4D)
      {
         bigEnd = true;
      } else
      {
         if (debug) console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)");
         return false;
      }

      if (file.getUint16(tiffOffset + 2, !bigEnd) != 0x002A)
      {
         if (debug) console.log("Not valid TIFF data! (no 0x002A)");
         return false;
      }

      var firstIFDOffset = file.getUint32(tiffOffset + 4, !bigEnd);

      if (firstIFDOffset < 0x00000008)
      {
         if (debug) console.log("Not valid TIFF data! (First offset less than 8)", file.getUint32(tiffOffset + 4, !bigEnd));
         return false;
      }

      tags = readTags(file, tiffOffset, tiffOffset + firstIFDOffset, TiffTags, bigEnd);

      if (tags.ExifIFDPointer)
      {
         exifData = readTags(file, tiffOffset, tiffOffset + tags.ExifIFDPointer, ExifTags, bigEnd);
         for (tag in exifData)
         {
            switch (tag)
            {
               case "LightSource":
               case "Flash":
               case "MeteringMode":
               case "ExposureProgram":
               case "SensingMethod":
               case "SceneCaptureType":
               case "SceneType":
               case "CustomRendered":
               case "WhiteBalance":
               case "GainControl":
               case "Contrast":
               case "Saturation":
               case "Sharpness":
               case "SubjectDistanceRange":
               case "FileSource":
                  exifData[tag] = StringValues[tag][exifData[tag]];
                  break;

               case "ExifVersion":
               case "FlashpixVersion":
                  exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]);
                  break;

               case "ComponentsConfiguration":
                  exifData[tag] =
                      StringValues.Components[exifData[tag][0]] +
                      StringValues.Components[exifData[tag][1]] +
                      StringValues.Components[exifData[tag][2]] +
                      StringValues.Components[exifData[tag][3]];
                  break;
            }
            tags[tag] = exifData[tag];
         }
      }

      if (tags.GPSInfoIFDPointer)
      {
         gpsData = readTags(file, tiffOffset, tiffOffset + tags.GPSInfoIFDPointer, GPSTags, bigEnd);
         for (tag in gpsData)
         {
            switch (tag)
            {
               case "GPSVersionID":
                  gpsData[tag] = gpsData[tag][0] +
                      "." + gpsData[tag][1] +
                      "." + gpsData[tag][2] +
                      "." + gpsData[tag][3];
                  break;
            }
            tags[tag] = gpsData[tag];
         }
      }

      // extract thumbnail
      tags['thumbnail'] = readThumbnailImage(file, tiffOffset, firstIFDOffset, bigEnd);

      return tags;
   }

   function findXMPinJPEG(file)
   {

      if (!('DOMParser' in self))
      {
         // console.warn('XML parsing not supported without DOMParser');
         return;
      }
      var dataView = new DataView(file);

      if (debug) console.log("Got file of length " + file.byteLength);
      if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8))
      {
         if (debug) console.log("Not a valid JPEG");
         return false; // not a valid jpeg
      }

      var offset = 2,
          length = file.byteLength,
          dom = new DOMParser();

      while (offset < (length - 4))
      {
         if (getStringFromDB(dataView, offset, 4) == "http")
         {
            var startOffset = offset - 1;
            var sectionLength = dataView.getUint16(offset - 2) - 1;
            var xmpString = getStringFromDB(dataView, startOffset, sectionLength)
            var xmpEndIndex = xmpString.indexOf('xmpmeta>') + 8;
            xmpString = xmpString.substring(xmpString.indexOf('<x:xmpmeta'), xmpEndIndex);

            var indexOfXmp = xmpString.indexOf('x:xmpmeta') + 10
            //Many custom written programs embed xmp/xml without any namespace. Following are some of them.
            //Without these namespaces, XML is thought to be invalid by parsers
            xmpString = xmpString.slice(0, indexOfXmp)
                        + 'xmlns:Iptc4xmpCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/" '
                        + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
                        + 'xmlns:tiff="http://ns.adobe.com/tiff/1.0/" '
                        + 'xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus" '
                        + 'xmlns:ext="http://www.gettyimages.com/xsltExtension/1.0" '
                        + 'xmlns:exif="http://ns.adobe.com/exif/1.0/" '
                        + 'xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#" '
                        + 'xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#" '
                        + 'xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" '
                        + 'xmlns:xapGImg="http://ns.adobe.com/xap/1.0/g/img/" '
                        + 'xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/" '
                        + xmpString.slice(indexOfXmp)

            var domDocument = dom.parseFromString(xmpString, 'text/xml');
            return { doc: $.parseXML(xmpString), obj: xml2Object(domDocument) };
         } else
         {
            offset++;
         }
      }
   }

   function xml2json(xml)
   {
      var json = {};

      if (xml.nodeType == 1)
      { // element node
         if (xml.attributes.length > 0)
         {
            json['@attributes'] = {};
            for (var j = 0; j < xml.attributes.length; j++)
            {
               var attribute = xml.attributes.item(j);
               json['@attributes'][attribute.nodeName] = attribute.nodeValue;
            }
         }
      } else if (xml.nodeType == 3)
      { // text node
         return xml.nodeValue;
      }

      // deal with children
      if (xml.hasChildNodes())
      {
         for (var i = 0; i < xml.childNodes.length; i++)
         {
            var child = xml.childNodes.item(i);
            var nodeName = child.nodeName;
            if (json[nodeName] == null)
            {
               json[nodeName] = xml2json(child);
            } else
            {
               if (json[nodeName].push == null)
               {
                  var old = json[nodeName];
                  json[nodeName] = [];
                  json[nodeName].push(old);
               }
               json[nodeName].push(xml2json(child));
            }
         }
      }

      return json;
   }

   function xml2Object(xml)
   {
      try
      {
         var obj = {};
         if (xml.children.length > 0)
         {
            for (var i = 0; i < xml.children.length; i++)
            {
               var item = xml.children.item(i);
               var attributes = item.attributes;
               for (var idx in attributes)
               {
                  var itemAtt = attributes[idx];
                  var dataKey = itemAtt.nodeName;
                  var dataValue = itemAtt.nodeValue;

                  if (dataKey !== undefined)
                  {
                     obj[dataKey] = dataValue;
                  }
               }
               var nodeName = item.nodeName;

               if (typeof (obj[nodeName]) == "undefined")
               {
                  obj[nodeName] = xml2json(item);
               } else
               {
                  if (typeof (obj[nodeName].push) == "undefined")
                  {
                     var old = obj[nodeName];

                     obj[nodeName] = [];
                     obj[nodeName].push(old);
                  }
                  obj[nodeName].push(xml2json(item));
               }
            }
         } else
         {
            obj = xml.textContent;
         }
         return obj;
      } catch (e)
      {
         console.log(e.message);
      }
   }

   EXIF.enableXmp = function ()
   {
      EXIF.isXmpEnabled = true;
   }

   EXIF.disableXmp = function ()
   {
      EXIF.isXmpEnabled = false;
   }

   EXIF.getData = function (img, callback)
   {
      if (((self.Image && img instanceof self.Image)
          || (self.HTMLImageElement && img instanceof self.HTMLImageElement))
          && !img.complete)
         return false;

      if (!imageHasData(img))
      {
         getImageData(img, callback);
      } else
      {
         if (callback)
         {
            callback.call(img);
         }
      }
      return true;
   }

   EXIF.getTag = function (img, tag)
   {
      if (!imageHasData(img)) return;
      return img.exifdata[tag];
   }

   EXIF.getIptcTag = function (img, tag)
   {
      if (!imageHasData(img)) return;
      return img.iptcdata[tag];
   }

   EXIF.getAllTags = function (img)
   {
      if (!imageHasData(img)) return {};
      var a,
          data = img.exifdata,
          tags = {};
      for (a in data)
      {
         if (data.hasOwnProperty(a))
         {
            tags[a] = data[a];
         }
      }
      return tags;
   }

   EXIF.getAllIptcTags = function (img)
   {
      if (!imageHasData(img)) return {};
      var a,
          data = img.iptcdata,
          tags = {};
      for (a in data)
      {
         if (data.hasOwnProperty(a))
         {
            tags[a] = data[a];
         }
      }
      return tags;
   }

   EXIF.pretty = function (img)
   {
      if (!imageHasData(img)) return "";
      var a,
          data = img.exifdata,
          strPretty = "";
      for (a in data)
      {
         if (data.hasOwnProperty(a))
         {
            if (typeof data[a] == "object")
            {
               if (data[a] instanceof Number)
               {
                  strPretty += a + " : " + data[a] + " [" + data[a].numerator + "/" + data[a].denominator + "]\r\n";
               } else
               {
                  strPretty += a + " : [" + data[a].length + " values]\r\n";
               }
            } else
            {
               strPretty += a + " : " + data[a] + "\r\n";
            }
         }
      }
      return strPretty;
   }

   EXIF.readFromBinaryFile = function (file)
   {
      return findEXIFinJPEG(file);
   }

   if (typeof define === 'function' && define.amd)
   {
      define('exif-js', [], function ()
      {
         return EXIF;
      });
   }
}.call(this));
﻿var _photoList=[],_pubList=[],_tagItemId=-1,_uploading=!1,_badExt=["exe","vbs","bat","com","js","sh","ini","bin","swf","flv"],_imageExtensions=["jpeg","jpg","png","bmp","gif","tif","eps","ai","pdf","psd"],_uploadedCount=0,_defaultTags=[],_uploaderChangesMade=!1,_MTS_previewImg=null,_MTS_previewObj=null,_MTS_selectionScale=1,_MTS_focusImg=null,_MTS_focusObjs=[],_MTS_focusImgs=[],_MTS_focusDims=[],_pendingData=[],_profiles=[],_selectedRunDate=null,_selectedAd=null,_selectedIdx=-1,_imageVersionChange=!1,_changedCount=0;"undefined"==typeof _uploadType&&(_uploadType="image");var _updateRank=!1;function WireUpload(){_MTS_stopSearchOnce=!0,_cal.initialize(),_MTS_selectTagOverride=handleTagClick,_MTS_JQUERY(".photo_upload_widget").remove().appendTo("body"),"undefined"==typeof _chosenSupported&&(_chosenSupported="Microsoft Internet Explorer"===window.navigator.appName?8<=document.documentMode:!/iP(od|hone)/i.test(window.navigator.userAgent)&&(!/Android/i.test(window.navigator.userAgent)||!/Mobile/i.test(window.navigator.userAgent))),"function"==typeof _MTS_JQUERY().chosen&&_chosenSupported?_MTS_JQUERY("#albumSelect").chosen({width:"240px",disable_search:!0}):_MTS_JQUERY("#albumSelect").show();var s=_MTS_JQUERY(".photoHolder"),e=_MTS_JQUERY(".photoToolsCtr"),t=_MTS_JQUERY(".interfaceBarCtr"),o=_MTS_JQUERY(".updateButton");e.css({height:_MTS_JQUERY(window).outerHeight()-o.outerHeight()-t.outerHeight()+"px"}),s.css({height:_MTS_JQUERY(window).outerHeight()-t.outerHeight()+"px"});var i=_MTS_JQUERY(".mts_cc_text").css("color");_MTS_JQUERY(".bordered:hover, .indTag:hover, .viewTags:hover").css({"border-bottom-color":i});_MTS_JQUERY(".phBlock"),_MTS_JQUERY(".phBlockCtr"),_MTS_JQUERY(".phBlockTools");var t=_MTS_JQUERY(".phImgCtr"),i=_MTS_JQUERY(".closePreview"),r=_MTS_JQUERY(".previewCtr"),l=(_MTS_JQUERY(".dragDrop, .browseUnderlay"),_MTS_JQUERY(".noMedia, .phToolTip"),_MTS_JQUERY(".photoCtr"),_MTS_JQUERY(".prevImg")),_=!1;if("undefined"!=typeof _pubs&&_pubs)for(var a=0;a<_pubs.length;a++)_pubList.push(new publicationInfo(_pubs[a].Id,_pubs[a].Name,_pubs[a].PageRequired));function n(o){var i=!1;_MTS_JQUERY(".photoCtr").children().each(function(e){var t=this.id.split("_")[1];(0<_photoList[t].rank||!i)&&(_photoList[t].rank=e+1,_photoList[t].changesmade=!0),i=i||this.id==o.id}),CheckPhotosForRank()}function d(e){var t=_MTS_JQUERY("#cropGroup");r.show(),l.outerHeight()>l.outerWidth()&&l.addClass("portrait"),r.css({height:_MTS_JQUERY(window).outerHeight()/2-60+"px"});var o=(_MTS_focusImg=_MTS_JQUERY(e).parents(".phBlockCtr").find(".phImg")).attr("src"),i=_MTS_JQUERY(".prevImg");i.attr("src",o),r.css({height:s.outerHeight()+"px"}),_MTS_previewImg=i,s.addClass("overflow");for(var a=0,n=_MTS_focusObjs.length-1;a<=n;a++)_MTS_focusObjs[a].setOptions({hide:!0});_?t.show():t.hide(),"Image"==_uploadType&&(i=_MTS_JQUERY(e).parents(".phBlockCtr").find("textarea[name='caption']").val(),t=_MTS_JQUERY(e).parents(".phBlockCtr").find("input[name='credit']").val(),_MTS_JQUERY("#uniCap").val(i),_MTS_JQUERY("#uniCred").val(t)),_MTS_JQUERY(e).parents(".phBlockCtr").find("input[type=checkbox].phCheck").prop("checked",!0).change(),_MTS_JQUERY(".closePreview").data("photoId",_MTS_JQUERY(e).parents(".phBlockCtr").attr("id").split("_")[1])}function p(){r.hide(),e.removeClass("overflow"),s.removeClass("overflow"),_&&(hideImgArea(),_=!1),showThumbnailCrop(),$("#phuDragDrop").removeClass("hideIt")}_MTS_JQUERY("#pageStar").hide(),_MTS_JQUERY(document).on("click",".mts_focus",function(){var e=getAllElementsAt(this);1==e.length&&e[0].find("img").click()}),_MTS_JQUERY(".photoHolder").on("scroll",function(){for(var e=_MTS_focusObjs.length-1;0<=e;e--)_MTS_focusObjs[e].update()}),_MTS_JQUERY(document).on("focus","input[name='link']",function(){""==this.value&&(this.value="http://")}),_MTS_JQUERY(document).on("blur","input[name='link']",function(){"http://"==this.value&&(this.value="")}),_MTS_JQUERY(document).on("click",".closeUpload",function(e){var t=CloseUpload();void 0===t||t||e.preventDefault()}),_MTS_JQUERY(".photo_upload_widget").on("drag dragstart dragend dragover dragenter dragleave",function(e){e.preventDefault()}),0<_MTS_JQUERY(".dragDrop").length&&_MTS_JQUERY(".photoUploadContainer").on("drop",function(e){e.preventDefault(),e.stopPropagation();var t,o=e.target.files;(o=!o||0===o.length||e.dataTransfer?e.dataTransfer?e.dataTransfer.items:e.originalEvent.dataTransfer.files:o)[0]&&"function"==typeof o[0].webkitGetAsEntry&&(t=o[0].webkitGetAsEntry())?traverseFileUploadTree(t.filesystem.root,void 0,void 0,startPhotoUpload):(loopPhotoFiles(o),startPhotoUpload())}),_MTS_JQUERY(document).on("click",".phBrowse, #fPhotoHere",function(){_MTS_JQUERY("#fPhotoBrowse").click()}),_MTS_JQUERY("#fPhotoBrowse").change(function(){loopPhotoFiles(_MTS_JQUERY(this)[0]),startPhotoUpload()}),t.css({height:2.5*t.outerWidth()/4+"px"}),_MTS_JQUERY(".photoHolder").on("click",".phImgCtr",function(){return"Advertisement"!==_uploadType&&(_=!1,d(this),_MTS_JQUERY("#phuDragDrop").addClass("hideIt"),void("Image"==_uploadType&&(_MTS_JQUERY(".tab").removeClass("selected"),_MTS_JQUERY(".tab.tags").addClass("selected"),_MTS_JQUERY(".tool").removeClass("showTool"),_MTS_JQUERY(".phutags").addClass("showTool"))))}),_MTS_JQUERY(".photoHolder").on("click",".phCrop",function(){_=!0,d(this),wireImgArea(),checkForPhotos()}),_MTS_JQUERY(".photoHolder").on("click","#saveCrop",function(){applyImgArea(),p(),checkForPhotos()}),_MTS_JQUERY(".photoHolder").on("click",".phVersion",function(){_MTS_JQUERY(this).parents(".phBlockMain").siblings(".versionCtr").toggleClass("togglePanel")}),_MTS_JQUERY(".photoHolder").on("click",".closeVersionCtr",function(){_MTS_JQUERY(this).parents(".versionCtr").removeClass("togglePanel")}),_MTS_JQUERY(".photoHolder").on("click","input[name='photoStart'], input[name='photoEnd']",function(){var i=_MTS_JQUERY(this),e=new Date($.trim(this.innerHTML));isNaN(e)&&(e=new Date),_cal.GetMiniCalendar("select","Date",e,function(e,t,o){i.val(e.toString()+"/"+t.toString()+"/"+o.toString())})}),"undefined"!=typeof _rankImgs&&_rankImgs&&(1024<_MTS_JQUERY(window).outerWidth()&&_MTS_JQUERY(".photoCtr").sortable({update:function(e,t){n(t.item[0])}}),_MTS_JQUERY(".photoHolder").on("click",".phUp, .phDown",function(){var e=_MTS_JQUERY(this).parents("li"),t=_MTS_JQUERY(this).hasClass("phDown"),o=t?e.next("li"):e.prev("li");0<o.length&&(e.remove(),t?o.after(e):o.before(e),n(e[0]))}),_MTS_JQUERY("#wipeRank").click(function(){var e=!0,t=_MTS_JQUERY.map(_photoList,function(e,t){return t});if(0<_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck:checked").length&&(e=!1,t=_MTS_JQUERY.map(_photoList,function(e,t){return 0<_MTS_JQUERY("#block_"+t).find("input[type='checkbox'].phCheck:checked").length?t:null})),confirm("Are you sure you want to reset the display order for all "+(e?"":"selected ")+"items?")){for(var o=0;o<t.length;o++)_photoList[t[o]].rank=0,_photoList[t[o]].changesmade=!0;SortPhotosByRank()}})),_MTS_JQUERY("#prevX1, #prevX2, #prevY1, #prevY2").change(function(){setImgArea()}),i.on("click",function(){p(),_MTS_JQUERY(""),_MTS_JQUERY(".uploadTagWrapper").removeClass("showTagWrapper"),_MTS_JQUERY("#phuDragDrop").removeClass("hideIt"),_MTS_JQUERY("#uniCap, #uniCred").val(""),_MTS_JQUERY("#block_"+_MTS_JQUERY(this).data("photoId")).find(".phCheck").prop("checked",!1).change(),checkForPhotos()});_MTS_JQUERY(".viewTags"),_MTS_JQUERY(".tagViewerCtr");_MTS_JQUERY(".photoHolder").on("click",".viewTags",function(){_tagItemId=_MTS_JQUERY(this).parents(".phBlockCtr").attr("id").split("_")[1],_MTS_JQUERY(".tgImgCtr").css({height:2.5*_MTS_JQUERY(".tagViewerCtr").outerWidth()/4+"px"});var e=_MTS_JQUERY(this).parent(".phBlockInfo").siblings(".phImgCtr").children(".phImg").attr("src");_MTS_JQUERY(".tgImgCtr").children(".phImg").attr("src",e),updateTagList()});var i=_MTS_JQUERY("#cnaBtn, #cancelCna"),h=_MTS_JQUERY(".createNewAlbumCtr");i.on("click",function(){h.toggleClass("cnaOpen")}),_MTS_JQUERY("#saveCna").click(function(){var e,t=_MTS_JQUERY.trim(_MTS_JQUERY("#albumName").val()),o=_MTS_JQUERY.trim(_MTS_JQUERY("#albumDesc").val()),i=_MTS_JQUERY.trim(_MTS_JQUERY("#albumSlugline").val());0!=t.length?((e=[]).push({name:"albums",value:JSON.stringify([{id:-1,name:t,desc:o,slugline:i,created:!0}])}),_MTS_JQUERY.post("/api/portalAdmin/updateAlbumManager.aspx",e,function(e){e.ok?(_MTS_JQUERY("#albumSelect").append(_MTS_JQUERY("<option></option>").attr("value",e.newAlbumId).text(t).prop("selected",!0)),_MTS_JQUERY("#albumSelect").trigger("chosen:updated"),_uploaderChangesMade=!0,h.toggleClass("cnaOpen")):alert(e.error)},"json")):alert("Album needs a title.")}),o.on("click",function(){_uploading||(0<_pendingData.length?(_MTS_JQUERY(document).off("metadataLoaded"),_MTS_JQUERY(document).on("metadataLoaded",savePhotos)):o.hasClass("updateButtonActive")?(_uploadedCount=0,_MTS_JQUERY(".imgCheck, .imgErr").remove(),savePhotos()):alert("There are no items to save"))}),_MTS_JQUERY("#selAll").change(function(){_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck").prop("checked",_MTS_JQUERY(this).prop("checked")),checkForSelected(),updateTagList()}),_MTS_JQUERY("#remSel").click(function(){_MTS_JQUERY(this).hasClass("noSelect")||removeMultiPhotoUpload(_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck:checked").parents(".phBlockCtr").map(function(){return this.id.split("_")[1]}),!0)}),_MTS_JQUERY("#remAll").click(function(){_MTS_JQUERY(this).hasClass("noSelect")||removeMultiPhotoUpload(_MTS_JQUERY(".photoHolder").find(".phBlockCtr").map(function(){return this.id.split("_")[1]}),!1)}),"Advertisement"===_uploadType&&_MTS_JQUERY(".photoHolder").on("click",".phImgCtr",function(){_MTS_JQUERY(this).parents(".phBlockCtr").find("input[type='checkbox'].phCheck").click()}),_MTS_JQUERY(".photoHolder").on("change","input[type='checkbox'].phCheck",function(){var e;"Image"==_uploadType?(checkForSelected(),updateTagList()):"Advertisement"==_uploadType&&(_MTS_JQUERY(".phCheck:checked").not(this).prop("checked",!1),_MTS_JQUERY(this).is(":checked")?(enableAdForm(),e=_MTS_JQUERY(this).parents(".phBlockCtr")[0].id.split("_")[1],_selectedAd=_photoList[e],_selectedIdx=e,_MTS_JQUERY(".adInfoForm").find("input[name='accountNumber']").val(_selectedAd.accountNumber),_MTS_JQUERY(".adInfoForm").find("input[name='title']").val(_selectedAd.title),_MTS_JQUERY(".adInfoForm").find("input[name='adNumber']").val(_selectedAd.adNumber),_MTS_JQUERY(".adInfoForm").find("input[name='width']").val(_selectedAd.width),_MTS_JQUERY(".adInfoForm").find("input[name='height']").val(_selectedAd.height),_MTS_JQUERY(".adInfoForm").find("textarea[name='notes']").val(_selectedAd.notes),_MTS_JQUERY(".adInfoForm").find("input[name='url']").val(_selectedAd.url),_MTS_JQUERY(".adInfoForm").find("input[name='colorSetting'][value='"+_selectedAd.colorSetting+"']").prop("checked",!0),_MTS_JQUERY(".adInfoForm").find("input[name='requestedPageLocation']").val(_selectedAd.requestedPageLocation),_MTS_JQUERY("#dateWrapper").find(".runDate").remove(),_MTS_JQUERY("#insertionWrapper").hide(),_selectedAd.runDates&&_selectedAd.runDates.forEach(function(e,t){var o="<div id='date_"+t+"' class='runDate'>"+_MTS_JQUERY("#dateTemplate").html()+"</div>";_MTS_JQUERY("#dateWrapper").append(o);e=new Date(e.RunDate);isNaN(e)||(e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()),_MTS_JQUERY("#date_"+t).find(".dateContent").html(e)}),_MTS_JQUERY(".result").removeClass("selectedTag")):(_selectedAd=null,disableAdForm()),_MTS_JQUERY(".uploadTagWrapper").removeClass("showTagWrapper"))}),_MTS_JQUERY(".photoHolder").on("click",".phRemove",function(){removePhotoUpload(_MTS_JQUERY(this).parents(".phBlockCtr")[0].id.split("_")[1])}),_MTS_JQUERY(".tagList").on("click",".removeTag",function(){var e=_MTS_JQUERY(this).siblings("input[name='id']").val(),t=_MTS_JQUERY(this).siblings("input[name='type']").val();removeTag([_photoList[_tagItemId]],e,t)}),_MTS_JQUERY("#selectedTags").on("click",".removeTag",function(){var e=_MTS_JQUERY(this).siblings("input[name='id']").val(),t=_MTS_JQUERY(this).siblings("input[name='type']").val();removeTag(_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck:checked").parents(".phBlockCtr").map(function(){var e=this.id.split("_")[1];return void 0===_photoList[e]||_photoList[e].removed?null:_photoList[e]}),e,t)}),_MTS_JQUERY("#allTags").on("click",".removeTag",function(){var e=_MTS_JQUERY(this).siblings("input[name='id']").val(),t=_MTS_JQUERY(this).siblings("input[name='type']").val();removeTag(_MTS_JQUERY.map(_photoList,function(e){return e.removed?null:e}),e,t)}),_MTS_JQUERY(".searchResults").on("click",".selectedTag",function(e){e.preventDefault(),e.stopPropagation();var e=this.href.match(/([\w]+)/g),t=e.pop(),o=e.pop();_MTS_JQUERY(this).removeClass("selectedTag"),"Image"==_uploadType?_MTS_JQUERY(".uploadTagContainer:visible .tagAll").each(function(){var e=_MTS_JQUERY(this);e.find("input[name='id']").val()==o&&e.find("input[name='type']").val()==t&&e.find(".removeTag").click()}):removeAdTag(o,t)}),_MTS_JQUERY("#tagSelected").click(function(){_MTS_JQUERY(this).hasClass("noSelect")||(_tagItemId=-1,ToggleNewUploadTag())}),_MTS_JQUERY(".photoHolder").on("click",".tagIcon",function(){_tagItemId=parseInt(_MTS_JQUERY(this).parents(".phBlockCtr").attr("id").split("_")[1]),_MTS_JQUERY("#block_"+_tagItemId).find(".viewTags").click(),ToggleNewUploadTag(),_MTS_JQUERY(".tab").removeClass("selected"),_MTS_JQUERY(".tab.tags").addClass("selected"),_MTS_JQUERY(".tool").removeClass("showTool"),_MTS_JQUERY(".phutags").addClass("showTool"),_MTS_JQUERY("#phuDragDrop").addClass("hideIt"),_MTS_JQUERY(".photoHolder input[type=checkbox].phCheck").prop("checked",!1).change(),_MTS_JQUERY(this).parents(".phBlockCtr").find("input[type=checkbox].phCheck").prop("checked",!0).change()}),_MTS_JQUERY(".photoHolder").on("change","input[type='text']",function(){_uploaderChangesMade=!0}),_MTS_JQUERY("#update_Cap, #update_Cred").click(function(){var e=this.id.split("_")[1],t=_MTS_JQUERY("#uni"+e).val(),o=_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck:checked").parents(".phBlockCtr");(o=0==o.length?_MTS_JQUERY(".photoHolder .phBlockCtr"):o).find("[name='"+("Cap"==e?"caption":"credit")+"']").val(t),_uploaderChangesMade=!0}),_MTS_JQUERY("#mts_unlockstory").click(function(){_MTS_JQUERY(".photo_upload_widget").css("height","100%"),_MTS_JQUERY(".updateButtonCtr").css("bottom","0px"),_MTS_JQUERY(".progress").css("bottom","50px")}),_MTS_JQUERY(window).on("orientationchange",function(){var e,t;767<_MTS_JQUERY(window).width()||(_MTS_JQUERY(window).width()>_MTS_JQUERY(window).height()?(e=_MTS_JQUERY(".previewLbl"),setTimeout(function(){e.addClass("hideLbl")},2e3),_MTS_JQUERY(".previewCtr").on("click",function(){e.toggleClass("hideLbl")})):(e=_MTS_JQUERY(".previewLbl")).removeClass("hideLbl"),t=_MTS_JQUERY("#remSel, #remAll").detach(),void 0===window.orientation||0==window.orientation?t.appendTo(".mtType"):t.appendTo(".selOptions"))}),_MTS_JQUERY(window).resize(function(){resizePhotoUpload()}),checkForPhotos(),checkForSelected(),"Image"==_uploadType&&updateTagList();var c=_MTS_JQUERY(".tab");c.on("click",function(){var e;_MTS_JQUERY(this).hasClass("selected")||(e=".phu"+_MTS_JQUERY(this).attr("class").substring(4),_MTS_JQUERY(".tool").removeClass("showTool"),c.removeClass("selected"),_MTS_JQUERY(this).addClass("selected"),_MTS_JQUERY(e).addClass("showTool"))}),_MTS_JQUERY(".photo_upload_widget #searchPhrase").on("keydown",function(e){13===e.which&&(e.preventDefault(),MTS_handleEz(0,null,this))}),_MTS_JQUERY(document).on("click","input[name='publication']",function(){ToggleNewUploadTag()}),_MTS_JQUERY(document).on("change","input[name='colorSetting']",function(){_selectedAd.colorSetting=_MTS_JQUERY(this).val(),_uploaderChangesMade=!0}),_MTS_JQUERY("#pickRunDates").on("click",function(){showRunDateCalendar()}),_MTS_JQUERY(document).on("change","input[name='publication'], input[name='edition'], input[name='section'], input[name='page'], input[name='zone'], input[name='horizontalPosition'], input[name='verticalPosition']",function(){var e=(e=this.name)[0].toUpperCase()+e.substr(1);_selectedRunDate[e]=this.value}),_MTS_JQUERY(document).on("click",".dateContent",function(){_MTS_JQUERY(".selectedRunDate").removeClass("selectedRunDate"),_MTS_JQUERY(this).addClass("selectedRunDate"),_MTS_JQUERY("#insertionWrapper").show();var e=_MTS_JQUERY(this).parents(".runDate")[0].id.split("_")[1],e=findPublicationByPubCode((_selectedRunDate=_selectedAd.runDates[e]).Publication,_selectedRunDate.PublicationId);setRunDateValue(null==e?"":e.Name,_selectedRunDate.Edition,_selectedRunDate.Section,_selectedRunDate.Page,_selectedRunDate.Zone,_selectedRunDate.HorizontalPosition,_selectedRunDate.VerticalPosition)}),_MTS_JQUERY(document).on("click",".delete",function(){var e=_MTS_JQUERY(this).parents(".runDate")[0].id.split("_")[1];_MTS_JQUERY(this).parents(".runDate").remove(),_MTS_JQUERY("#insertionWrapper").hide(),_selectedAd.runDates.splice(e,1),_selectedRunDate=null,_MTS_JQUERY(".runDate").each(function(e,t){t.id="date_"+e}),_uploaderChangesMade=!0}),_MTS_JQUERY(document).on("change",".adInfoInput",function(){"title"===this.name&&_MTS_JQUERY("#block_"+_selectedIdx).find(".phInfoName").html(this.value),_selectedAd[this.name]=this.value,_uploaderChangesMade=!0}),_MTS_JQUERY(window).trigger("orientationchange"),disableAdForm()}function findPublicationByPubCode(e,t){for(var o=void 0!==t&&0<t,i=_pubs.length-1;0<=i;i--)if(o?_pubs[i].Id==t:_pubs[i].PubCode===e)return _pubs[i];return null}function setRunDateValue(e,t,o,i,a,n,s){_MTS_JQUERY("input[name='publication']").val(e),_MTS_JQUERY("input[name='edition']").val(t),_MTS_JQUERY("input[name='section']").val(o),_MTS_JQUERY("input[name='page']").val(i),_MTS_JQUERY("input[name='zone']").val(a),_MTS_JQUERY("input[name='horizontalPosition']").val(n),_MTS_JQUERY("input[name='verticalPosition']").val(s)}function resizePhotoUpload(){var e=_MTS_JQUERY(".photoHolder"),t=_MTS_JQUERY(".photoToolsCtr"),o=_MTS_JQUERY(".interfaceBarCtr"),i=_MTS_JQUERY(".updateButton"),a=_MTS_JQUERY(".phImgCtr"),n=(_MTS_JQUERY(".closePreview"),_MTS_JQUERY(".previewCtr"));t.css({height:_MTS_JQUERY(window).outerHeight()-i.outerHeight()-(o.outerHeight()+20)+"px"}),e.css({height:_MTS_JQUERY(window).outerHeight()-o.outerHeight()+"px"}),a.css({height:2.5*a.outerWidth()/4+"px"}),_MTS_JQUERY(".photo_upload_widget").css("height",_MTS_JQUERY(window).height()-_MTS_JQUERY("#mts_unlockstory:visible").height()+"px"),n.css({height:_MTS_JQUERY(window).outerHeight()-50+"px"}),wireImgArea()}function checkForPhotos(){var e=_MTS_JQUERY(".noMediaWrapper"),t=_MTS_JQUERY(".updateButton"),o=_MTS_JQUERY("#remAll, #tagSelected");if(_uploading)e.hide(),t.removeClass("updateButtonActive"),t.html("Sending..."),o.removeClass("noSelect");else if(0<_MTS_JQUERY("#cropGroup #saveCrop:visible").length)e.show(),t.removeClass("updateButtonActive"),t.html("Cropping..."),o.addClass("noSelect");else if(0==_MTS_JQUERY(".photoHolder .phBlockCtr").length){switch(e.show(),t.removeClass("updateButtonActive"),_uploadType){default:case"Image":case"Author":t.html("Waiting for photos");break;case"Advertisement":t.html("Waiting for ads")}o.addClass("noSelect")}else e.hide(),t.addClass("updateButtonActive"),t.html("Save and update"),o.removeClass("noSelect")}function checkForSelected(){0<_MTS_JQUERY(".photoHolder .phBlockCtr").length&&0==_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck:not(:checked)").length?_MTS_JQUERY("#selAll").prop("checked",!0):_MTS_JQUERY("#selAll").prop("checked",!1),0<_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck:checked").length?(_MTS_JQUERY("#remSel").removeClass("noSelect"),_MTS_JQUERY("#allTags").hide(),_MTS_JQUERY("#selectedTags").show()):(_MTS_JQUERY("#remSel").addClass("noSelect"),_MTS_JQUERY("#allTags").show(),_MTS_JQUERY("#selectedTags").hide()),_MTS_JQUERY(".selectCount").html(_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck:checked").length)}function enableAdForm(){_MTS_JQUERY(".adInfoInput, input[name='colorSetting']").prop("disabled",!1),_MTS_JQUERY("#pickRunDates").addClass("pickRunDatesActive").on("click",function(){showRunDateCalendar()})}function disableAdForm(){_MTS_JQUERY(".adInfoInput").prop("disabled",!0).val(""),_MTS_JQUERY(".result").removeClass("selectedTag"),_MTS_JQUERY("input[name='colorSetting']").prop("disabled",!0).first().prop("checked",!0),_MTS_JQUERY("#pickRunDates").removeClass("pickRunDatesActive").off("click"),_MTS_JQUERY(".runDate").remove()}function showRunDateCalendar(){var e=new Date;_cal.GetMiniCalendar("multi","Select Run Dates",e,function(e,t,o){for(var i=0;i<e.length;i++){var a=$(".runDate").length,n="<div id='date_"+a+"' class='runDate'>"+_MTS_JQUERY("#dateTemplate").html()+"</div>";$("#dateWrapper").append(n);var s=e[i].toString()+"/"+t[i].toString()+"/"+o[i].toString(),n=$("#date_"+a).find(".dateContent");n.html(s);a={};a.RunDate=s,_selectedAd.runDates.push(a),0==i&&n.click()}0<e.length&&(_uploaderChangesMade=!0)},!1,null)}function getCommonTagHtml(e,t){for(var o="",i=e.length-1;0<=i;i--)if(!e[i].removed){for(var a=!0,n=0;n<t.length;n++){for(var s=!1,r=0;r<t[n].tags.length;r++){var l=t[n].tags[r];if(l.id==e[i].id&&l.type==e[i].type&&!l.removed){s=!0;break}}if(!s){a=!1;break}}a&&(o+=getTagHtml(e[i]))}return o=0==o.length?"No tags selected":o}function getTagHtml(e){return"<div class='tagAll' title=\""+e.title.replace(/"/g,"&quot;")+'">'+e.title+"<img alt='Remove Tag' class='removeTag' src='"+_mediaUrl+"images/gratsClose.png'><input type='hidden' name='id' value='"+e.id+"' /><input type='hidden' name='type' value='"+e.type+"' /></div>"}function removeTag(e,t,o){for(var i=0;i<e.length;i++)for(var a=e[i].tags.length-1;0<=a;a--){var n=e[i].tags[a];n.id==t&&n.type==o&&(n.removed=!0,_uploaderChangesMade=!0,e[i].changesmade=!0)}updateTagList()}function removeAdTag(e,t){for(var o=_selectedAd.tags.length-1;0<=o;o--){var i=_selectedAd.tags[o];i.id==e&&i.type==t&&(i.removed=!0,_uploaderChangesMade=!0)}updateAdTagList()}function loopPhotoFiles(e){for(var t=void 0===e.files?e:e.files,o=0;o<t.length;o++){var i=t[o].size,a=null;if("Image"==_uploadType){if(a=new mtsPhotoInfo(t[o],isImageType(t[o].name),i>_MTS_uploadLimit,!0,!0),"undefined"!=typeof _tagsLinkName&&"undefined"!=typeof _tagsLinkType)for(var n=0;n<_tags.length;n++)a.tags.push(new mtsTag(_tags[n],_tagsLinkType[n],_tagsLinkName[n]))}else a=new adInfo(t[o],isImageType(t[o].name),i>_MTS_uploadLimit,!0,!0);_photoList.push(a),_uploaderChangesMade=!0}}function startPhotoUpload(){drawPhotoUploadList(),loadPhotoThumbnails(),checkForPhotos(),"Image"==_uploadType?updateTagList():"Advertisement"===_uploadType&&setTimeout(function(){_MTS_JQUERY(".phBlockCtr input[type='checkbox'].phCheck:visible:last").click()},0)}function traverseFileUploadTree(o,a,n,s){s.pending||(s.pending=0),s.pending++,a=a||"",o.isFile?o.file(function(e){_photoList.push(new mtsPhotoInfo(e,isImageType(target[i].name),e.size>_MTS_uploadLimit,!0,!0,n)),_uploaderChangesMade=!0,s.pending--,0==s.pending&&s()}):o.isDirectory&&o.createReader().readEntries(function(e){s.pending--;for(var t=0;t<e.length;t++)traverseFileUploadTree(e[t],a+o.name+"/",e[t].isDirectory?e[t].name:n,s)})}function drawPhotoUploadList(){for(var e=0;e<_photoList.length;e++)if(!_photoList[e].drawn&&!_photoList[e].removed){_photoList[e].drawn=!0;var t=_MTS_JQUERY(".photoBlockTemplate").html();if(_photoList[e].isImage||"Advertisement"===_uploadType?_photoList[e].isTooBig?(t="",alert(`File too large: ${_photoList[e].file.name}\nMust be smaller than ${_MTS_uploadLimit/1024/1024}MB.`)):t=t.replace(/%%PHOTO_ID%%/g,e):(t="",alert("Invalid File: "+_photoList[e].file.name+"\nFile must be an image.")),_MTS_JQUERY(".photoCtr").append(t),_MTS_JQUERY(".phImgCtr").css({height:2.5*_MTS_JQUERY(".phImgCtr").outerWidth()/4+"px"}),_MTS_JQUERY(".photoCtr .phBlockCtr:last").addClass("fill"),"Image"==_uploadType){var o=_MTS_JQUERY("#block_"+e);if(null!==_photoList[e].file)loadMetadata(e);else if(o.find(".phInfoName").html(_photoList[e].filename),o.find(".phInfoName").attr("title",_photoList[e].filename),o.find("textarea[name='caption']").val(_photoList[e].caption),o.find("input[name='fileName']").val(_photoList[e].filename),o.find("input[name='slugline']").val(_photoList[e].slugline),o.find("input[name='credit']").val(_photoList[e].credit),o.find("input[name='link']").val(_photoList[e].link),o.find("textarea[name='desc']").val(_photoList[e].desc),o.find("input[name='photoStart']").val(_photoList[e].start),o.find("input[name='photoEnd']").val(_photoList[e].end),o.find("select[name='toningProfile']").val(_photoList[e].toningId),o.find("select[name='presentation']").val(_photoList[e].presentation),o.find("input[id='hiddenImage']").prop("checked",_photoList[e].hide),null!=_photoList[e].pendingTone&&o.find(".pendingTone").html("Toning Pending: "+_photoList[e].pendingTone.profile).css({color:"#"+_photoList[e].pendingTone.hex}).show(),1<_photoList[e].webActiveVersion){o.find(".versionInfo").html("ver. "+_photoList[e].webActiveVersion),o.find(".phVersion").show();for(var i=_photoList[e].webActiveVersion;1<=i;i--){for(var a="&nbsp;",n=_photoList[e].prevVersions.length-1;0<=n;n--)if(_photoList[e].prevVersions[n].ver==i){a=_photoList[e].prevVersions[n].profile;break}var s="",s=_photoList[e].webActiveVersion==i?'<div class="activeState">Active Web Image</div>':"<a title='Set Active' class=\"setActive mts_cc_text\">Set Active</a>",r=_MTS_JQUERY("#verItemTemplate").html();r=(r=(r=(r=r.replace(/%%VER_PROF%%/g,a)).replace(/%%VER_NUM%%/g,1<i?"ver. "+i:"original")).replace(/%%VER_ACTION%%/g,s)).replace(/%%IMAGE_ID%%/g,_photoList[e].id);r=_MTS_JQUERY(r);o.find(".versionCtr").append(r),r.on("click",".setActive",function(e){var t=$(e.target).parent(),o=t.find(".versionNumber").html().split(" "),i=1<o.length?parseInt(o[1]):1,e=t.find("input[name='imageId']").val(),o=parseInt(e),e=[];e.push("image_id="+o),e.push("portal_id="+_portalId),e.push("ver="+i);i=[];i.push("path="+encodeURIComponent("/api/v1/cms/images/set/")),i.push("map="+encodeURIComponent(e.join("&"))),_MTS_JQUERY.getJSON("/api/portalAdmin/sendApiRequest.aspx?"+i.join("&"),function(e){e.Success?(t.parents(".versionCtr").find(".activeState").replaceWith("<a title='Set Active' class='setActive mts_cc_text'>Set Active</a>"),t.find(".setActive").replaceWith("<div class='activeState'>Active Web Image</div>"),t.parents(".phBlockCtr").find(".phImg").attr("src",t.siblings(".versionThumb").attr("src"))):alert("Failed to set active: "+e.Error)})})}}else o.find(".phVersion").hide();0==_profiles.length&&o.find("select[name='toningProfile']").hide(),addDefaultTags(e)}else(o=_MTS_JQUERY("#block_"+e)).find("input[name='slugline']").hide(),o.find(".phInfoName").removeClass("hidden"),o.find(".hfgCtr").hide(),o.find("input[name='fileName']").hide(),o.find("select[name='presentation']").hide(),o.find(".phCrop").hide(),o.find(".tagIcon").hide(),o.find("textarea[name='caption']").hide(),o.find("input[name='credit']").hide(),o.find("input[name='link']").hide(),o.find("textarea[name='desc']").hide(),o.find("input[name='photoStart']").hide(),o.find("input[name='photoEnd']").hide(),o.find("select[name='toningProfile']").hide()}}function loadPhotoThumbnails(){for(var e,t=0;t<_photoList.length;t++)if(_photoList[t].isImage&&!_photoList[t].isTooBig&&_photoList[t].isPendingThumb)if(null!==_photoList[t].file)loadPhotoThumb(t,_photoList[t].file);else{_MTS_JQUERY("#block_"+t).find(".phImg").attr("src",_photoList[t].src).removeClass("loading");for(var o=_MTS_JQUERY("#block_"+t).find(".versionItem"),i=o.length-1,a=1;0<=i;i--,a++){var n=_MTS_JQUERY(o[i]).find(".versionNumber").html().split(" ");1<n.length&&parseInt(n[1]);_MTS_JQUERY(o[i]).find(".versionThumb").attr("src",_photoList[t].src.replace(/([0-9]*)_v([0-9]+)/g,"$1")+(1<a?"_v"+a:"")).removeClass("loading")}_photoList[t].isPendingThumb=!1}else"Advertisement"===_uploadType&&_photoList[t].file&&(loadPdfThumb(t,_photoList[t].file),(e=_MTS_JQUERY("#block_"+t)).find(".phInfoName").html(_photoList[t].title),_photoList[t].isPendingThumb=!1,e.find(".loading").attr("src",_MTS_MEDIAURL+"images/blockNoImg.png").removeClass("loading"))}function loadPdfThumb(o,e){var t=new FileReader;t.onload=function(e){var t=_MTS_JQUERY("#block_"+o).find(".phImgCtr");"function"==typeof _MTS_placePdf&&_MTS_placePdf(t,_photoList[o].title,e.target.result),_photoList[o].isPendingThumb=!1},t.readAsDataURL(e)}function loadPhotoThumb(t,e){var o=new FileReader;o.onload=function(e){_MTS_JQUERY("#block_"+t).find(".phImg").removeClass("loading").attr("src",e.target.result),orientPhoto(t),_photoList[t].isPendingThumb=!1},o.readAsDataURL(e)}function getInitCords(){var e=_MTS_previewImg.width(),t=_MTS_previewImg.height(),o=calculateGCD(_imageSizes.SiteWideMxH,_imageSizes.SiteWideMxW),i=!1;return 1<o&&(50<(o=calculateAspectRatioFit(_imageSizes.SiteWideMxW/o,_imageSizes.SiteWideMxH/o,e,t)).width&&50<o.height&&(e=Math.floor(o.width),t=Math.floor(o.height),i=!0)),i||(t=e=50),{x:0,y:0,x2:e,y2:t}}function calculateGCD(e,t){return t?calculateGCD(t,e%t):e}function calculateAspectRatioFit(e,t,o,i){i=Math.min(o/e,i/t);return{width:e*i,height:t*i}}function wireImgArea(){if(null!=_MTS_previewImg){for(var e=getInitCords(),t=e.x,o=e.y,i=e.x2,a=e.y2,n=0,s=_MTS_focusObjs.length-1;n<=s;n++)_MTS_focusObjs[n].setOptions({hide:!0}),_MTS_focusImgs[n][0]==_MTS_focusImg[0]&&(t=_MTS_focusDims[n].x1/_MTS_focusDims[n].previewScale,o=_MTS_focusDims[n].y1/_MTS_focusDims[n].previewScale,i=_MTS_focusDims[n].x2/_MTS_focusDims[n].previewScale,a=_MTS_focusDims[n].y2/_MTS_focusDims[n].previewScale);_MTS_previewImg[0].style.width=_MTS_previewImg.width(),_MTS_previewImg[0].style.height=_MTS_previewImg.height(),null==_MTS_previewObj?_MTS_previewObj=_MTS_previewImg.imgAreaSelect({x1:e.x,y1:e.y,x2:e.x2,y2:e.y2,instance:!0,minWidth:50,minHeight:50,onSelectEnd:handleForm,persistent:!0,handles:!0}):_MTS_previewObj.setOptions({x1:t,y1:o,x2:i,y2:a,hide:!1}),updateCoords(t,i,o,a),_MTS_selectionScale=_MTS_previewImg.width()}}function setImgArea(){var e=parseInt(_MTS_JQUERY("#prevX1").val()),t=parseInt(_MTS_JQUERY("#prevX2").val())+e,o=parseInt(_MTS_JQUERY("#prevY1").val()),i=parseInt(_MTS_JQUERY("#prevY2").val())+o;_MTS_previewObj.setSelection(e,o,t,i),_MTS_previewObj.update()}function hideImgArea(){void 0!==_MTS_previewObj&&null!=_MTS_previewObj&&_MTS_previewObj.setOptions({hide:!0})}function handleForm(e,t){updateCoords(t.x1,t.x2,t.y1,t.y2)}function updateCoords(e,t,o,i){_MTS_JQUERY('input[id="prevX1"]').val(e),_MTS_JQUERY('input[id="prevY1"]').val(o),_MTS_JQUERY('input[id="prevX2"]').val(t),_MTS_JQUERY('input[id="prevY2"]').val(i)}function applyImgArea(){for(var e=parseInt(_MTS_JQUERY("#prevX1").val()),t=parseInt(_MTS_JQUERY("#prevX2").val()),o=parseInt(_MTS_JQUERY("#prevY1").val()),i=parseInt(_MTS_JQUERY("#prevY2").val()),a=_MTS_focusImg.width()/_MTS_selectionScale,n=-1,s=_MTS_focusImgs.length-1;0<=s;s--)if(_MTS_focusImgs[s][0]==_MTS_focusImg[0]){n=s;break}(e*=a)<0&&(e=0),(t*=a)<0&&(t=0),(o*=a)<0&&(o=0),(i*=a)<0&&(i=0),0<=n?(_MTS_focusDims[s]={x1:e,x2:t,y1:o,y2:i,previewScale:a,scale:_MTS_selectionScale/_MTS_previewImg[0].naturalWidth},_MTS_focusObjs[n].setOptions({x1:Math.floor(e),y1:Math.floor(o),x2:Math.floor(t),y2:Math.floor(i)})):(_MTS_focusDims.push({x1:e,x2:t,y1:o,y2:i,previewScale:a,scale:_MTS_selectionScale/_MTS_previewImg[0].naturalWidth}),_MTS_focusObjs.push(_MTS_focusImg.imgAreaSelect({x1:Math.floor(e),y1:Math.floor(o),x2:Math.floor(t),y2:Math.floor(i),persistent:!0,disable:!0,instance:!0})),_MTS_focusImgs.push(_MTS_focusImg))}function showThumbnailCrop(){for(var e=0,t=_MTS_focusObjs.length-1;e<=t;e++){var o=_MTS_focusDims[e];_MTS_focusObjs[e].setOptions({x1:o.x1,y1:o.y1,x2:o.x2,y2:o.y2,hide:!1,classPrefix:"mts_focus imgareaselect"});for(var i=_MTS_JQUERY(".phImgCtr img"),a=i.length-1;0<=a;a--)if(i[a]==_MTS_focusImgs[e][0]){_photoList[a].dims=_MTS_focusDims[e],_photoList[a].changesmade=!0;break}}}function disableThumbnailCrop(){for(var e=_MTS_focusObjs.length-1;0<=e;e--){_MTS_focusDims[e];_MTS_focusObjs[e].setOptions({hide:!0});for(var t=_MTS_JQUERY(".phImgCtr img"),o=t.length-1;0<=o;o--)if(t[o]==_MTS_focusImgs[e][0]){_photoList[o].dims=[];break}_MTS_focusImgs.pop(),_MTS_focusDims.pop(),_MTS_focusObjs.pop()}}function getAllElementsAt(e){var t=getElementPosition(e);return null==t?[]:_MTS_JQUERY(".phImgCtr").map(function(){var e=getElementPosition(this);return t.y<=e.y&&t.y>=e.t&&t.x<=e.x&&t.x>=e.l?_MTS_JQUERY(this):null})}function getElementPosition(e){var t=_MTS_JQUERY(e),o=t.offset();if(!o)return null;var i=o.left,e=o.top,o=t.height();return{x:i+t.width(),y:e+o,t:e,l:i}}function addDefaultTags(e){for(var t=0;t<_defaultTags.length;t++)addTag(_photoList[e].tags,_defaultTags[t].id,_defaultTags[t].type,_defaultTags[t].title)}function loadMetadata(o){_pendingData.push(o);var i=_photoList[o],a=_MTS_JQUERY("#block_"+o);EXIF.enableXmp(),EXIF.getData(i.file,function(){var e=EXIF.getTag(this,"Artist")||EXIF.getIptcTag(this,"credit")||$(this.xmpdata.doc).find("dc\\:creator").text().replace(/\s+/g," ").trim(),t=EXIF.getTag(this,"ImageDescription")||EXIF.getIptcTag(this,"caption")||$(this.xmpdata.doc).find("dc\\:description").text().replace(/\s+/g," ").trim();a.find(".phInfoName").html(i.file.name),a.find(".phInfoName").attr("title",i.file.name),a.find("input[name='fileName']").val(i.file.name),a.find("input[name='credit']").val(e),a.find("textarea[name='caption']").val(t),_pendingData.splice(_pendingData.indexOf(o),1),0==_pendingData.length&&(_MTS_JQUERY(document).trigger("metadataLoaded"),_MTS_JQUERY(document).off("metadataLoaded"))})}function orientPhoto(e){_pendingData.push(e);var t=_photoList[e],o=_MTS_JQUERY("#block_"+e).find(".phImg");o.removeClass("flip rotate90 rotate180 rotate270 rotate90flip rotate180flip rotate270flip"),EXIF.getData(t.file,function(){switch(EXIF.getTag(this,"Orientation")){case 8:o.addClass("rotate270");break;case 7:o.addClass("rotate90flip");break;case 6:o.addClass("rotate90");break;case 5:o.addClass("rotate270flip");break;case 4:o.addClass("rotate180flip");break;case 3:o.addClass("rotate180");break;case 2:o.addClass("flip")}_pendingData.splice(_pendingData.indexOf(e),1),_MTS_JQUERY(document).trigger("orientationLoaded"),_MTS_JQUERY(document).off("orientationLoaded")})}function checkFormDataChanges(e,t){var o=e.find("input[name='fileName']"),i=_MTS_JQUERY.trim(0<o.length?o.val():""),a=_MTS_JQUERY.trim(e.find("input[name='slugline']").val()),n=_MTS_JQUERY.trim(e.find("textarea[name='caption']").val()),s=_MTS_JQUERY.trim(e.find("input[name='credit']").val()),r=_MTS_JQUERY.trim(e.find("input[name='link']").val()),l=_MTS_JQUERY.trim(e.find("textarea[name='desc']").val()),_=_MTS_JQUERY.trim(e.find("input[name='photoStart']").val().replace(/\//g,"-")),d=_MTS_JQUERY.trim(e.find("input[name='photoEnd']").val().replace(/\//g,"-")),p=_MTS_JQUERY.trim(e.find("select[name='toningProfile']").val()),h=_MTS_JQUERY.trim(e.find("select[name='presentation']").val()),e=e.find("input[id='hiddenImage']").is(":checked");(_photoList[t].slugline!=a||_photoList[t].caption!=n||_photoList[t].credit!=s||_photoList[t].desc!=l||_photoList[t].start.replace(/\//g,"-")!=_||_photoList[t].end.replace(/\//g,"-")!=d||_photoList[t].toningId!=p||_photoList[t].presentation!=h||_photoList[t].hide!=e||_photoList[t].link!=r||0<o.length&&i!=_photoList[t].filename)&&(_photoList[t].changesmade=!0),_photoList[t].slugline=a,_photoList[t].caption=n,_photoList[t].credit=s,_photoList[t].desc=l,_photoList[t].start=_,_photoList[t].end=d,_photoList[t].toningId=p,_photoList[t].presentation=h,_photoList[t].hide=e,_photoList[t].link=r,_photoList[t].filename=i}function checkImageChanges(){for(var e,t=0;t<_photoList.length;t++)!_photoList[t].removed&&(-1<_photoList[t].id||!_photoList[t].isTooBig&&(!_photoList[t].file||isAllowedType(_photoList[t].file.name))&&_photoList[t].file&&isImageType(_photoList[t].file.name))&&(e=_MTS_JQUERY("#block_"+t),_photoList[t],checkFormDataChanges(e,t),_photoList[t].changesmade&&_changedCount++)}function checkOkSave(e){return!(-1!=e.id&&"Image"==_uploadType&&!e.changesmade)}function savePhotos(e){0==_changedCount&&("Image"===_uploadType?checkImageChanges():_changedCount=_photoList.length);for(var t=0;t<_photoList.length;t++)if(!_photoList[t].removed&&(-1<_photoList[t].id||!_photoList[t].isTooBig&&(!_photoList[t].file||isAllowedType(_photoList[t].file.name))&&_photoList[t].file&&isImageType(_photoList[t].file.name)||"Advertisement"===_uploadType)&&_photoList[t].isPendingUpload&&checkOkSave(_photoList[t]))return void sendPhoto(t);_uploaderChangesMade=_uploading=!1,_photoList=_MTS_JQUERY.map(_photoList,function(e){return e.isPendingUpload=!0,e.alreadyUploaded=!0,e.changesmade=!1,e}),_changedCount=0,checkForPhotos(),disableThumbnailCrop()}function sendPhoto(t){if(null==_photoList[t])return _uploading=!1,checkForPhotos(),!1;var e=_photoList[t],o=-1<e.id?"update":"upload",i=(_MTS_JQUERY("#block_"+t),new FormData);i.append("uploadType",_uploadType),i.append("imgId",e.id),i.append("mode",o);var a="/api/uploadImage.aspx";switch(_imageVersionChange=!1,_uploadType){case"Image":i.append("dims",JSON.stringify(e.dims)),i.append("cap",htmlEncode(e.caption)),i.append("cre",e.credit),i.append("start",e.start),i.append("end",e.end),i.append("toning",e.toningId),i.append("hide",e.hide),i.append("presentation",e.presentation),i.append("desc",htmlEncode(e.desc)),i.append("link",e.link),i.append("fileName",e.filename),i.append("slugline",e.slugline),"update"==o&&(_imageVersionChange=!0);break;case"Advertisement":var n=JSON.stringify(e.runDates);i.append("accountNumber",e.accountNumber),i.append("title",e.title),i.append("adNumber",e.adNumber),i.append("width",e.width),i.append("height",e.height),i.append("notes",e.notes),i.append("url",e.url),i.append("colorSetting",e.colorSetting),i.append("rpl",e.requestedPageLocation),i.append("runDates",n),i.append("hasPlaceholder",e.HasPlaceholder);break;case"Author":i.append("authorId",_authorId)}var s=_MTS_JQUERY.map(e.tags,function(e){if(!e.removed)return e.id+"_"+e.type}),s=JSON.stringify(s);if(i.append("tags",s),"Advertisement"==_uploadType){var r="";if(0==$.trim(e.title).length?r="a title":0==$.trim(e.width.toString()).length?r="a width":0==$.trim(e.height.toString()).length?r="a height":0==e.runDates.length&&(r="at least one run date"),0==r.length){for(var l=!1,_=e.runDates.map(function(e){return null!=e.Publication&&0<e.Publication.length||null!=e.PublicationId&&0<e.PublicationId}),d=_.length-1;0<=d&&0!=(l=_[d]);d--);l||(r="a publication for each run date")}if(0<r.length)return alert("Please provide "+r),void(a="")}e.isPendingUpload=!1,_uploading=!0,checkForPhotos();var p,h=new XMLHttpRequest;h.onreadystatechange=function(e){stateChange_PhotoUpload(h,e,t)},"Image"==_uploadType&&(r=_MTS_JQUERY("#albumSelect").val(),p="",$.each($(".phusites input:checked"),function(e,t){p+=(0===p.length?"":",")+t.id.split("_")[1]}),i.append("aId",r),i.append("sites",p),i.append("alb",void 0!==e.album&&0<e.album.length?e.album:""),_rankImgs&&(i.append("rank",e.rank),i.append("lId",_currentAlbumId),i.append("manager",$("#manager").val()))),h.open("POST",a,!0),"upload"!=o&&!e.file||(h.setRequestHeader("X-FILE-NAME",e.file?encodeURIComponent(e.file.name):""),i.append("image",e.file)),h.send(i)}function stateChange_PhotoUpload(e,t,o){var i,a;4==t.target.readyState&&(_uploadedCount++,i=_MTS_JQUERY("#block_"+o+" .phImgCtr"),200==t.target.status||304==t.target.status?"true"===(e=JSON.parse(e.response)).ok?(i.prepend("<div class='imgCheck'></div>"),_MTS_JQUERY(".imgCheck").addClass("imgCheckShow"),_photoList[o].id=e.imgId,"Advertisement"==_uploadType&&(_photoList[o].runDates=e.runDates,_photoList[o]==_selectedAd&&(_selectedRunDate=null,_MTS_JQUERY("#insertionWrapper").hide(),_MTS_JQUERY("#dateWrapper").empty(),_selectedAd.runDates.forEach(function(e,t){var o="<div id='date_"+t+"' class='runDate'>"+_MTS_JQUERY("#dateTemplate").html()+"</div>";_MTS_JQUERY("#dateWrapper").append(o);e=new Date(e.RunDate);isNaN(e)||(e=e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()),_MTS_JQUERY("#date_"+t).find(".dateContent").html(e)}))),"function"==typeof _MTS_UPLOAD_CALLBACK&&(_MTS_UPLOAD_CALLBACK(_photoList[o].id,_photoList[o].alreadyUploaded),_photoList[o].alreadyUploaded=!0)):(i.prepend("<div class='imgErr'></div>"),_MTS_JQUERY(".imgErr").addClass("imgCheckShow"),alert((-1<_photoList[o].id?"Update":"Upload")+" Failed!")):(i.prepend("<div class='imgErr'></div>"),_MTS_JQUERY(".imgErr").addClass("imgCheckShow"),alert((-1<_photoList[o].id?"Update":"Upload")+" Failed!\nError "+t.target.status+": "+t.target.statusText)),a=getUploadProgress(),_MTS_JQUERY(".progressBar").animate({width:a+"%"},"linear",function(){if(100==a){var e=_MTS_JQUERY(".photoHolder .phImg");e.removeClass("flip rotate90 rotate180 rotate270 rotate90flip rotate180flip rotate270flip");for(var t=e.length-1;0<=t;t--){var o=_MTS_JQUERY(e[t]).parents(".phBlockCtr")[0].id.split("_")[1];"Advertisement"!==_uploadType&&(e[t].src=getImageLink(_photoList[o],2))}alert("Save & Update Complete"+(0<_MTS_JQUERY(".imgErr").length?"d with errors":"")),_MTS_JQUERY(".progressBar").width(0)}_uploading&&savePhotos()}))}function ToggleNewUploadTag(){_beforeUpload=!1,_MTS_JQUERY(".uploadTagWrapper:first").addClass("showTagWrapper"),_MTS_JQUERY(".uploadTagWrapper .search_widget .filterRow").removeClass("filterRowOpen");var e=_MTS_JQUERY(".findTeamFormContainer:visible").height()+_MTS_JQUERY(".formFilterContainer:visible").height()+_MTS_JQUERY(".morePagesContainer:visible").outerHeight();_MTS_JQUERY(".searchResults").css({height:_MTS_JQUERY(".uploadTagWrapper").outerHeight()-e-50+"px"}),"Image"==_uploadType?_MTS_sportsEnabled||_MTS_JQUERY(".filterColumn:not('#CategoryFilter,#SubcategoryFilter')").addClass("filterDisabled"):_MTS_JQUERY(".filterColumn:not('#PublicationFilter')").addClass("filterDisabled"),MTS_handleEz(0,highlightTags,_MTS_JQUERY(".showTagWrapper").find("#searchPhrase"))}function handleTagClick(e,t,o,i){("Image"==_uploadType?0<_MTS_JQUERY(".search_widget:visible").parents(".uploadTagWrapper.showTagWrapper").length?selectUploadTag:selectTag:selectAdTag)(e,t,o,i),_MTS_JQUERY(".result[href$='"+o+",\\'"+i+"\\')']").addClass("selectedTag")}function selectUploadTag(e,t,o,a){if(-1<_tagItemId&&null!=_photoList[_tagItemId])addTag(_photoList[_tagItemId].tags,o,a,t),_photoList[_tagItemId].changesmade=!0;else if(_tagItemId<0){var n=_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck:checked").parents(".phBlockCtr");if(0<n.length)for(i=0;i<n.length;i++){var s=n[i].id.split("_")[1];addTag(_photoList[s].tags,o,a,t),_photoList[s].changesmade=!0}else for(i=0;i<_photoList.length;i++)addTag(_photoList[i].tags,o,a,t),_photoList[i].changesmade=!0}updateTagList()}function addTag(e,t,o,i){for(var a=!1,n=0;n<e.length;n++){var s=e[n];if(s.id==t&&s.type==o){s.removed&&(_uploaderChangesMade=!0),s.removed=!(a=!0);break}}a||(e.push(new mtsTag(t,o,i)),_uploaderChangesMade=!0)}function highlightTags(){var e;"Advertisement"===_uploadType?!_selectedRunDate||null!=(e=findPublicationByPubCode(_selectedRunDate.Publication,_selectedRunDate.PublicationId))&&_MTS_JQUERY(".result[href$='"+e.Id+",\\'Publication\\')']").addClass("selectedTag"):_MTS_JQUERY(".uploadTagContainer:visible .tagAll").each(function(){var e=_MTS_JQUERY(this).find("input[name='id']").val(),t=_MTS_JQUERY(this).find("input[name='type']").val();_MTS_JQUERY(".result[href$='"+e+",\\'"+t+"\\')']").addClass("selectedTag")})}function selectAdTag(e,t,o,i){_MTS_JQUERY(".selectedTag").removeClass("selectedTag");for(var a="",n=_pubs.length-1;0<=n;n--)if(_pubs[n].Name==t){a=_pubs[n].PubCode;break}_selectedRunDate.Publication=a,_selectedRunDate.PublicationId=o,_MTS_JQUERY("input[name='publication']").val(t)}function updateTagList(){var e="";if(-1<_tagItemId&&null!=_photoList[_tagItemId]){for(var t=0;t<_photoList[_tagItemId].tags.length;t++)_photoList[_tagItemId].tags[t].removed||(e+=getTagHtml(_photoList[_tagItemId].tags[t]));0==e.length&&(e="No tags selected"),_MTS_JQUERY(".tagList").html(e)}var o=[],i=[];0<(i=_MTS_JQUERY.map(_photoList,function(e){return e.removed?null:e})).length&&(o=i[0].tags),_MTS_JQUERY("#allTags").html(getCommonTagHtml(o,i)),0<(i=_MTS_JQUERY(".photoHolder").find("input[type='checkbox'].phCheck:checked").parents(".phBlockCtr").map(function(){var e=this.id.split("_")[1];return void 0===_photoList[e]||_photoList[e].removed?null:_photoList[e]})).length&&(o=i[0].tags),_MTS_JQUERY("#selectedTags").html(getCommonTagHtml(o,i))}function isAllowedType(e){for(var t=e.substring(e.lastIndexOf(".")+1),o=0;o<_badExt.length;o++)if(_badExt[o]==t.toLowerCase())return!1;return!0}function isImageType(e){return isFileType(e,_imageExtensions)}function isFileType(e,t){for(var o=e.substring(e.lastIndexOf(".")+1),i=0;i<t.length;i++)if(t[i]==o.toLowerCase())return!0;return!1}function getUploadProgress(){_MTS_JQUERY.map(_photoList,function(e){if(!e.removed&&(-1<e.id||!e.isTooBig&&(!e.file||isAllowedType(e.file.name)&&(isImageType(e.file.name)||"Advertisement"===_uploadType))))return e});return _uploadedCount/_changedCount*100}function mtsPhotoInfo(e,t,o,i,a,n){this.file=e,this.isImage=t,this.isTooBig=o,this.isPendingThumb=i,this.isPendingUpload=a,this.album=n;for(var s="",r=_MTS_JQUERY(".phImgCtr img"),l=_MTS_focusImgs.length-1;0<=l;l--)for(var _=r.length-1;0<=_;_--)if(_MTS_focusImgs[l][0]==r[_]){s=_MTS_focusDims[l];break}this.dims=s,this.drawn=!1,this.removed=!1,this.alreadyUploaded=!1,this.id=-1,this.container=-1,this.inCloud=!1,this.src="",this.slugline="",this.caption="",this.credit="",this.filename="",this.link="",this.desc="",this.start="",this.end="",this.rank=0,this.date=new Date,this.uploaderId=_MTS_userId,this.teamId=0,this.portalId=_MTS_PORTALID,this.sites=[],this.toningId=0,this.presentation=0,this.changesmade=!1,this.hide=!1,this.tags=[]}function adInfo(e,t,o,i,a){this.file=e,this.isImage=t,this.isTooBig=o,this.isPendingThumb=i,this.isPendingUpload=a,this.drawn=!1,this.removed=!1,this.alreadyUploaded=!1,this.id=-1,this.src="",this.accountNumber="",e?(a=e.name.lastIndexOf("."),this.title=0<a?e.name.substring(0,a):e.name):this.title="",this.title=e?e.name.substring(0,e.name.lastIndexOf(".")):"",this.adNumber="",this.edition="",this.section="",this.page="",this.zone="",this.width="",this.height="",this.horizontalPosition="",this.verticalPosition="",this.notes="",this.url="",this.colorSetting=_MTS_JQUERY("input[name='colorSetting']:checked").val(),this.requestedPageLocation="",this.runDates=[],this.tags=[]}function publicationInfo(e,t,o){this.pubId=e,this.pubName=t,this.pageReq=o}function mtsTag(e,t,o){this.id=e,this.type=t,this.title=o,this.removed=!1}function OpenUpload(e,t,o,i,a,n,s,r){if(!isNaN(e)&&"string"==typeof t&&0<t.length?(("PhotoAlbum"===t?_MTS_JQUERY("#albumSelect").find("option[value='"+e+"']"):_MTS_JQUERY("#albumSelect").find("option:first")).prop("selected",!0),o&&getExistingPhotos(e,t,s)):void 0!==r&&o&&getExistingPhotos(null,null,null,r),void 0!==i&&void 0!==a&&void 0!==n)for(var l=0;l<i.length;l++)addTag(_defaultTags,i[l],a[l],n[l]);_uploaderChangesMade=!1,_MTS_JQUERY("#albumSelect").trigger("chosen:updated"),_MTS_JQUERY(".photo_upload_widget").addClass("animateLeft"),_MTS_JQUERY("body").addClass("overflow"),_MTS_JQUERY(".photo_upload_widget").css("height",_MTS_JQUERY(window).height()-_MTS_JQUERY("#mts_unlockstory:visible").height()+"px"),_MTS_JQUERY(".photo_upload_widget .updateButtonCtr").css({bottom:_MTS_JQUERY("#mts_unlockstory:visible").height()+"px"}),resizePhotoUpload()}function CloseUpload(){if(_uploaderChangesMade&&!confirm("You have unsaved changes - would you like to continue anyways?"))return!1;"function"==typeof _MTS_CloseUploadFunc&&_MTS_CloseUploadFunc(),_MTS_JQUERY(".photo_upload_widget").removeClass("animateLeft"),_MTS_JQUERY("body").removeClass("overflow"),_MTS_JQUERY(".imgCheck, .imgErr").remove(),_MTS_JQUERY(".progressBar").width("0"),_MTS_JQUERY(".updateButtonCtr, .progress").css("position","absolute"),_MTS_JQUERY(".previewCtr").hide(),_MTS_JQUERY(".tagViewerCtr").removeClass("tagViewerOpen"),_MTS_JQUERY("#selectedTags").hide(),_MTS_JQUERY("#allTags").show(),_MTS_JQUERY(".showTagWrapper").removeClass("showTagWrapper"),hideImgArea(),disableThumbnailCrop(),_uploderChangesMade=!1,_MTS_previewImg=null;for(var e=_MTS_JQUERY(".photoHolder").find(".phBlockCtr").map(function(){return this.id.split("_")[1]}),t=0;t<e.length;t++)removePhotoUpload(e[t],!1);_photoList.length=0}function removeMultiPhotoUpload(e,t){if("function"!=typeof _MTS_RemoveMultiPhotoPrompt||_MTS_RemoveMultiPhotoPrompt(t))for(var o=0;o<e.length;o++)removePhotoUpload(e[o],!1)}function removePhotoUpload(e,t){var o=_photoList[e].id;(t=void 0===t?!0:t)&&"function"==typeof _MTS_RemovePhotoPrompt&&!_MTS_RemovePhotoPrompt()||("function"!=typeof _MTS_RemovePhotoFunc||o<=0?removePhotoUploadCallback(e):_MTS_RemovePhotoFunc(o+("undefined"!=typeof _currentAlbumId?"_"+_currentAlbumId:""),e,removePhotoUploadCallback))}function removePhotoUploadCallback(e){_photoList[e].removed=!0,_MTS_JQUERY("#block_"+e).remove(),checkForPhotos(),"Image"==_uploadType&&(checkForSelected(),updateTagList())}function decodeURISafe(e,t){var o,i,a,n=new String,s=0;for(void 0===t&&(t=0),i=(o=e.split(/(%(?:d0|d1)%.{2})/)).length;s<i;s++){try{a=decodeURI(o[s])}catch(e){a=t?o[s].replace(/%(?!\d+)/g,"%25"):o[s]}n+=a}return n}function getExistingPhotos(e,t,o,i){var a=[];a.push({name:"id",value:e}),a.push({name:"type",value:t}),a.push({name:"stock",value:o}),a.push({name:"imageIds",value:i}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON("/api/widget/getExistingPhotosForUploader.aspx",a,function(e){e=_MTS_JQUERY.decodeJSONObj(e);for(var t,o=0;o<e.images.length;o++){var i=new mtsPhotoInfo(null,!0,!1,!0,!0);i.id=e.images[o].id,i.container=e.images[o].container,i.inCloud=e.images[o].inCloud,i.src=e.images[o].src,i.caption=e.images[o].caption,i.credit=e.images[o].credit,i.filename=e.images[o].filename,i.slugline=e.images[o].slug,i.link=e.images[o].link,i.desc=e.images[o].desc,i.start=e.images[o].start,i.end=e.images[o].end,i.rank=e.images[o].rank,i.date=new Date(e.images[o].date),i.uploaderId=e.images[o].uploaderId,i.teamId=e.images[o].teamId,i.portalId=e.images[o].parentPortalId,i.sites=e.images[o].sites,i.toningId=e.images[o].toningId,i.presentation=e.images[o].presentation,i.pendingTone=e.images[o].pendingTone,i.webActiveVersion=e.images[o].webActiveVersion,i.prevVersions=e.images[o].prevVersions,i.hide=e.images[o].hide;for(var a=_MTS_JQUERY(".chkCtr input"),n=a.length-1;0<=n;n--){var s=_MTS_JQUERY(a[n]),r=s.attr("id").split("_")[1],l=!1;if(r==i.portalId)l=!0;else for(var _=i.sites.length-1;0<=_;_--)if(r==i.sites[_].id){l=!0;break}l?(s.attr("disabled","disabled"),s.attr("checked","checked")):(s.removeAttr("disabled"),s.removeAttr("checked"))}for(n=0;n<e.images[o].tags.length;n++)i.tags.push(new mtsTag(e.images[o].tags[n].linkId,e.images[o].tags[n].linkType,e.images[o].tags[n].title));_photoList.push(i)}startPhotoUpload(),CheckPhotosForRank(),0<$($(".phImg")[0]).parent().length&&(0<(t=$(".photoCtr > .phBlockCtr")).length&&(t.each(function(e){var t=$("<div class='imageReplace mts_cc_button'>Replace<input title='File Upload' class='replace' type='file' /></div>");_MTS_JQUERY(this).find(".phBlockInfo").prepend(t)}),$(document).on("change",".replace",function(){var e=$(".replace").index(this);_photoList[e].file=this.files[0],_photoList[e].changesmade=!0,_MTS_JQUERY(this).parents(".phBlockCtr").find("input[type=checkbox].phCheck").prop("checked",!0).change()})))})}function CheckPhotosForRank(){0==_MTS_JQUERY.map(_photoList,function(e,t){return 0<e.rank?e:null}).length?_MTS_JQUERY("#wipeRank").addClass("noSelect"):_MTS_JQUERY("#wipeRank").removeClass("noSelect")}function SortPhotosByRank(){var e=_MTS_JQUERY(".photoCtr li").sort(function(e,t){e=e.id.split("_")[1],t=t.id.split("_")[1],e=_photoList[e],t=_photoList[t];return 0<e.rank&&0<t.rank?e.rank>t.rank?1:e.rank<t.rank?-1:0:0==e.rank&&0==t.rank?e.date.getTime()<t.date.getTime()?1:e.date.getTime()>t.date.getTime()?-1:0:0<e.rank&&t.rank<=0?-1:e.rank<=0&&0<t.rank?1:0});_MTS_JQUERY(".photoCtr").append(e),CheckPhotosForRank()}_MTS_widgetsReady?WireUpload():_MTS_JQUERY(document).one("widgetsloaded",WireUpload);
﻿eval(function(e,a,t,r){for(r=function(e){return(e<62?"":r(parseInt(e/62)))+(35<(e%=62)?String.fromCharCode(e+29):e.toString(36))};a--;)t[a]&&(e=e.replace(new RegExp("\\b"+r(a)+"\\b","g"),t[a]));return e}('(m($){18 W=2v.4T,D=2v.4S,F=2v.4R,u=2v.4Q;m V(){C $("<4P/>")};$.N=m(T,c){18 O=$(T),1F,A=V(),1k=V(),I=V().r(V()).r(V()).r(V()),B=V().r(V()).r(V()).r(V()),E=$([]),1K,G,l,17={v:0,l:0},Q,M,1l,1g={v:0,l:0},12=0,1J="1H",2k,2j,1t,1s,S,1B,1A,2o,2n,14,1Q,a,b,j,g,f={a:0,b:0,j:0,g:0,H:0,L:0},2u=R.4O,1M=4N.4M,$p,d,i,o,w,h,2p;m 1n(x){C x+17.v-1g.v};m 1m(y){C y+17.l-1g.l};m 1b(x){C x-17.v+1g.v};m 1a(y){C y-17.l+1g.l};m 1z(3J){C 3J.4L-1g.v};m 1y(3I){C 3I.4K-1g.l};m 13(32){18 1i=32||1t,1h=32||1s;C{a:u(f.a*1i),b:u(f.b*1h),j:u(f.j*1i),g:u(f.g*1h),H:u(f.j*1i)-u(f.a*1i),L:u(f.g*1h)-u(f.b*1h)}};m 23(a,b,j,g,31){18 1i=31||1t,1h=31||1s;f={a:u(a/1i||0),b:u(b/1h||0),j:u(j/1i||0),g:u(g/1h||0)};f.H=f.j-f.a;f.L=f.g-f.b};m 1f(){9(!1F||!O.H()){C}17={v:u(O.2t().v),l:u(O.2t().l)};Q=O.2Y();M=O.3H();17.l+=(O.30()-M)>>1;17.v+=(O.2q()-Q)>>1;1B=u(c.4J/1t)||0;1A=u(c.4I/1s)||0;2o=u(F(c.4H/1t||1<<24,Q));2n=u(F(c.4G/1s||1<<24,M));9($().4F=="1.3.2"&&1J=="21"&&!2u["4E"]){17.l+=D(R.1q.2r,2u.2r);17.v+=D(R.1q.2s,2u.2s)}1g=/1H|4D/.1c(1l.q("1p"))?{v:u(1l.2t().v)-1l.2s(),l:u(1l.2t().l)-1l.2r()}:1J=="21"?{v:$(R).2s(),l:$(R).2r()}:{v:0,l:0};G=1n(0);l=1m(0);9(f.j>Q||f.g>M){1U()}};m 1V(3F){9(!1Q){C}A.q({v:1n(f.a),l:1m(f.b)}).r(1k).H(w=f.H).L(h=f.L);1k.r(I).r(E).q({v:0,l:0});I.H(D(w-I.2q()+I.2Y(),0)).L(D(h-I.30()+I.3H(),0));$(B[0]).q({v:G,l:l,H:f.a,L:M});$(B[1]).q({v:G+f.a,l:l,H:w,L:f.b});$(B[2]).q({v:G+f.j,l:l,H:Q-f.j,L:M});$(B[3]).q({v:G+f.a,l:l+f.g,H:w,L:M-f.g});w-=E.2q();h-=E.30();2O(E.3f){15 8:$(E[4]).q({v:w>>1});$(E[5]).q({v:w,l:h>>1});$(E[6]).q({v:w>>1,l:h});$(E[7]).q({l:h>>1});15 4:E.3G(1,3).q({v:w});E.3G(2,4).q({l:h})}9(3F!==Y){9($.N.2Z!=2R){$(R).U($.N.2z,$.N.2Z)}9(c.1T){$(R)[$.N.2z]($.N.2Z=2R)}}9(1j&&I.2q()-I.2Y()==2){I.q("3E",0);3x(m(){I.q("3E","4C")},0)}};m 22(3D){1f();1V(3D);a=1n(f.a);b=1m(f.b);j=1n(f.j);g=1m(f.g)};m 27(2X,2w){c.1P?2X.4B(c.1P,2w):2X.1r()};m 1d(2W){18 x=1b(1z(2W))-f.a,y=1a(1y(2W))-f.b;9(!2p){1f();2p=11;A.1G("4A",m(){2p=Y})}S="";9(c.2D){9(y<=c.1W){S="n"}X{9(y>=f.L-c.1W){S="s"}}9(x<=c.1W){S+="w"}X{9(x>=f.H-c.1W){S+="e"}}}A.q("2V",S?S+"-19":c.26?"4z":"");9(1K){1K.4y()}};m 2S(4x){$("1q").q("2V","");9(c.4w||f.H*f.L==0){27(A.r(B),m(){$(J).1r()})}$(R).U("P",2l);A.P(1d);c.2f(T,13())};m 2C(1X){9(1X.3z!=1){C Y}1f();9(S){$("1q").q("2V",S+"-19");a=1n(f[/w/.1c(S)?"j":"a"]);b=1m(f[/n/.1c(S)?"g":"b"]);$(R).P(2l).1G("1x",2S);A.U("P",1d)}X{9(c.26){2k=G+f.a-1z(1X);2j=l+f.b-1y(1X);A.U("P",1d);$(R).P(2T).1G("1x",m(){c.2f(T,13());$(R).U("P",2T);A.P(1d)})}X{O.1O(1X)}}C Y};m 1w(3C){9(14){9(3C){j=D(G,F(G+Q,a+W(g-b)*14*(j>a||-1)));g=u(D(l,F(l+M,b+W(j-a)/14*(g>b||-1))));j=u(j)}X{g=D(l,F(l+M,b+W(j-a)/14*(g>b||-1)));j=u(D(G,F(G+Q,a+W(g-b)*14*(j>a||-1))));g=u(g)}}};m 1U(){a=F(a,G+Q);b=F(b,l+M);9(W(j-a)<1B){j=a-1B*(j<a||-1);9(j<G){a=G+1B}X{9(j>G+Q){a=G+Q-1B}}}9(W(g-b)<1A){g=b-1A*(g<b||-1);9(g<l){b=l+1A}X{9(g>l+M){b=l+M-1A}}}j=D(G,F(j,G+Q));g=D(l,F(g,l+M));1w(W(j-a)<W(g-b)*14);9(W(j-a)>2o){j=a-2o*(j<a||-1);1w()}9(W(g-b)>2n){g=b-2n*(g<b||-1);1w(11)}f={a:1b(F(a,j)),j:1b(D(a,j)),b:1a(F(b,g)),g:1a(D(b,g)),H:W(j-a),L:W(g-b)};1V();c.2g(T,13())};m 2l(2U){j=/w|e|^$/.1c(S)||14?1z(2U):1n(f.j);g=/n|s|^$/.1c(S)||14?1y(2U):1m(f.g);1U();C Y};m 1v(3B,3A){j=(a=3B)+f.H;g=(b=3A)+f.L;$.2c(f,{a:1b(a),b:1a(b),j:1b(j),g:1a(g)});1V();c.2g(T,13())};m 2T(2m){a=D(G,F(2k+1z(2m),G+Q-f.H));b=D(l,F(2j+1y(2m),l+M-f.L));1v(a,b);2m.4v();C Y};m 2h(){$(R).U("P",2h);1f();j=a;g=b;1U();S="";9(!B.2y(":4u")){A.r(B).1r().2E(c.1P||0)}1Q=11;$(R).U("1x",1N).P(2l).1G("1x",2S);A.U("P",1d);c.3y(T,13())};m 1N(){$(R).U("P",2h).U("1x",1N);27(A.r(B));23(1b(a),1a(b),1b(a),1a(b));9(!(J 4t $.N)){c.2g(T,13());c.2f(T,13())}};m 2A(2i){9(2i.3z!=1||B.2y(":4s")){C Y}1f();2k=a=1z(2i);2j=b=1y(2i);$(R).P(2h).1x(1N);C Y};m 2B(){22(Y)};m 2x(){1F=11;25(c=$.2c({1S:"4r",26:11,20:"1q",2D:11,1W:10,3w:m(){},3y:m(){},2g:m(){},2f:m(){}},c));A.r(B).q({3b:""});9(c.2F){1Q=11;1f();1V();A.r(B).1r().2E(c.1P||0)}3x(m(){c.3w(T,13())},0)};18 2R=m(16){18 k=c.1T,d,t,2N=16.4q;d=!1L(k.2P)&&(16.2e||16.3t.2e)?k.2P:!1L(k.2a)&&16.3u?k.2a:!1L(k.2b)&&16.3v?k.2b:!1L(k.2Q)?k.2Q:10;9(k.2Q=="19"||(k.2b=="19"&&16.3v)||(k.2a=="19"&&16.3u)||(k.2P=="19"&&(16.2e||16.3t.2e))){2O(2N){15 37:d=-d;15 39:t=D(a,j);a=F(a,j);j=D(t+d,a);1w();1u;15 38:d=-d;15 40:t=D(b,g);b=F(b,g);g=D(t+d,b);1w(11);1u;3s:C}1U()}X{a=F(a,j);b=F(b,g);2O(2N){15 37:1v(D(a-d,G),b);1u;15 38:1v(a,D(b-d,l));1u;15 39:1v(a+F(d,Q-1b(j)),b);1u;15 40:1v(a,b+F(d,M-1a(g)));1u;3s:C}}C Y};m 1R(3r,2M){3p(18 2d 4p 2M){9(c[2d]!==1Y){3r.q(2M[2d],c[2d])}}};m 25(K){9(K.20){(1l=$(K.20)).2G(A.r(B))}$.2c(c,K);1f();9(K.2L!=3q){E.1o();E=$([]);i=K.2L?K.2L=="4o"?4:8:0;3g(i--){E=E.r(V())}E.29(c.1S+"-4n").q({1p:"1H",36:0,1I:12+1||1});9(!4m(E.q("H"))>=0){E.H(5).L(5)}9(o=c.2K){E.q({2K:o,2H:"3m"})}1R(E,{3n:"2J-28",3l:"2I-28",3o:"1e"})}1t=c.4l/Q||1;1s=c.4k/M||1;9(K.a!=3q){23(K.a,K.b,K.j,K.g);K.2F=!K.1r}9(K.1T){c.1T=$.2c({2b:1,2a:"19"},K.1T)}B.29(c.1S+"-4j");1k.29(c.1S+"-4i");3p(i=0;i++<4;){$(I[i-1]).29(c.1S+"-2J"+i)}1R(1k,{4h:"2I-28",4g:"1e"});1R(I,{3o:"1e",2K:"2J-H"});1R(B,{4f:"2I-28",4e:"1e"});9(o=c.3n){$(I[0]).q({2H:"3m",3k:o})}9(o=c.3l){$(I[1]).q({2H:"4d",3k:o})}A.2G(1k.r(I).r(1K)).2G(E);9(1j){9(o=(B.q("3j")||"").3i(/1e=(\\d+)/)){B.q("1e",o[1]/1Z)}9(o=(I.q("3j")||"").3i(/1e=(\\d+)/)){I.q("1e",o[1]/1Z)}}9(K.1r){27(A.r(B))}X{9(K.2F&&1F){1Q=11;A.r(B).2E(c.1P||0);22()}}14=(d=(c.4c||"").4b(/:/))[0]/d[1];O.r(B).U("1O",2A);9(c.1E||c.1D===Y){A.U("P",1d).U("1O",2C);$(3h).U("19",2B)}X{9(c.1D||c.1E===Y){9(c.2D||c.26){A.P(1d).1O(2C)}$(3h).19(2B)}9(!c.4a){O.r(B).1O(2A)}}c.1D=c.1E=1Y};J.1o=m(){25({1E:11});A.r(B).1o()};J.49=m(){C c};J.33=25;J.48=13;J.47=23;J.46=1N;J.45=22;18 1j=(/44 ([\\w.]+)/i.43(1M)||[])[1],3c=/42/i.1c(1M),3d=/41/i.1c(1M)&&!/3Z/i.1c(1M);$p=O;3g($p.3f){12=D(12,!1L($p.q("z-3e"))?$p.q("z-3e"):12);9($p.q("1p")=="21"){1J="21"}$p=$p.20(":3Y(1q)")}12=c.1I||12;9(1j){O.3X("3W","3V")}$.N.2z=1j||3d?"3U":"3T";9(3c){1K=V().q({H:"1Z%",L:"1Z%",1p:"1H",1I:12+2||2})}A.r(B).q({3b:"3a",1p:1J,3S:"3a",1I:12||"0"});A.q({1I:12+2||2});1k.r(I).q({1p:"1H",36:0});T.35||T.3R=="35"||!O.2y("3Q")?2x():O.1G("3P",2x);9(!1F&&1j&&1j>=7){T.34=T.34}};$.2w.N=m(Z){Z=Z||{};J.3O(m(){9($(J).1C("N")){9(Z.1o){$(J).1C("N").1o();$(J).3N("N")}X{$(J).1C("N").33(Z)}}X{9(!Z.1o){9(Z.1D===1Y&&Z.1E===1Y){Z.1D=11}$(J).1C("N",3M $.N(J,Z))}}});9(Z.3L){C $(J).1C("N")}C J}})(3K);',304,"|||||||||if|x1|y1|_7|||_23|y2|||x2||top|function||||css|add|||_4|left|||||_a|_d|return|_2|_e|_3|_10|width|_c|this|_55|height|_13|imgAreaSelect|_8|mousemove|_12|document|_1c|_6|unbind|_5|_1|else|false|_58||true|_16|_2c|_21|case|_50|_11|var|resize|_29|_28|test|_3a|opacity|_30|_15|sy|sx|_35|_b|_14|_27|_26|remove|position|body|hide|_1b|_1a|break|_45|_42|mouseup|evY|evX|_1e|_1d|data|enable|disable|_9|one|absolute|zIndex|_17|_f|isNaN|ua|_4a|mousedown|fadeSpeed|_22|_51|classPrefix|keys|_31|_32|resizeMargin|_40|undefined|100|parent|fixed|_36|_2e||_4f|movable|_38|color|addClass|ctrl|shift|extend|_54|altKey|onSelectEnd|onSelectChange|_49|_4c|_19|_18|_3e|_48|_20|_1f|_25|outerWidth|scrollTop|scrollLeft|offset|_24|Math|fn|_4e|is|keyPress|_4b|_4d|_3f|resizable|fadeIn|show|append|borderStyle|background|border|borderWidth|handles|_53|key|switch|alt|arrows|_34|_3c|_41|_44|cursor|_3b|_39|innerWidth|onKeyPress|outerHeight|_2f|_2d|setOptions|src|complete|fontSize||||hidden|visibility|_56|_57|index|length|while|window|match|filter|borderColor|borderColor2|solid|borderColor1|borderOpacity|for|null|_52|default|originalEvent|ctrlKey|shiftKey|onInit|setTimeout|onSelectStart|which|_47|_46|_43|_37|margin|_33|slice|innerHeight|_2b|_2a|jQuery|instance|new|removeData|each|load|img|readyState|overflow|keypress|keydown|on|unselectable|attr|not|chrome||webkit|opera|exec|msie|update|cancelSelection|setSelection|getSelection|getOptions|persistent|split|aspectRatio|dashed|outerOpacity|outerColor|selectionOpacity|selectionColor|selection|outer|imageHeight|imageWidth|parseInt|handle|corners|in|keyCode|imgareaselect|animated|instanceof|visible|preventDefault|autoHide|_3d|toggle|move|mouseout|fadeOut|auto|relative|getBoundingClientRect|jquery|maxHeight|maxWidth|minHeight|minWidth|pageY|pageX|userAgent|navigator|documentElement|div|round|min|max|abs".split("|")));
﻿function _MTS_miniCalenderWidgetInit(){"undefined"!=typeof MTS_CAL_INIT&&MTS_CAL_INIT()}_cal={obj:null,bg:null,monthNames:["","January","February","March","April","May","June","July","August","September","October","November","December"],doom_codes:[0,6,2,2,5,0,3,5,1,4,6,2,4],monthCount:[0,31,28,31,30,31,30,31,31,30,31,30,31],startContractYear:2008,startContractMonth:1,startContractDay:1,viewMonth:1,viewYear:2010,month:1,day:1,year:2010,wndTitle:"",monthRecycle:[],dayRecycle:[],yearRecycle:[],minYear:2008,maxYear:2011,posTop:0,posLeft:0,mode:"select",rangeStartDate:null,rangeEndDate:null,rangeStartDateSet:!1,rangeEndDateSet:!1,callbackFunc:function(){},closeCallbackFunc:function(){},initialize:function(){if(_cal.obj=document.getElementById("calBox"),null==_cal.obj){var a=document.createElement("div");if(a.id="calBox",a.className="mts_widget",document.body.appendChild(a),_cal.obj=document.getElementById("calBox"),null==_cal.obj)return}_MTS_JQUERY(window).resize(function(){_cal.centerMiniCal()}),_MTS_widgetsReady?_MTS_miniCalenderWidgetInit():_MTS_JQUERY(document).one("widgetsloaded",_MTS_miniCalenderWidgetInit)},clearRecycle:function(){_cal.monthRecycle=[],_cal.dayRecycle=[],_cal.yearRecycle=[]},setContract:function(a,e,t){var c=(new Date).getFullYear();c<a?(_cal.startContractYear=c,_cal.startContractDay=0,_cal.startContractMonth=0):(_cal.startContractDay=t,_cal.startContractMonth=e,_cal.startContractYear=a)},setSelection:function(a,e,t){_cal.month=parseInt(a,10),_cal.day=parseInt(e,10),_cal.year=parseInt(t,10),_cal.viewMonth=parseInt(a,10),_cal.viewYear=parseInt(t,10)},setRange:function(a,e){_cal.rangeStartDate=a,_cal.rangeEndDate=e,_cal.rangeStartDateSet=!0,_cal.rangeEndDateSet=!0;for(var t=new Date(_cal.rangeStartDate);t<=_cal.rangeEndDate;t.setDate(t.getDate()+1))_cal.addDate(t)},setCallback:function(a){_cal.callbackFunc=a},setCloseCallback:function(a){_cal.closeCallbackFunc=a},isLeap:function(a){return a%4==0&&(a%100!=0||a%400==0)},fireCallback:function(){_cal.callbackFunc(_cal.month,_cal.day,_cal.year)},fireCallbackRecycle:function(){_cal.callbackFunc(_cal.monthRecycle,_cal.dayRecycle,_cal.yearRecycle),_cal.hide(),_cal.clearRecycle()},fireCallbackRange:function(){_cal.rangeStartDateSet||_cal.rangeEndDateSet?(_cal.callbackFunc(_cal.rangeStartDate,_cal.rangeEndDate),_cal.hide()):_MTS_JQUERY(".noSelection").html("Select a date or range first")},fireCloseCallback:function(){"function"==typeof _cal.closeCallbackFunc&&_cal.closeCallbackFunc()},selDay:function(a){_cal.month=_cal.viewMonth,_cal.day=parseInt(a,10),_cal.year=_cal.viewYear,_cal.fireCallback(),_cal.hide()},selWeek:function(a,e){_cal.clearRecycle();e=new Date(_cal.viewYear,_cal.viewMonth-1,e);_cal.addDay(e.getDate());for(var t=new Date(e.getFullYear(),e.getMonth(),e.getDate()),c=new Date(e.getFullYear(),e.getMonth(),e.getDate());0!=t.getDay();)t.setDate(t.getDate()-1),_cal.viewMonth!=t.getMonth()+1&&(_cal.viewMonth=t.getMonth()+1),_cal.viewYear!=t.getFullYear()&&(_cal.viewYear=t.getFullYear()),_cal.addDay(t.getDate());for(_cal.viewMonth=e.getMonth()+1,_cal.viewYear=e.getFullYear();6!=c.getDay();)c.setDate(c.getDate()+1),_cal.viewMonth!=c.getMonth()+1&&(_cal.viewMonth=c.getMonth()+1),_cal.viewYear!=c.getFullYear()&&(_cal.viewYear=c.getFullYear()),_cal.addDay(c.getDate());_cal.viewMonth=e.getMonth()+1,_cal.viewYear=e.getFullYear(),a||(_cal.fireCallbackRecycle(),_cal.hide())},selRange:function(a){for(var e=_cal.dayRecycle.length;e--;)_cal.addDate(new Date(_cal.yearRecycle[e],_cal.monthRecycle[e]-1,_cal.dayRecycle[e]));a=new Date(_cal.viewYear,_cal.viewMonth-1,a);if(!_cal.rangeStartDateSet&&!_cal.rangeEndDateSet||_cal.rangeStartDateSet&&_cal.rangeEndDateSet||a<_cal.rangeStartDate?(_cal.rangeStartDate=a,_cal.rangeEndDate=a,_cal.rangeStartDateSet=!0,_cal.rangeEndDateSet=!1):_cal.rangeStartDateSet&&!_cal.rangeEndDateSet&&(_cal.rangeEndDate=a,_cal.rangeEndDateSet=!0),null!=_cal.rangeStartDate&&null!=_cal.rangeEndDate)for(var t=new Date(_cal.rangeStartDate);t<=_cal.rangeEndDate;t.setDate(t.getDate()+1))_cal.addDate(t)},selRangeEnd:function(a){for(var e=_cal.dayRecycle.length;e--;)_cal.addDate(new Date(_cal.yearRecycle[e],_cal.monthRecycle[e]-1,_cal.dayRecycle[e]));a=new Date(_cal.viewYear,_cal.viewMonth-1,a);if(_cal.rangeEndDate=a,_cal.rangeEndDateSet=!0,null!=_cal.rangeStartDate&&null!=_cal.rangeEndDate)for(var t=new Date(_cal.rangeStartDate);t<=_cal.rangeEndDate;t.setDate(t.getDate()+1))_cal.addDate(t)},addDay:function(a){var e=parseInt(a,10),a=_cal.inDayArray(e.toString());a<0?(_cal.monthRecycle.push(_cal.viewMonth.toString()),_cal.dayRecycle.push(e.toString()),_cal.yearRecycle.push(_cal.viewYear.toString()),_MTS_JQUERY("#"+_cal.viewMonth+"_"+_cal.viewYear+"_"+e).parent().removeClass("off").addClass("on")):(_cal.monthRecycle.splice(a,1),_cal.yearRecycle.splice(a,1),_cal.dayRecycle.splice(a,1),_MTS_JQUERY("#"+_cal.viewMonth+"_"+_cal.viewYear+"_"+e).parent().removeClass("on").addClass("off"))},addDate:function(a){var e=_cal.dateInArrays(a);e<0?(_cal.monthRecycle.push((a.getMonth()+1).toString()),_cal.dayRecycle.push(a.getDate().toString()),_cal.yearRecycle.push(a.getFullYear().toString()),_MTS_JQUERY("#"+(a.getMonth()+1)+"_"+a.getFullYear()+"_"+a.getDate()).parent().removeClass("off").addClass("on")):(_cal.monthRecycle.splice(e,1),_cal.yearRecycle.splice(e,1),_cal.dayRecycle.splice(e,1),_MTS_JQUERY("#"+(a.getMonth()+1)+"_"+a.getFullYear()+"_"+a.getDate()).parent().removeClass("on").addClass("off"))},fillDays:function(a){if(""!=a)for(var e=0;e<a.split(",").length;e++)_cal.dayRecycle.push(_MTS_JQUERY.trim(a.split(",")[e].split("/")[1])),_cal.monthRecycle.push(_MTS_JQUERY.trim(a.split(",")[e].split("/")[0])),_cal.yearRecycle.push(_MTS_JQUERY.trim(a.split(",")[e].split("/")[2]))},inDayArray:function(a){for(var e=0;e<_cal.dayRecycle.length;e++)if(_cal.dayRecycle[e]==a&&_cal.monthRecycle[e]==_cal.viewMonth&&_cal.yearRecycle[e]==_cal.viewYear)return e;return-1},dateInArrays:function(a){for(var e=0;e<_cal.dayRecycle.length;e++)if(_cal.dayRecycle[e]==a.getDate()&&_cal.monthRecycle[e]==a.getMonth()+1&&_cal.yearRecycle[e]==a.getFullYear())return e;return-1},adjYear:function(a){_cal.viewYear+=parseInt(a,10),_cal.viewYear<_cal.startContractYear?_cal.viewYear=_cal.startContractYear:_cal.viewYear>_cal.maxYear&&(_cal.viewYear=_cal.maxYear),_cal.render()},setYear:function(a){_cal.viewYear=parseInt(a.value,10),_cal.viewYear<_cal.startContractYear?_cal.viewYear=_cal.startContractYear:_cal.viewYear>_cal.maxYear&&(_cal.viewYear=_cal.maxYear),_cal.render()},adjMonth:function(a){var e=_cal.viewMonth+parseInt(a,10),a=_cal.viewYear;12<e?(e=1,a++):e<1&&(e=12,a--),_cal.viewMonth=e,_cal.viewYear=a,_cal.render()},setMonth:function(a){_cal.viewMonth=parseInt(a.value,10),_cal.render()},getMonthName:function(a){return this.monthNames[a]},getDayOfWeekName:function(a){var e="";switch(a){case 0:e="Sunday";break;case 1:e="Monday";break;case 2:e="Tuesday";break;case 3:e="Wednesday";break;case 4:e="Thursday";break;case 5:e="Friday";break;case 6:e="Saturday"}return e},calculateDayOfWeek:function(a,e,t){var c=Math.floor(t/100),l=0;switch((c-15)%4){case 0:l=3;break;case 1:l=2;break;case 2:l=0;break;case 3:l=5}c=(t-2e3)%12,c=(Math.floor((t-2e3)/12)+c+Math.floor(c/4)+l)%7;return _cal.isLeap(t)?_cal.doom_codes=new Array(0,4,1,0,4,9,6,11,8,5,10,7,12):_cal.doom_codes=new Array(0,3,0,0,4,9,6,11,8,5,10,7,12),(e-_cal.doom_codes[a]+c+14)%7},render:function(){_cal.viewYear<_cal.startContractYear?_cal.viewYear=_cal.startContractYear:_cal.viewYear>_cal.maxYear&&(_cal.viewYear=_cal.maxYear),_cal.viewYear==_cal.startContractYear&&_cal.viewMonth<_cal.startContractMonth&&(_cal.viewMonth=_cal.startContractMonth);var a=1,e=_cal.monthCount[_cal.viewMonth];_cal.isLeap(_cal.viewYear)&&2==_cal.viewMonth&&(e=29);var t=0,c=0,l=_cal.startContractYear,n=_cal.maxYear,r=_cal.calculateDayOfWeek(_cal.viewMonth,1,_cal.viewYear),i="<div class='listing group rounded'>";i+="<div class='miniCalHeading'><a title='Close Mini-Cal' class='closeMiniCal' class='closeMiniCal' href='javascript:_cal.close();'></a>"+_cal.wndTitle+"</div>",i+="<a title='Previous' class='prevArrows' href='javascript:_cal.adjYear(-1);'></a>",i+="<div class='selectDate'><select id='calyear' onchange='_cal.setYear(this);'>";for(var o=l;o<=n;o++)i+="<option value='"+o+"'",o==_cal.viewYear&&(i+=" selected"),i+=">"+o+"</option>";i+="</select></div></td><td colspan='1'><a title='Next' class='NxtArrows' href='javascript:_cal.adjYear(1);'></a></td></tr>",i+="<a title='Previous' class='prevArrows' href='javascript:_cal.adjMonth(-1);'></a>",i+="<div class='selectMonth'><select id='calmonth' onchange='_cal.setMonth(this);'>";for(o=1;o<13;o++)i+="<option value='"+o+"'",o==_cal.viewMonth&&(i+=" selected"),i+=">"+_cal.monthNames[o]+"</option>";i+="</select></div><a title='Next' class='NxtArrows' href='javascript:_cal.adjMonth(1);'></a>",i+="<div class='calDays'><div class='dayTxt'>S</div><div class='dayTxt'>M</div><div class='dayTxt'>T</div><div class='dayTxt'>W</div><div class='dayTxt'>T</div><div class='dayTxt'>F</div><div class='dayTxt'>S</div>";do{if(1==a)for(i+="<div class='cent'>";t<r;)i+="<div class='off'><div class='dateLink'>&nbsp;</div></div>",t++}while(this.startContractMonth==_cal.viewMonth&&this.startContractYear==_cal.viewYear&&a<=this.startContractDay?i+="<div class='"+(a==_cal.day&&"select"==this.mode?"on":"off")+"'>"+a+"</div>":"select"==this.mode?i+="<a title='Date Link' href='javascript:_cal.selDay("+a+");' class='"+(_cal.viewMonth==this.month&&_cal.viewYear==this.year&&a==_cal.day||-1<_cal.inDayArray(a)?"on":"off")+"'><div class='dateLink'>"+a+"</div></a>":"range"==this.mode?i+="<a title='Cal Date Range Start' href='javascript:_cal.selRange("+a+");' class='"+(-1<_cal.inDayArray(a)?"on":"off")+"'><div class='dateLink' id='"+_cal.viewMonth+"_"+_cal.viewYear+"_"+a+"'>"+a+"</div></a>":"rangeEnd"==this.mode?i+="<a title='Cal Date Range End' href='javascript:_cal.selRangeEnd("+a+");' class='"+(-1<_cal.inDayArray(a)?"on":"off")+"'><div class='dateLink' id='"+_cal.viewMonth+"_"+_cal.viewYear+"_"+a+"'>"+a+"</div></a>":i+="<a title='Date Link' href='"+("week"==_cal.mode?"javascript:_cal.selWeek(false, ":"javascript:_cal.addDay(")+a+");' class='"+(-1<_cal.inDayArray(a)?"on":"off")+"'><div class='dateLink' id='"+_cal.viewMonth+"_"+_cal.viewYear+"_"+a+"'>"+a+"</div></a>",6<++t&&(i+="</div><div class='cent'>",t=0,c++),++a<=e);for(;t<7&&c<=5;)i+="<div class='off'><div class='dateLink'>&nbsp;</div></div>",7==++t&&c<5&&(t=0,c++,i+="</div><div class='cent'>");i+="select"==_cal.mode||"week"==_cal.mode?"":"<div class='miniCalBtnRow'><div onclick='javascript:"+("range"==_cal.mode||"rangeEnd"==_cal.mode?"_cal.fireCallbackRange();":"_cal.fireCallbackRecycle();")+"' class='buttonMiniCal'>"+("range"==_cal.mode||"rangeEnd"==_cal.mode?"Select":"Create")+"</div>",i+="range"==_cal.mode?"<div class='noSelection'></div>":"",i+="</div>",i+="</div>",_cal.obj.innerHTML=i,"function"==typeof ToggleCustomDropDowns&&(ToggleCustomDropdowns(),$("#calBox select").chosen({disable_search:!0}),$("#calBox .chosen-container").css({width:"100%"})),$("#calBox .dateLink").css({height:$(".dateLink").outerWidth()+"px"}),$("#calBox .dateLink").css({"line-height":$("#calBox .dateLink").outerHeight()+"px"}),_cal.centerMiniCal(),_cal.setDateCookie(_cal.viewMonth+"/1/"+_cal.viewYear)},setDateCookie:function(a){createCookie("MTS_caldate",a)},show:function(a,e){this.posTop=0,this.posLeft=0;var t="function"==typeof readCookie?readCookie("MTS_caldate"):null;null!=t&&(c=new Date(t),_cal.setSelection(c.getMonth()+1,c.getDate(),c.getFullYear())),_MTS_JQUERY("#calBox").fadeTo(0,0),_MTS_JQUERY("#calBox").show(),_cal.render(),_MTS_JQUERY("#calBox").fadeTo(0,1),"function"==typeof ToggleCustomDropDowns&&(ToggleCustomDropdowns(),$("#calBox select").chosen({disable_search:!0}),$("#calBox .chosen-container").css({width:"100%"}));var c=$(".on");$("#calBox .dateLink").css({height:$(".dateLink").outerWidth()+"px"}),$("#calBox .dateLink").css({"line-height":$("#calBox .dateLink").outerHeight()+"px"}),$(".off").css({height:$(".off").outerWidth()+"px"}),c.css({height:c.outerWidth()+"px"}),$("#calBox .dateLink").css({"line-height":$("#calBox .dateLink").outerHeight()+"px"}),$("body").addClass("overflow")},hide:function(){"range"==_cal.mode&&(_cal.rangeStartDate=null,_cal.rangeEndDate=null,_cal.rangeStartDateSet=!1,_cal.rangeEndDateSet=!1,_cal.clearRecycle()),_cal.obj.style.display="none",_MTS_JQUERY("#calBox").hide(),$("body").removeClass("overflow")},close:function(){_cal.hide(),_cal.fireCloseCallback()},centerMiniCal:function(){var a=_MTS_JQUERY(window),e=_MTS_JQUERY(".listing");a.height()>e.height()?(e.removeAttr("style"),e.css({top:(a.height()-e.height())/2+"px",left:(a.width()-e.outerWidth())/2+"px"})):(e.removeAttr("style"),e.css({left:(a.width()-e.outerWidth())/2+"px"}))},GetMiniCalendar:function(a,e,t,c,l,n){var r=new Date;_cal.clearRecycle(),_cal.mode=a,_cal.wndTitle=e,_cal.setContract(r.getFullYear()-50,r.getMonth()+1,r.getDate()-1),_cal.maxYear=_cal.startContractYear+100,_cal.setCallback(c),_cal.setCloseCallback(n),_cal.setSelection(t.getMonth()+1,t.getDate(),t.getFullYear()),_cal.show(100,100);t=_MTS_JQUERY(_cal.bg);t.css({height:_MTS_JQUERY(document).height(),zIndex:113}),t.show()}};
﻿var _MTS_restrictSport=!1,_MTS_adv=!1,_MTS_stopSearchOnce=!1,_MTS_currentSearch=[],_MTS_lastSearchType=null,_searchContainers=[];function MTS_handleEz(start,callback,target){if(!_searchContainers.index||target&&0<target.length&&!_MTS_JQUERY(target).is(":visible"))return!1;var reqTeam="undefined"!=typeof _restrictTeam&&_restrictTeam&&"undefined"!=typeof _teamId,reqSport=_MTS_restrictSport&&"undefined"!=typeof _sportId,showDel="undefined"!=typeof _showDel&&_showDel,showFut="undefined"!=typeof _showFut&&_showFut,phr=_MTS_JQUERY(target||"input[id='searchPhrase']:visible").val()+("undefined"!=typeof _defSearchParam?" "+_defSearchParam:"");if("undefined"!==phr&&(0!==phr.length||"/"!==window.location.pathname)){var p=[];p.push({name:"phrase",value:phr}),p.push({name:"ac",value:0}),p.push({name:"gz",value:"t"}),p.push({name:"s",value:""+start}),p.push({name:"rt",value:reqTeam?_teamId:-1}),p.push({name:"sport",value:reqSport?_sportId:-1}),p.push({name:"incHid",value:showDel?"t":"f"}),p.push({name:"incFut",value:showFut?"t":"f"}),p.push({name:"responseType",value:"undefined"!=typeof _responseType?_responseType:"default"}),"string"==typeof _portalId&&p.push({name:"portalId",value:_portalId});var search=_MTS_JQUERY(".itemLoader:visible");0<search.length&&search.show();var par=target?_MTS_JQUERY(target).parents(".findTeamFormContainer, .search_widget"):_MTS_JQUERY(".search_widget"),parIdx=_searchContainers.index(par[0]),filters=par?par.find(".filterColumn"):_MTS_JQUERY(".filterColumn:visible");if(0<filters.length){for(var types=[],i=filters.length-1,type;0<=i;i--){-1==_MTS_JQUERY(filters[i]).attr("class").indexOf("filterDisabled")&&(type=filters[i].id.split("Filter")[0],"recentData"==type?p.push({name:"recentData",value:!0}):"frequent"==type?p.push({name:"frequent",value:!0}):types.push(type))}0<types.length&&p.push({name:"types",value:types})}p.push({name:"parIdx",value:parIdx});var direction=_MTS_JQUERY(".direction");_MTS_adv&&(p.push({name:"adv",value:"1"}),p.push({name:"zip",value:_MTS_JQUERY("#zip").val()}),p.push({name:"dst",value:_MTS_JQUERY("#selRange").val()}),p.push({name:"start",value:_MTS_JQUERY("#start").val()}),p.push({name:"end",value:_MTS_JQUERY("#end").val()}),p.push({name:"sort",value:_MTS_JQUERY("#sort").val()}),p.push({name:"dir",value:_MTS_JQUERY(".direction").hasClass("rotateDir")})),"undefined"!=typeof _MTS_SORT_TYPE&&p.push({name:"sort",value:_MTS_SORT_TYPE});var dirSet="undefined"!=typeof _MTS_SORT_DIR;if(_MTS_adv||(dirSet?p.push({name:"dir",value:dirSet?_MTS_SORT_DIR:"false"}):0<direction.length&&(p.push({name:"sort",value:_MTS_JQUERY("#sort").val()}),p.push({name:"dir",value:_MTS_JQUERY(".direction").hasClass("rotateDir")}))),_MTS_stopSearchOnce)return _MTS_stopSearchOnce=!1,!1;"undefined"!=typeof _selectedTeamId&&(_selectedTeamId=-1),_searching=!0,_MTS_ajaxPending=!0,_MTS_currentSearch[parIdx]&&_MTS_currentSearch[parIdx].abort();for(var parent=null,i=0;i<p.length;i++)"parIdx"==p[i].name&&(parent=_searchContainers.eq(p[i].value));var results=parent&&0<parent.length?parent.find("div[id='results']"):_MTS_JQUERY("div[id='results']:visible");0===results.length&&(results=_MTS_JQUERY("div[id='results']:visible")),results.children().remove(),_MTS_currentSearch[parIdx]=_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/search.aspx",p,function(o){if(o.ok){var pStr="div[id='paging_top']:visible, div[id='paging_btm']:visible",pg=parent&&0<parent.length?parent.find(pStr):_MTS_JQUERY(pStr);pg.children().remove();var hasSearchTags=0<o.searchTagResults.length,a=hasSearchTags?o.searchTagResults:o.results,l=a.length,t={},logo="";if(0==l)results.append(_MTS_JQUERY("<div class='noMatch'>No matching results were found."+(reqTeam?" Click <span id='addTeam' class='link mts_cc_text'>here</span> to add it.":"")+"</div>"));else{for(var exactMatchFound=!1,searching=_MTS_JQUERY.trim(_MTS_JQUERY(target||"input[id='searchPhrase']:visible").val()),i=0;i<l;i++){if(t=a[i],hasSearchTags)switch(t.type){default:case"Roster":case"PortalVideo":case"PortalEvent":case"Image":case"User":case"NewsItem":case"Audio":results.append(_MTS_JQUERY(MTS_composeSearchTagItem(t,o,results,parent)));break;case"Team":for(var j=o.results.length-1;0<=j;j--)if(o.results[j].id==t.id){results.append(_MTS_JQUERY(MTS_composeTeamItem(o.results[j],o,parent)));break}}else{var x=_MTS_JQUERY(MTS_composeTeamItem(t,o,parent)),leagueVal=x.find(".leagueValue"),schoolVal=x.find(".schoolValue"),genderVal=x.find(".genderValue"),league=0<leagueVal.length?leagueVal.find("option[value="+t.leagueId+"]"):"",school=0<schoolVal.length?schoolVal.find("option[value="+t.schoolId+"]"):"",gender=0<genderVal.length?genderVal.find("input[value="+t.gender.replace("'","\\'")+"]"):"",deleted=x.find(".delete"),hidden=x.find(".deactivate");0<league.length&&league.prop("selected",!0),0<school.length&&school.prop("selected",!0),0<gender.length&&gender.prop("checked",!0),0<deleted.length&&deleted.html("True"==t.deleted?"Undelete":"Delete"),0<hidden.length&&hidden.html("True"==t.hidden?"Activate":"Deactivate"),results.append(x)}var searchType=parent&&0<parent.length&&0<parent.find("input[name='searchType']").length?parent.find("input[name='searchType']").val():_MTS_SEARCH_TYPE;0!=searching.length&&decodeURIComponent(t.name).toLowerCase()!=searching.toLowerCase()&&void 0===searchType||(exactMatchFound=!0)}exactMatchFound||results.append(_MTS_JQUERY("<div class='noMatch'>No exact match found."+(reqTeam?" Click <span id='addTeam' class='link mts_cc_text'>here</span> to add it.":"")+"</div>"));var sp=o.start/o.count|0,ep=o.total/o.count|0;0<ep&&o.total%25==0&&ep--;var si=Math.max(sp-2,0),ei=Math.min(sp+(5-(sp-si)),ep);pg.append(new MTS_pageItem("First",0<sp,0,!1,parent)),pg.append(new MTS_pageItem("Prev",0<sp,sp-1,!1,parent));for(var i=si;i<=ei;i++){var _MTS_JQUERY1=i;pg.append(new MTS_pageItem(""+(i+1),!0,_MTS_JQUERY1,_MTS_JQUERY1==start,parent))}pg.append(new MTS_pageItem("Next",sp<ep,sp+1,!1,parent)),pg.append(new MTS_pageItem("Last",sp<ep,ep,!1,parent))}"function"==typeof _searchEventFired&&_searchEventFired(),"function"==typeof callback&&callback(),"function"==typeof _MTS_JQUERY().dotdotdot&&_MTS_JQUERY(".name:visible").dotdotdot()}(parent?parent.find("#elaps"):_MTS_JQUERY("#elaps")).html(o.elapsed),"function"==typeof SetTeamLogoHeightFromWidth&&SetTeamLogoHeightFromWidth("div[id='results']:visible .logoContainer"),_searching=!1,0<search.length&&search.hide();var searchCallback=parent&&0<parent.length&&0<parent.find("input[name='searchCallback']").length?parent.find("input[name='searchCallback']").val():"";void 0!==eval(searchCallback)?eval(searchCallback)():"function"==typeof _MTS_searchCallback&&_MTS_searchCallback()})}}function MTS_composeTeamItem(e,a,t){var r,n,l=(l=MTS_getTemplate(t)).replace(/%%TEAM_NAME%%/g,decodeURIComponent(e.name));logo=e.logo?(r=(n=a.mediaUrl.replace("%%TEAM_ID%%",e.id)).lastIndexOf("/"),"<img alt='Team Logo' class='logo' src='"+(n=n.substring(0,r)+"/fTeam"+n.substring(r))+"' />"):"<img alt='Team Logo' class='logo' src='"+_MTS_MEDIAURL+"images/sports/"+e.sportThumb+"L.jpg' />";a="team/"+a.teamDefaultTab+"/"+e.id+"/"+e.urlName+"/",t=t&&0<t.length&&0<t.find("input[name='searchType']").length?t.find("input[name='searchType']").val():_MTS_SEARCH_TYPE;return l=MTS_getFormatByType(l=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replace(/%%TEAM_LOGO%%/g,logo)).replace(/%%TEAM_LOCALE%%/g,0<e.city.length?e.city:"")).replace(/%%TEAM_GENDER%%/g,e.gender+" "+e.level+" "+e.sport)).replace(/%%TEAM_LINK%%/g,MTS_getLinkFromSearchType(a,e.name+" "+e.gender+" "+e.sport,e.id,"Team"))).replace(/%%TEAM_ID%%/g,e.id)).replace(/%%FAN_BTN%%/g,void 0===t||"tag"===t.toLowerCase()?"":"true"==e.isFan?"<img class='iamFan' src='"+_MTS_MEDIAURL+"images/iAmFan.png' alt='Fan Of Team' />":"<div id='fan_"+e.id+"' class='mts_cc_button becomeFanBox'> Be A Fan </div>")).replace(/%%TEAM_URLNAME%%/g,e.urlName)).replace(/%%SEARCH_TYPE%%/g,"TeamIcon")).replace(/%%SEARCH_DATE%%/g,"")).replace(/%%TEAM_CODE%%/g,e.scoreKeeperCode),"Team",!0)}function MTS_composeSearchTagItem(e,a,t,r){var n=MTS_getTemplate(r),l=0<e.logo.length,s=e.link;"undefined"!=typeof _MTS_ReplaceImgLink&&_MTS_ReplaceImgLink&&"Image"==e.type&&(s=e.logo);r=e.title;return""!=e.parenttitle&&(r="("+e.parenttitle+") "+e.title),n=MTS_getFormatByType(n=(n=(n=(n=(n=(n=(n=(n=(n=(n=n.replace(/%%TEAM_NAME%%/g,r.replace(/"/g,"&quot;"))).replace(/%%TEAM_LOGO%%/g,l?"<img alt='Team Logo' class='logo' src='"+e.logo+"' />":"")).replace(/%%TEAM_LOCALE%%/g,"")).replace(/%%TEAM_GENDER%%/g,"")).replace(/%%TEAM_LINK%%/g,MTS_getLinkFromSearchType(s,""!=e.parenttitle&&"Image"==e.type?e.parenttitle:r,e.id,e.type,t))).replace(/%%TEAM_ID%%/g,e.id)).replace(/%%FAN_BTN%%/g,"")).replace(/%%TEAM_URLNAME%%/g,"")).replace(/%%SEARCH_TYPE%%/g,e.type+"Icon")).replace(/%%SEARCH_DATE%%/g,e.date),e.type,l)}function MTS_getTemplate(e){return e&&0<e.length&&0<e.find(".rTemplate").length?e.find(".rTemplate").html():0<_MTS_JQUERY("#rTemplate").length?_MTS_JQUERY("#rTemplate").html():""}function MTS_getLinkFromSearchType(link,title,id,type,r){var parent=void 0!==r&&0<r.parents(".search_widget").length?r.parents(".search_widget"):null,searchType=parent&&0<parent.length&&0<parent.find("input[name='searchType']").length?parent.find("input[name='searchType']").val():_MTS_SEARCH_TYPE;if(void 0===searchType)return _MTS_SITEURL+link;var selTagFnc=null,selCallStr=parent&&0<parent.length&&0<parent.find("input[name='selectCallback']").length?parent.find("input[name='selectCallback']").val():"";void 0!==eval(selCallStr)?selTagFnc=eval(selCallStr):"function"==typeof _MTS_selectTagOverride?selTagFnc=_MTS_selectTagOverride:"function"==typeof selectTag&&(selTagFnc=selectTag);var selTagFncName=null==selTagFnc?"void":void 0!==selTagFnc.name?selTagFnc.name:selTagFnc.toString().replace(/(\/\*.*?\*\/)/g,"").match(/^function\s*([^\s(]+)/)[1],newTitle;switch(searchType.toLowerCase()){default:case"search":return _MTS_SITEURL+link;case"layout":switch(type.toLowerCase()){default:newTitle=id;break;case"sport":case"video":case"user":newTitle=id}return"javascript:"+selTagFncName+"('"+escape(newTitle.replace(/'/g,"\\'"))+"')";case"tag":return"javascript:"+selTagFncName+"('"+(link.indexOf("://")<0?"/":"")+link+"','"+escape(title.replace(/'/g,"\\'").replace(/(?!^<(\/|)(\w+)>)(?:\r\n|\r|\n)(?!<(\/|)(\w+)>)/g,""))+"',"+id+",'"+type+"')"}}function MTS_getFormatByType(e,a,t){switch(a){default:case"Team":e=(e=(e=e.replace(/%%LINK_CLASS%%/g,"fullLink")).replace(/%%LOGO_CLASS%%/g,"logoContainer")).replace(/%%INFO_CLASS%%/g,"info");break;case"Roster":case"Audio":case"Image":case"PortalVideo":case"User":case"NewsItem":case"PortalEvent":e=(e=t?(e=e.replace(/%%INFO_CLASS%%/g,"info")).replace(/%%LOGO_CLASS%%/g,"logoContainer"):(e=e.replace(/%%INFO_CLASS%%/g,"fullInfo info")).replace(/%%LOGO_CLASS%%/g,"noLogo logoContainer")).replace(/%%LINK_CLASS%%/g,"fullLink")}return e}function MTS_pageItem(e,a,t,r,n){e=_MTS_JQUERY("<div>"+e+"</div>");return e.attr("class","page"+(r?"Active":a?"Click":"Disabled")).click(function(){a&&MTS_handleEz(t,null,0<n.length?n.find(".mts_search_form, #searchPhrase"):_MTS_JQUERY("#searchPhrase:visible"))}),e}"undefined"==typeof _MTS_SEARCH_TYPE&&(_MTS_SEARCH_TYPE="tag"),_MTS_JQUERY(document).one("widgetsloaded",function(){_searchContainers=_MTS_JQUERY(".findTeamFormContainer, .search_widget, #searchPhrase")}),function(){function e(){_MTS_adv=!_MTS_adv,_MTS_JQUERY(".advCol").toggleClass("advOpen"),"function"==typeof _MTS_toggleMobileFilters&&_MTS_toggleMobileFilters(),_MTS_JQUERY(".toggleOptions").toggleClass("toggleOptionsRotate")}function a(){for(var e=["input[class='mts_search_form']:visible","input[id='searchPhrase']:visible","#zip",".filterColumn:visible","#start","#end"],a=0;a<e.length;a++)for(var t,r,n=_MTS_JQUERY(e[a]),l=0;l<n.length;l++)!function(e){var a=_MTS_JQUERY.trim(e.val());if(e.hasClass("filterColumn")){var t=e.parents(".filterRow");if(t.data("prev-val")!=t.find(".filterDisabled:visible").length)return t.data("prev-val",t.find(".filterDisabled:visible").length),!0}else if(null==e.data("prev-val")&&e.data("prev-val","no search provided"),e.data("prev-val")!=a)return e.data("prev-val",a),!0;return!1}(_MTS_JQUERY(n[l]))||(t=_MTS_JQUERY(n[l]).parents(".findTeamFormContainer, .search_widget"),r=n[l],1<a&&(r=t.find(e[1])),MTS_searchHelper(function(){MTS_handleEz(0,null,r)}))}_MTS_JQUERY(document).ready(function(){_searchContainers=_MTS_JQUERY(".findTeamFormContainer, .search_widget, #searchPhrase"),_MTS_JQUERY(document).on("click","#ezAdv",e),_MTS_JQUERY("#ezGo").click(a),_MTS_JQUERY("#selRange").change(function(){MTS_handleEz(0)}),_MTS_JQUERY("#zip").focus(function(){"Zip Code"===_MTS_JQUERY(this).val()&&_MTS_JQUERY(this).val("")}).blur(function(){""===_MTS_JQUERY(this).val()&&_MTS_JQUERY(this).val("Zip Code")}),setInterval(a,1e3)})}();
﻿/*
 *	jQuery dotdotdot 1.7.4
 *
 *	Copyright (c) Fred Heusschen
 *	www.frebsite.nl
 *
 *	Plugin website:
 *	dotdotdot.frebsite.nl
 *
 *	Licensed under the MIT license.
 *	http://en.wikipedia.org/wiki/MIT_License
 */
!function (t, e) { function n(t, e, n) { var r = t.children(), o = !1; t.empty(); for (var i = 0, d = r.length; d > i; i++) { var l = r.eq(i); if (t.append(l), n && t.append(n), a(t, e)) { l.remove(), o = !0; break } n && n.detach() } return o } function r(e, n, i, d, l) { var s = !1, c = "a, table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style", u = "script, .dotdotdot-keep"; return e.contents().detach().each(function () { var h = this, f = t(h); if ("undefined" == typeof h) return !0; if (f.is(u)) e.append(f); else { if (s) return !0; e.append(f), !l || f.is(d.after) || f.find(d.after).length || e[e.is(c) ? "after" : "append"](l), a(i, d) && (s = 3 == h.nodeType ? o(f, n, i, d, l) : r(f, n, i, d, l), s || (f.detach(), s = !0)), s || l && l.detach() } }), n.addClass("is-truncated"), s } function o(e, n, r, o, d) { var c = e[0]; if (!c) return !1; var h = s(c), f = -1 !== h.indexOf(" ") ? " " : "　", p = "letter" == o.wrap ? "" : f, g = h.split(p), v = -1, w = -1, b = 0, y = g.length - 1; for (o.fallbackToLetter && 0 == b && 0 == y && (p = "", g = h.split(p), y = g.length - 1) ; y >= b && (0 != b || 0 != y) ;) { var m = Math.floor((b + y) / 2); if (m == w) break; w = m, l(c, g.slice(0, w + 1).join(p) + o.ellipsis), r.children().each(function () { t(this).toggle().toggle() }), a(r, o) ? (y = w, o.fallbackToLetter && 0 == b && 0 == y && (p = "", g = g[0].split(p), v = -1, w = -1, b = 0, y = g.length - 1)) : (v = w, b = w) } if (-1 == v || 1 == g.length && 0 == g[0].length) { var x = e.parent(); e.detach(); var T = d && d.closest(x).length ? d.length : 0; x.contents().length > T ? c = u(x.contents().eq(-1 - T), n) : (c = u(x, n, !0), T || x.detach()), c && (h = i(s(c), o), l(c, h), T && d && t(c).parent().append(d)) } else h = i(g.slice(0, v + 1).join(p), o), l(c, h); return !0 } function a(t, e) { return t.innerHeight() > e.maxHeight } function i(e, n) { for (; t.inArray(e.slice(-1), n.lastCharacter.remove) > -1;) e = e.slice(0, -1); return t.inArray(e.slice(-1), n.lastCharacter.noEllipsis) < 0 && (e += n.ellipsis), e } function d(t) { return { width: t.innerWidth(), height: t.innerHeight() } } function l(t, e) { t.innerText ? t.innerText = e : t.nodeValue ? t.nodeValue = e : t.textContent && (t.textContent = e) } function s(t) { return t.innerText ? t.innerText : t.nodeValue ? t.nodeValue : t.textContent ? t.textContent : "" } function c(t) { do t = t.previousSibling; while (t && 1 !== t.nodeType && 3 !== t.nodeType); return t } function u(e, n, r) { var o, a = e && e[0]; if (a) { if (!r) { if (3 === a.nodeType) return a; if (t.trim(e.text())) return u(e.contents().last(), n) } for (o = c(a) ; !o;) { if (e = e.parent(), e.is(n) || !e.length) return !1; o = c(e[0]) } if (o) return u(t(o), n) } return !1 } function h(e, n) { return e ? "string" == typeof e ? (e = t(e, n), e.length ? e : !1) : e.jquery ? e : !1 : !1 } function f(t) { for (var e = t.innerHeight(), n = ["paddingTop", "paddingBottom"], r = 0, o = n.length; o > r; r++) { var a = parseInt(t.css(n[r]), 10); isNaN(a) && (a = 0), e -= a } return e } if (!t.fn.dotdotdot) { t.fn.dotdotdot = function (e) { if (0 == this.length) return t.fn.dotdotdot.debug('No element found for "' + this.selector + '".'), this; if (this.length > 1) return this.each(function () { t(this).dotdotdot(e) }); var o = this; o.data("dotdotdot") && o.trigger("destroy.dot"), o.data("dotdotdot-style", o.attr("style") || ""), o.css("word-wrap", "break-word"), "nowrap" === o.css("white-space") && o.css("white-space", "normal"), o.bind_events = function () { return o.bind("update.dot", function (e, d) { switch (o.removeClass("is-truncated"), e.preventDefault(), e.stopPropagation(), typeof l.height) { case "number": l.maxHeight = l.height; break; case "function": l.maxHeight = l.height.call(o[0]); break; default: l.maxHeight = f(o) } l.maxHeight += l.tolerance, "undefined" != typeof d && (("string" == typeof d || "nodeType" in d && 1 === d.nodeType) && (d = t("<div />").append(d).contents()), d instanceof t && (i = d)), g = o.wrapInner('<div class="dotdotdot" />').children(), g.contents().detach().end().append(i.clone(!0)).find("br").replaceWith("  <br />  ").end().css({ height: "auto", width: "auto", border: "none", padding: 0, margin: 0 }); var c = !1, u = !1; return s.afterElement && (c = s.afterElement.clone(!0), c.show(), s.afterElement.detach()), a(g, l) && (u = "children" == l.wrap ? n(g, l, c) : r(g, o, g, l, c)), g.replaceWith(g.contents()), g = null, t.isFunction(l.callback) && l.callback.call(o[0], u, i), s.isTruncated = u, u }).bind("isTruncated.dot", function (t, e) { return t.preventDefault(), t.stopPropagation(), "function" == typeof e && e.call(o[0], s.isTruncated), s.isTruncated }).bind("originalContent.dot", function (t, e) { return t.preventDefault(), t.stopPropagation(), "function" == typeof e && e.call(o[0], i), i }).bind("destroy.dot", function (t) { t.preventDefault(), t.stopPropagation(), o.unwatch().unbind_events().contents().detach().end().append(i).attr("style", o.data("dotdotdot-style") || "").data("dotdotdot", !1) }), o }, o.unbind_events = function () { return o.unbind(".dot"), o }, o.watch = function () { if (o.unwatch(), "window" == l.watch) { var e = t(window), n = e.width(), r = e.height(); e.bind("resize.dot" + s.dotId, function () { n == e.width() && r == e.height() && l.windowResizeFix || (n = e.width(), r = e.height(), u && clearInterval(u), u = setTimeout(function () { o.trigger("update.dot") }, 100)) }) } else c = d(o), u = setInterval(function () { if (o.is(":visible")) { var t = d(o); (c.width != t.width || c.height != t.height) && (o.trigger("update.dot"), c = t) } }, 500); return o }, o.unwatch = function () { return t(window).unbind("resize.dot" + s.dotId), u && clearInterval(u), o }; var i = o.contents(), l = t.extend(!0, {}, t.fn.dotdotdot.defaults, e), s = {}, c = {}, u = null, g = null; return l.lastCharacter.remove instanceof Array || (l.lastCharacter.remove = t.fn.dotdotdot.defaultArrays.lastCharacter.remove), l.lastCharacter.noEllipsis instanceof Array || (l.lastCharacter.noEllipsis = t.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis), s.afterElement = h(l.after, o), s.isTruncated = !1, s.dotId = p++, o.data("dotdotdot", !0).bind_events().trigger("update.dot"), l.watch && o.watch(), o }, t.fn.dotdotdot.defaults = { ellipsis: "... ", wrap: "word", fallbackToLetter: !0, lastCharacter: {}, tolerance: 0, callback: null, after: null, height: null, watch: !1, windowResizeFix: !0 }, t.fn.dotdotdot.defaultArrays = { lastCharacter: { remove: [" ", "　", ",", ";", ".", "!", "?"], noEllipsis: [] } }, t.fn.dotdotdot.debug = function () { }; var p = 1, g = t.fn.html; t.fn.html = function (n) { return n != e && !t.isFunction(n) && this.data("dotdotdot") ? this.trigger("update", [n]) : g.apply(this, arguments) }; var v = t.fn.text; t.fn.text = function (n) { return n != e && !t.isFunction(n) && this.data("dotdotdot") ? (n = t("<div />").text(n).html(), this.trigger("update", [n])) : v.apply(this, arguments) } } }(typeof _MTS_JQUERY === "function" ? _MTS_JQUERY : $);
﻿var _searchWidgets = {};
_searchWidgets.search = [];
_searchWidgets.tag = [];

function TagResults(obj)
{
   this.obj = obj;

   this.Init = function ()
   {
      var that = this;
      var parent = this.obj;
      if (parent.length == 0)
         return;

      if (parent.find(".ranOnce").length > 0)
         return false;

      parent.append("<input type='hidden' class='ranOnce' />");

      this.resizeTagList();

      parent.on("click", ".clearFilters", function ()
      {
         _MTS_JQUERY(this).parents().find(".filterDisabled").removeClass("filterDisabled");
         parent.find("#start, #end, #sort").val("");
         _MTS_adv = false;
         MTS_handleEz(0, null, this);
      });

      parent.on("click", ".searchClose", function ()
      {
         parent.parents(".uploadTagWrapper").removeClass("showTagWrapper");
         parent.parents(".hiddenContainer").removeClass("showHidden");
         parent.parents(".photoUploadContainer").find("#phuDragDrop").removeClass("hideIt");
         parent.parents("body").removeClass("overflow");
      });

      parent.on("keydown", "#searchPhrase", function (e)
      {
         if (e.which === 13)
         {
            e.preventDefault();
            MTS_handleEz(0, null, this);
         }
      });

      parent.on("click", ".showFilterBtn", function ()
      {
         _MTS_toggleMobileFilters();
      });

      parent.on("click", "#ezAdv", function (e)
      {
         e.stopPropagation();
         parent.find(".filterRow").toggleClass("filterRowOpen");
         _MTS_JQUERY(".searchScroll").scrollTop(0);
      });

      parent.on("click", ".direction", function ()
      {
			_MTS_adv = true;
			$(this).toggleClass("rotateDir");
         MTS_handleEz(0, null, this);
      });

      parent.on("click", ".dateWrap input", function ()
      {
         var date = new Date(_MTS_JQUERY.trim(this.value)), me = _MTS_JQUERY(this);
         if (isNaN(date))
            date = new Date();

         _cal.GetMiniCalendar("select", "Select Date", date, function (m, d, y)
         {
            me.val(m.toString() + "/" + d.toString() + "/" + y.toString());
         }, true);

         _MTS_adv = true;
         MTS_handleEz(0, null, this);
      });

      parent.on("click", ".chosen-drop", function ()
      {
         _MTS_adv = true;
         MTS_handleEz(0, null, this);
      });

      parent.on("click", ".filterColumn", function ()
      {
         var fd = "filterDisabled",
            filters = parent.find(".filterColumn:visible");
         if (this.id != "recentDataFilter" && this.id != "frequentFilter" && filters.filter("." + fd).length == 0)
            filters.toggleClass(fd);

         _MTS_JQUERY(this).toggleClass(fd);

         parent.find(".uploadTagWrapper .result").each(function ()
         {
            var tr = _MTS_JQUERY(this).children(".topRow").outerWidth();
            var br = _MTS_JQUERY(this).children(".logoContainer").width();
            var fw = _MTS_JQUERY(this).width();
            var infoWidth = fw - (tr + br);
            _MTS_JQUERY(this).children(".botRow").css({
               "width": (infoWidth - 10) + "px",
               "height": _MTS_JQUERY(this).height() + "px"
            });
         });
      });

      parent.find("#cancelButton").click(function ()
      {
         parent.find("input.text").val("");
         parent.find("select").val(-1);
         parent.find("input[name=gender]")[0].checked = true;
      });

      parent.on("click", ".result", function ()
      {
         _MTS_JQUERY(this).addClass("selectedTag");
      });

      _MTS_JQUERY(window).resize(function ()
      {
         that.resizeTagList();
      });
   };

   this.sizeTagItems = function ()
   {
      var ftfc = this.obj.find(".findTeamFormContainer").outerHeight();
      var ffc = this.obj.find(".formFilterContainer").outerHeight();
		var mpc = this.obj.find(".morePagesContainer").outerHeight();
      var sum = ftfc + ffc + mpc;
      var h = _MTS_JQUERY(window).height() - sum;

      if (_MTS_JQUERY(window).width() > 767)
      {
         h -= this.obj.find(".searchScroll").parents(".uploadTagWrapper").length > 0 ? 50 : 0;
         this.obj.find(".searchScroll").css({ "height": h + "px" });
      } else
      {
         this.obj.find(".searchScroll").css({ "height": h + "px" });
      }

      this.obj.find(".morePagesContainer").removeAttr("style");
      this.obj.find(".searchResultsAdjust").removeAttr("style");

      var info = this.obj.find(".info");

      info.each(function ()
      {
         var result = _MTS_JQUERY(this).parents(".result");
         var resultWidth = result.width();
         var lc = result.find(".logoContainer").width();
         var li = result.find(".leftIcon").width();
         var width = resultWidth - (lc + li + 100);
         _MTS_JQUERY(this).css({ "width": width + "px" });
      });

      this.obj.parents(".uploadTagWrapper").css({ "height": (_MTS_JQUERY(window).height() - 50) + "px" });
   };

   this.overallTags = function ()
   {
      var ftfc = this.obj.find(".findTeamFormContainer:visible").outerHeight();
      var ffc = this.obj.find(".formFilterContainer:visible").outerHeight();
      var sum = ftfc + ffc + 40;
      var res = this.obj.find(".searchResults");
      res.css({
         "min-height": _MTS_JQUERY(window).height() - sum + "px"
      });

      _MTS_JQUERY(window.parent.document.body).addClass("overflow");

      _MTS_JQUERY(window.parent.document).find(".mce-close").click(function ()
      {
         if (_MTS_JQUERY(window.parent.document).find(".mce-close").length == 0)
            _MTS_JQUERY(this).parents("body").removeClass("overflow");
      });
   };

   this.resizeTagList = function ()
   {
      this.sizeTagItems();
      if (this.obj.parents(".overallTags").length > 0)
         this.overallTags();
   };
}

function SearchResults(obj)
{
   this.obj = obj;

   this.Init = function ()
   {
      var that = this;
      var parent = this.obj;
      if (parent.length == 0)
         return;

      if (parent.find(".ranOnce").length > 0)
         return false;

      parent.append("<input type='hidden' class='ranOnce' />");

      this.sizeItems();

      parent.on("click", ".clearFilters", function ()
      {
         _MTS_JQUERY(this).parents().find(".filterDisabled").removeClass("filterDisabled");
         parent.find("#start, #end, #sort").val("");
         _MTS_adv = false;
         MTS_handleEz(0, null, this);
      });

      parent.on("click", ".showFilterBtn", function ()
      {
         _MTS_toggleMobileFilters();
         _MTS_adv = false;
      });

      parent.on("click", ".searchClose", function ()
      {
         parent.find(".searchWrapper, .tagWrapper, .background, .uploadTagWrapper, .uploadBackground").hide();
      });

		parent.on("click", ".direction", function () {
			_MTS_adv = true;
			$(this).toggleClass("rotateDir");
			MTS_handleEz(0, null, this);
		});

      parent.on("click", ".dateWrap input", function ()
      {
         var date = new Date(_MTS_JQUERY.trim(this.value)), me = _MTS_JQUERY(this);
         if (isNaN(date))
            date = new Date();

         _cal.GetMiniCalendar("select", "Select Date", date, function (m, d, y)
         {
            me.val(m.toString() + "/" + d.toString() + "/" + y.toString());
         }, true);

         _MTS_adv = true;
         MTS_handleEz(0, null, this);
      });

      parent.on("click", ".chosen-drop", function ()
      {
         _MTS_adv = true;
         MTS_handleEz(0, null, this);
      });

      parent.on("keydown", "#searchPhrase", function (e)
      {
         if (e.which === 13)
         {
            e.preventDefault();
            MTS_handleEz(0, null, this);
         }
      });

      parent.on("click", "#doSearch", function ()
      {
         var name = parent.find("input[name='searchTxt']").last().val();
         var sport = parent.find("#sport").val();

         if (name == "" && sport == "")
         {
            parent.find(".errorNoTeams").html("Please specify at least a search phrase or sport");
            return false;
         }

         parent.find("#findform").submit();
      });

      parent.on("click", ".becomeFanBox", function (e)
      {
         e.stopPropagation();
         e.preventDefault();
         var id = this.id.split('_')[1];
         var button = this;

         if (_userId > 0)
         {
            var p = [];
            p.push({
               name: "id", value: id
            });
            p.push({
               name: "mode", value: "addFan"
            });

            ajax("/api/updateUserTeamLinks.aspx", p, function (ret)
            {
               var o; eval("o = " + ret + ";");
               if (o.ok)
                  _MTS_JQUERY(button).replaceWith("<img class='iamFan' src='" + _mediaUrl + "images/iAmFan.png' alt='Fan Of Team'>");
            });
         }
         else
            window.location = "/user/register/?teamId=" + id + "&mode=fan&target=/team/news/" + id + "/team/";
      });

      parent.on("click", ".filterColumn", function ()
      {
         var fd = "filterDisabled",
            filters = parent.find(".filterColumn:visible");
         if (this.id != "recentDataFilter" && filters.filter("." + fd).length == 0)
            filters.toggleClass(fd);

         _MTS_JQUERY(this).toggleClass(fd);

         parent.find(".uploadTagWrapper .result").each(function ()
         {
            var tr = _MTS_JQUERY(this).children(".topRow").outerWidth();
            var br = _MTS_JQUERY(this).children(".logoContainer").width();
            var fw = _MTS_JQUERY(this).width();
            var infoWidth = fw - (tr + br);
            _MTS_JQUERY(this).children(".botRow").css({
               "width": (infoWidth - 10) + "px",
               "height": _MTS_JQUERY(this).height() + "px"
            });
         });
      });

      parent.find("#cancelButton").click(function ()
      {
         parent.find("input.text").val("");
         parent.find("select").val(-1);
         parent.find("input[name=gender]")[0].checked = true;
      });

      _MTS_JQUERY(window).resize(function ()
      {
         that.sizeItems();
      });
   };

   this.sizeItems = function ()
   {
      if (this.obj.width() > 767)
      {
         var mp = this.obj.find(".morePagesContainer").detach();
         this.obj.find(".searchScroll").append(mp);
         this.obj.find(".filterRow").addClass("filterRowOpen");
         var fh = this.obj.find(".filterRowOpen").height() - this.obj.find(".morePagesContainer").outerHeight();
         this.obj.find(".searchResults").css({ "height": fh + "px", "overflow-y": "auto", "overflow-x": "hidden" });

         this.obj.find(".searchResults").css({
            "height": ((this.obj.find(".filterRow").height() * 2) - 60) + "px"
         });

         this.obj.find(".morePagesContainer").css({ "width": this.obj.find(".searchResults").width() + "px" });
      }
      else
      {
         this.obj.find(".searchResults").removeAttr("style");
         this.obj.find(".morePagesContainer").removeAttr("style");
      }

      var info = this.obj.find(".info");

      info.each(function ()
      {
         var result = _MTS_JQUERY(this).parents(".result");
         var resultWidth = result.width();
         var lc = result.find(".logoContainer").width();
         var li = result.find(".leftIcon").width();
         var width = resultWidth - (lc + li + 100);
         _MTS_JQUERY(this).css({ "width": width + "px" });
      });

      this.obj.parents(".uploadTagWrapper").css({ "height": (_MTS_JQUERY(window).height() - 50) + "px" });
   };
}

(function ()
{
   var _itv = -1;

   if (_MTS_widgetsReady)
      init();
   else
   {
      _MTS_JQUERY(document).one("widgetsloaded", init);
   }

    function init() {
        _MTS_JQUERY(".search_widget").each(function (idx) {
            var s = null;
            var searchType = _MTS_JQUERY(this).find("input[name='searchType']").val();
            _MTS_JQUERY(this).addClass(searchType).attr("id", "searchWidget_" + idx);
            if (searchType == "Search") {
                s = new SearchResults(_MTS_JQUERY(this));
                _searchWidgets.search[idx] = s;
            }
            else {
                s = new TagResults(_MTS_JQUERY(this));
                _searchWidgets.tag[idx] = s;
            }

            s.Init();
        });

        if (window.location.pathname !== "/")
            RestoreSearchFromHistory();

        if (typeof (_cal) != "undefined")
            _cal.initialize();


        set_MTS_SaveHistoryState(function () {
            var state = [];
            objArray = [];

            _MTS_JQUERY(".search_widget").each(function () {
                var s = {};
                var obj = _MTS_JQUERY(this);
                s.search = obj.find("#searchPhrase").val();
                s.page = parseInt(obj.find(".pageActive:first").html()) - 1;
                s.disabled = "";
                obj.find(".filterDisabled").each(function () {
                    s.disabled += (s.disabled.length > 0 ? ", #" : "#") + this.id;
                });

                objArray.push(s);
            });

            state.push({ "name": "objArray", "value": objArray });
            history.replaceState(state, "");
        });

    }

   function RestoreSearchFromHistory()
   {
      try
      {
         if (history.state != null)
         {
            var objArray = [];
            var o = _MTS_JQUERY(history.state, function (e)
            {
               return e.name == "objArray";
            });

            if (o.length > 0)
               objArray = o[0].value;

            for (var i = 0; i < objArray.length; i++)
            {
               var obj = _MTS_JQUERY("#searchWidget_" + i);
               var state = objArray[i];

               if (obj.length == 0 || state == null)
                  continue;

               if (state.search != null)
               {
                  obj.find("#searchPhrase").val(state.search);
                  obj.find("#searchPhrase").data("prev-val", state.search);
               }

               if (state.disabled != null)
               {
                  obj.find(".filterDisabled").removeClass("filterDisabled");
                  obj.find(state.disabled).addClass("filterDisabled");
                  obj.find(".filterRow").data("prev-val", obj.find(".filterDisabled:visible").length);
               }

               if (state.page != null)
                  MTS_handleEz(state.page, null, obj.find("#searchPhrase"))
            }
         }
      } catch (ex)
      {
         console.log(ex);
      }
   }
})();

function _MTS_toggleMobileFilters()
{
   _MTS_JQUERY(".filterRow").toggleClass("filterRowOpen");
}
﻿var _marqueeTimeout;

$(document).one("widgetsloaded", function () {
   if (displayMultiple == "scroll" && showMultiple == true) {
      setTimeout(function () {
         scroll();
      }, 3000);
   } else if (displayMultiple == "rotate" && showMultiple == true) {
      setTimeout(function () {
         rotate();
      }, 3000);
   } else if (displayMultiple == "marquee" && showMultiple == true) {
      marquee();
      $(window).resize(function () {
         clearTimeout(_marqueeTimeout);
         marquee();
      });
   } else {
      return;
   }
});


function scroll() {
   var interval = setInterval(moveTop, 5000);

   var height = $(".breakingOverflow").height();
   $(".breakingAnimate").height(height);

   var slideCount = $('.breakingAnimate').length;
   var slideHeight = $('.breakingAnimate').height();
   var sliderUlHeight = slideCount * slideHeight;

   $('.breakingOverflow').css({ height: sliderUlHeight });

   $(window).resize(function () {
      $(".breakingOverflow").removeAttr("style");
      $(".breakingAnimate").removeAttr("style");

      width = $(".breakingOverflow").height();
      $(".breakingAnimate").height(height);

      slideCount = $('.breakingAnimate').length;
      slideHeight = $('.breakingAnimate').height();
      sliderUlHeight = slideCount * slideHeight;

      $('.breakingOverflow').css({ height: sliderUlHeight });
   });

   function moveTop() {
      $('.breakingOverflow').animate({
         top: - slideHeight
      }, 250, function () {
         $('.breakingAnimate:first-child').clone().appendTo('.breakingOverflow');
         $('.breakingOverflow').css('top', '');
         $('.breakingAnimate:first-child').remove();
      });
   };

   $(window).focus(function () {
      interval = setInterval(moveTop, 5000); // Restart interval
   });

   $(window).blur(function () {
      clearInterval(interval); // Clearing interval on window blur
   });
}

function rotate() {
   var interval = setInterval(moveRight, 5000);

   var width = $(".breakingOverflow").width();
   $(".breakingAnimate").width(width);

   var slideCount = $('.breakingAnimate').length;
   var slideWidth = $('.breakingAnimate').width();
   var sliderUlWidth = slideCount * slideWidth;

   $('.breakingOverflow').css({ width: sliderUlWidth });

   $(window).resize(function () {
      $(".breakingOverflow").removeAttr("style");
      $(".breakingAnimate").removeAttr("style");

      width = $(".breakingOverflow").width();
      $(".breakingAnimate").width(width);

      slideCount = $('.breakingAnimate').length;
      slideWidth = $('.breakingAnimate').width();
      sliderUlWidth = slideCount * slideWidth;

      $('.breakingOverflow').css({ width: sliderUlWidth });
   });

   function moveRight() {
      $('.breakingOverflow').animate({
         left: - slideWidth
      }, 750, function () {
         $('.breakingAnimate:first-child').clone().appendTo('.breakingOverflow');
         $('.breakingOverflow').css('left', '');
         $('.breakingAnimate:first-child').remove();
      });
   };

   $(window).focus(function () {
      interval = setInterval(moveRight, 5000); // Restart interval
   });

   $(window).blur(function () {
      clearInterval(interval); // Clearing interval on window blur
   });
}

function marquee() {
   $(".breakingSliderWrap").addClass("marquee");

   var marqueeWidth;
   var ba = $(".marquee .breakingAnimate");
   var time = ba.length * 12000;
   var width = 0;
   var dateWidth;
   var titleWidth;
   var total = 0;

   ba.each(function () {
      dateWidth = Math.ceil($(this).find(".breakingDate").outerWidth());
      titleWidth = Math.ceil($(this).find(".breakingTitle").outerWidth());
      total = dateWidth + titleWidth;

      width += total;
   });

   marqueeWidth = $(".breakingSliderWrap").width();

   $(".marquee .breakingOverflow").css({
      "left": marqueeWidth + "px"
   });

   $(".marquee .breakingOverflow").width(width);

   moveMarquee(width, time);
}

function moveMarquee(width, time) {
   $(".marquee .breakingOverflow").animate({
      "left": -width + "px"
   }, time, "linear", function () {
      var checkWidth = $(".breakingSliderWrap").width();
      $(".marquee .breakingOverflow").css({
         "left": checkWidth + "px"
      });
   });

   _marqueeTimeout = setTimeout(marquee, time);
}

﻿var _currentImage=null,_noCaptionCaptionText="Click here to add a caption.",_noCreditText="Click here to add credits.",_slideShowTimer=null,_changingImage=!1,_beforeUpload=!1,_blockTag=!1,_tags=[],_tagsLinkType=[],_tagsLinkName=[],_wiredTags=[],_archivedAlbum=[],_reloadThumbnails=!1,_lightBoxEmailFrom="From (Required)",_lightBoxEmailReq="Recipients (Required)",_lightBoxEmailMsg="Check out this photo I found at "+("undefined"!=typeof _portalName&&0<_portalName.length?_portalName+"!":"My Team Scoop!"),_albumEmailMsg="Check out this photo album I found at "+("undefined"!=typeof _portalName&&0<_portalName.length?_portalName+"!":"My Team Scoop!"),_MTS_lightBoxRequired=!0;_MTS_JQUERY="undefined"==typeof _MTS_JQUERY?$:_MTS_JQUERY;var _MTS_countSinceLastAd=1,_MTS_adCount=1,_isAlbum=!1;function WireUpLightbox(){if(0==_MTS_JQUERY("#whiteBox").length)return _MTS_lightBoxRequired&&(_MTS_lightBoxRequired=!1,MTS_reloadWidget("","/api/photoLightBox.aspx",null,null,null,WireUpLightbox)),!1;var e=_MTS_JQUERY(".whiteBox");function t(){MTS_PHOTO_AD_CHECK()&&(ChangeWhiteBoxImage(GetPreviousImage(_currentImage)),ResetSlideShow())}function i(){MTS_PHOTO_AD_CHECK()&&(ChangeWhiteBoxImage(GetNextImage(_currentImage)),ResetSlideShow())}e&&1<e.length&&_MTS_JQUERY(e[0]).remove(),_MTS_JQUERY(".uploadTagWrapper").find("script").remove(),_MTS_JQUERY("body").append(_MTS_JQUERY("#whiteBox")),_MTS_JQUERY("body").append(_MTS_JQUERY(".uploadTagWrapper")),_MTS_JQUERY("body").append(_MTS_JQUERY(".background")),_MTS_JQUERY("body").append(_MTS_JQUERY(".listingBg")),_MTS_JQUERY(document).on("#whiteBox").delegate(".whiteBackground, #whiteCloseButton, .imageBackBtn","click",function(){_MTS_JQUERY("#whiteBox").data("stayOpen")||(CloseWiteBox(),_MTS_JQUERY(".filterIcon").removeClass("imageCloseButton"),_MTS_JQUERY("body").removeClass("noScrolling"),_MTS_JQUERY(".rightSideCtr").removeClass("rsOpen"),_MTS_JQUERY(".mtpShow").toggleClass("mtpShow"),_MTS_JQUERY(".adminOptActive").toggleClass("adminOptActive"),_MTS_JQUERY(".searchClose").click())}),_MTS_JQUERY(document).on("#whiteBox").delegate(".mtGear","click",function(){_currentImage&&OpenUpload(void 0,void 0,!0,void 0,void 0,void 0,void 0,_currentImage.id)}),_MTS_JQUERY(document).on("#whiteBox").delegate("#fbPhotoShare","click",function(e){e.preventDefault();var t=screen.width/2-275,i=screen.height/2-225,e=_MTS_SITEURL+(_isAlbum&&void 0!==_selectedAlbum.url?_selectedAlbum.url:"photo-single/"+_currentImage.id+"/?mode=team");window.open("https://www.facebook.com/sharer/sharer.php?u="+encodeURI(e)+"&amp;src=sdkpreparse","facebook-share-dialog","width=626,height=436","facebookShare","width=550, height=420, top="+i+", left="+t)}),_MTS_JQUERY(document).on("#whiteBox").delegate("#mailPhotoShare","click",function(){lightBoxEmailShare(_isAlbum&&void 0!==_selectedAlbum.id?_selectedAlbum.id:0)}),_MTS_JQUERY(window).resize(function(){_MTS_JQUERY(".mediaToolPop"),_MTS_JQUERY(".mtGear");sizePhoto()}),_MTS_JQUERY("#whiteBox").on("click",".whiteLeftArrow, .mediaControlLeft",function(e){t()}),_MTS_JQUERY("#whiteBox").on("click",".whiteRightArrow, .mediaControlRight",function(e){i()}),"function"==typeof _MTS_JQUERY().swipe&&_MTS_JQUERY("#whiteImage").swipe(function(e){("right"==e.directionX?t:i)()}),_MTS_JQUERY("#whiteBox").on("click",".albumImageCtr",function(e){return!!MTS_PHOTO_AD_CHECK()&&(ChangeWhiteBoxImage(GetImageById(this.id.split("_")[1],!0)),void ResetSlideShow())}),_MTS_JQUERY("#whiteBox").on("click",".mediaControlStop",function(e){StopSlideShow()}),_MTS_JQUERY("#whiteBox").on("click",".mediaControlPlay",function(e){StartSlideShow(),this.setAttribute("class","mediaControlPause")}),_MTS_JQUERY("#whiteBox").on("click",".mediaControlPause",function(e){PauseSlideShow(),this.setAttribute("class","mediaControlPlay")}),_MTS_JQUERY("#whiteBox").delegate("#whiteCheerButton","click",function(){var e=[];e.push({name:"i",value:_currentImage.id}),e.push({name:"t",value:3}),e.push({name:"c",value:_currentImage.cheers}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"ext/UpdateCheer.aspx",e,function(){_currentImage.cheered?_currentImage.cheers--:_currentImage.cheers++,_currentImage.cheered=!_currentImage.cheered,MTS_reloadWidget("i="+_currentImage.id.toString()+"&t=3","/ext/FancyCheer.aspx",null,"#whiteCheerButton")})}),_MTS_JQUERY("#whiteBox").delegate("#whiteImageDelete","mouseenter mouseleave",function(e){"mouseenter"===e.type?_MTS_JQUERY("#whiteImageDeleteImage").css("background-image","url(/images/deletePhotoH.png)"):_MTS_JQUERY("#whiteImageDeleteImage").css("background-image","url(/images/deletePhoto.png)")}),_MTS_JQUERY("#whiteBox").delegate("#editImgShowBtn","click",function(){var e=_MTS_JQUERY("#whiteTitleNewValue");0<e.length&&e.val(_MTS_JQUERY("#whiteTitle").text());e=_MTS_JQUERY("#whiteSummaryNewValue");0<e.length&&e.val(_MTS_JQUERY("#whiteSummary").text());e=_MTS_JQUERY("#whiteCreditEditText");0<e.length&&e.val(_MTS_JQUERY("#whiteCredit").text().replace("Credit: ","")),ToggleEdit(!0),_MTS_JQUERY(".editImgInfo").addClass("editImgInfoHide")}),_MTS_JQUERY("#whiteBox").delegate("#editImgCancel","click",function(){ToggleEdit(!1),_MTS_JQUERY(".editImgInfo").removeClass("editImgInfoHide")}),_MTS_JQUERY("#whiteBox").delegate("#editImgSave","click",function(){var e=_MTS_JQUERY("#whiteCreditEditText").val(),t=_MTS_JQUERY("#whiteTitleNewValue").val(),i=_MTS_JQUERY("#whiteSummaryNewValue").val();UpdateImageText(_currentImage,e,t,i),ToggleEdit(!1)}),_MTS_JQUERY("#sharePhoto").on("click",function(){_MTS_JQUERY(".shareCtr").toggleClass("tpsLeft")}),_MTS_JQUERY("#whiteBox").delegate("#whiteImageDelete","click",function(){var t=new PopupDialog;t.NewYesNoPrompt("Would you like to permanently delete this image?","Are you sure?",null,function(e){!1!==e&&DeleteImage(_currentImage,function(e){e?(_MTS_JQUERY("#photo_"+_currentImage.id).hide(),CloseWiteBox()):(t.Hide(),t.NewOkayAlert("An unknown error prevented us from deleting this image at this time.","Error!"))})})}),_MTS_JQUERY("#whiteBox").delegate("#whiteTagButton","click",function(){ToggleTagBox(!0)}),_MTS_JQUERY("#whiteBox").delegate("#whiteTagEditButtonSave","click",function(){var e=0<_MTS_JQUERY("#scheduleResultSelectBox").val()?_MTS_JQUERY("#scheduleEntryResultsSelectBox").val():"-1",t=_MTS_JQUERY("#rosterTag").val(),i=_MTS_JQUERY("#newsTag").val(),a="tagDropContainer",n=_MTS_JQUERY(".albumSelect");"none"==_MTS_JQUERY(".albumSelect").parent().css("display")&&(findSelectId("scheduleResultSelectBox",n,a),e=findSelectId("scheduleEntryResultsSelectBox",_MTS_JQUERY(".scheduleEntrySelect"),a),t=findSelectId("rosterTag",n,a),i=findSelectId("newsTag",n,a)),UpdateImageTag(_currentImage,e,t,i),ToggleTagBox(!1)}),_MTS_JQUERY("#whiteBox").delegate("#whiteTagEditButtonCancel","click",function(){ToggleTagBox(!1)}),_MTS_JQUERY("#whiteBox").delegate("#buyPhoto","click",function(){if(TrackPhoto(_currentImage.id),_currentImage.container&&0<_currentImage.container.length){for(var t="",e="",i=_activeContainer.portals.length-1;0<=i;i--)if(_activeContainer.portals[i].id==_currentImage.container){t=_activeContainer.portals[i].url,e=_activeContainer.portals[i].domain;break}if(""==t||""==e)return!1;window.location.origin||(window.location.origin=window.location.protocol+"//"+window.location.host);var a=_MTS_PHOTO_TEMPLATE.replace("%%IMG_ID%%",_currentImage.id).replace("%%SIZE%%",2).replace("%%TEAM_ID%%",_currentImage.teamId).replace("%%USER_ID%%",_currentImage.uploaderId).replace("%%TYPE%%",0);if("undefined"!=typeof FOTOMOTO)FOTOMOTO.API.showWindow(10,a);else{var n=t+"/"+_currentImage.id,o=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");try{o.open("GET",n,!1),o.send(),404===o.status&&(n=t+"/"+getBigInt(_currentImage.id)+_currentImage.id+"_original")}catch(e){n=t+"/"+getBigInt(_currentImage.id)+_currentImage.id+"_original"}window.open("http://"+e+".mycapture.com/mycapture/remoteimage.asp?caption="+escape(_currentImage.title)+"&image="+a+"&notes="+n+"&backtext=Back")}}}),_MTS_JQUERY("#whiteBox").delegate("#tagButton","click",function(){ToggleNewTag()}),_MTS_JQUERY("#whiteBox").delegate("#cropButton","click",function(){StartImgCrop();var e=_MTS_JQUERY(".mediaToolPop"),t=_MTS_JQUERY(".mtGear");e.toggleClass("mtpShow"),t.toggleClass("adminOptActive"),_MTS_JQUERY(".rightSideCtr").toggleClass("rsOpen")}),_MTS_JQUERY("#whiteBox").delegate("#imageDelete","click",function(){DeleteImagePopup()}),_MTS_JQUERY("#whiteBox").delegate("#whiteSubmitButton","click",function(){var e=_MTS_JQUERY("#whiteTitle").html();null!=e&&"undefined"!=e||(e=""),submitHtml="<div class='submitContainer' id='submitToPortal'><div class='textTitle'> Title </div><input type='text' id='submitTitle' value='' maxlength='256' class='titleTxt' /><div class='textTitle'> Summary </div><textarea id='submitSummary' maxlength='1024' class='summaryTxt' /><div class='submitBtnCon'><div class='submitBtn' id='cancelToPortal'> Cancel </div><div class='submitBtn' id='submitFinal'> Submit </div></div><div class='textTitle' id='erMsg'></div></div>",_MTS_JQUERY("body").append(submitHtml),_MTS_JQUERY("#submitTitle").val(e),_MTS_JQUERY(".submitContainer").css("z-index",160),_MTS_JQUERY(".background").show()}),_MTS_JQUERY(".mainTPContainer").delegate(".startSlideButton","click",function(){OpenWhiteBox(GetImageByPosition(0),!0),StartSlideShow()}),_MTS_JQUERY("#whiteBox").on("click","#cancelFeatLink",function(){_MTS_JQUERY("#photoEditFeatLink").html("Not Featured"),_MTS_JQUERY(this).hide(),_MTS_JQUERY("#featApply, #whiteSubmitButton").show();var e=[];e.push({name:"mode",value:"photo"}),e.push({name:"id",value:_currentImage.imageId}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/editfeatured.aspx",e,function(){_MTS_JQUERY("#featApply, #featureDate").hide(),_MTS_JQUERY("#whiteSummary").html("")})}),_MTS_JQUERY("#featureDate .editFeatLink").click(function(){var a=this;GetMiniCalendarCustom("select","Date Range",function(e,t,i){i=e.toString()+"/"+t.toString()+"/"+i.toString();FeaturePhoto(a.innerHTML=i,_currentImage.imageId)},_MTS_JQUERY.trim(a.innerHTML))}),_MTS_JQUERY("body").delegate("#cancelToPortal","click",function(){CloseSubmitBox()}),_MTS_JQUERY("body").delegate("#submitFinal","click",function(){var e=_MTS_JQUERY("#erMsg"),a=_MTS_JQUERY.trim(_MTS_JQUERY("#submitTitle").val()),n=_MTS_JQUERY.trim(_MTS_JQUERY("#submitSummary").val()),o=_MTS_JQUERY.trim(_MTS_JQUERY("#whiteCredit").text().replace("Credit: ",""));""!=a&&""!=n?_featurePhotos?GetMiniCalendarCustom("select","Featured Until",function(e,t,i){i=e.toString()+"/"+t.toString()+"/"+i.toString();SubmitPhoto(a,n,o,i)}):SubmitPhoto(a,n,o):e.html("Title and summary are required fields!")}),"function"==typeof MTS_lightBoxCallback&&MTS_lightBoxCallback()}function MTS_PHOTO_AD_CHECK(){if("undefined"!=typeof _MTS_ITEM_ADS&&0<_MTS_ITEM_ADS.length&&"undefined"!=typeof _MTS_PHOTO_PER_AD&&0<_MTS_PHOTO_PER_AD.length&&0<_MTS_PHOTO_PER_AD){var e=$(".whiteImgSrc, .titleBuy");if(_MTS_countSinceLastAd>=_MTS_PHOTO_PER_AD){try{var t="mts_ad_"+_MTS_adCount,i=_MTS_JQUERY("<div id='"+t+"' class='_mts_floatingAd borderedAd'></div>");_MTS_adCount++,$("#whiteImage").append(i),ad=_MTS_ITEM_ADS[0],0<=ad.location.indexOf("widget_")?(i.append("<div class='custom_widget'><input name='widgetName' type='hidden' value='"+ad.location.split("_")[1]+"' /></div></div>"),"function"==typeof MTS_loadWidgets&&MTS_loadWidgets(),_MTS_JQUERY(document).one("widgetsloaded",function(){"object"==typeof __gh__webApp&&__gh__webApp.ads.dfp.createLazySlot(".ad-lazy:visible:last")})):(googletag.defineSlot(ad.location,[ad.width||300,ad.height||250],t).setTargeting(ad.target,ad.target2).setCollapseEmptyDiv(!0).addService(googletag.pubads()),googletag.display(t))}catch(e){}return e.hide(),_MTS_countSinceLastAd=0,!1}_MTS_countSinceLastAd++,e.show(),_MTS_JQUERY("._mts_floatingAd").remove()}return!0}function GetMiniCalendarCustom(e,t,i,a){var n=new Date,a=new Date(a);"Invalid Date"==a&&(a=new Date),_cal.clearRecycle(),_cal.mode=e,_cal.wndTitle=t,_cal.setContract(n.getFullYear(),0,0),_cal.maxYear=_cal.startContractYear+5,_cal.setCallback(i),_cal.setSelection(a.getMonth()+1,a.getDate(),a.getFullYear()),_cal.show(100,100),_MTS_JQUERY(".listingBg").css({height:_MTS_JQUERY(document).height(),zIndex:113}),_MTS_JQUERY(".listingBg").show()}function FeaturePhoto(t,e){var i=[];i.push({name:"mode",value:"photo"}),i.push({name:"id",value:e}),i.push({name:"til",value:t}),i.push({name:"title",value:_MTS_JQUERY.trim(_MTS_JQUERY("#whiteTitle").html())}),i.push({name:"desc",value:_MTS_JQUERY.trim(_MTS_JQUERY("#whiteSummary").html())}),_MTS_JQUERY("#featApply").show(),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/editfeatured.aspx",i,function(e){e.error?(_MTS_JQUERY("#fdError").html("You must fill out the title and description."),_MTS_JQUERY("#fdError").show()):(_MTS_JQUERY("#cancelFeatLink").show(),_currentImage.featuredUntil=t),_MTS_JQUERY("#featApply").hide()})}function SubmitPhoto(t,i,e,a){var n=_MTS_JQUERY("#erMsg"),o=[];o.push({name:"mode",value:"requestAuth"}),o.push({name:"title",value:t}),o.push({name:"summary",value:i}),o.push({name:"credit",value:e}),o.push({name:"pid",value:_currentImage.id}),o.push({name:"email",value:"true"}),null!=a&&""!=a&&o.push({name:"date",value:a}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/updatePortalPhoto.aspx",o,function(e){n.html(""),"true"==e.ok?(_currentImage.title=t,_currentImage.summ=i,_currentImage.id=e.imageId,null!=a&&""!=a&&(_currentImage.featuredUntil=a),CloseSubmitBox(),FillWhiteBox(_currentImage)):n.html(e.error)})}function CloseSubmitBox(){_MTS_JQUERY(".submitContainer").remove(),_MTS_JQUERY(".background").hide()}function CloseWiteBox(){ToggleEdit(!1),_MTS_JQUERY("#whiteBox, .mediaTools").removeClass("animateLeft"),setTimeout(function(){_MTS_JQUERY(".whiteBox").hide()},500),_MTS_JQUERY(".mediaInterfaceWrapper").removeClass("snapMiw, fixmia");var e=_MTS_JQUERY(".masterMcWrap"),t=_MTS_JQUERY("body, html");e.removeClass("noScrolling"),t.removeClass("noScrolling"),null!=history&&null!=history.state&&void 0!==history.state.linkBack&&0<history.state.linkBack&&history.go(-1*history.state.linkBack)}function ChangeWhiteBoxImage(e){ToggleEdit(!1),_changingImage||null==e||(_changingImage=!0,_currentImage=e,_MTS_JQUERY(".whiteImgSrc").fadeTo(100,0,function(){DisplayWhiteBox(e,!0,function(){_changingImage=!1,sizePhoto()})}))}function OpenWhiteBox(e,t,i,a,n){null!=_slideShowTimer&&clearTimeout(_slideShowTimer),ToggleTagBox(!1),setTimeout(function(){_MTS_JQUERY(".whiteBackground").css("height",_MTS_JQUERY(document).height().toString()),_MTS_JQUERY(".whiteBackground").fadeTo(0,.8)},500),_MTS_JQUERY("#whiteBox").show(function(){_MTS_JQUERY("#whiteBox, .mediaTools").addClass("animateLeft"),_MTS_JQUERY(".mediaInterfaceWrapper").addClass("fixmia"),_MTS_JQUERY("body").addClass("noScrolling"),_MTS_JQUERY(window).width()<1024&&(_MTS_JQUERY("#whiteImage").outerHeight(),_MTS_JQUERY(".mediaTools").outerHeight(),_MTS_JQUERY(".filterIcon").addClass("imageCloseButton")),setTimeout(function(){sizePhoto()},0)},0),a&&_MTS_JQUERY("#whiteBox").data("stayOpen",!0),_isAlbum=!!i,DisplayWhiteBox(e,!0,sizePhoto,n)}function DisplayWhiteBox(n,e,o,t){null!=n&&(OverwriteUrl("photo-single/"+(0<(_currentImage=n).imageId?n.imageId:n.id)+"/"+(0<n.imageId?"":"?mode=team")),ShowWhiteLoader(),"true"===_MTS_JQUERY("input[name='mts_ilvDisableImages']").val()&&n.container<=0&&(t=!0),FillWhiteBox(n,function(){var e=_MTS_JQUERY(".whiteLeftArrow, .whiteRightArrow, .albumScroller, .asCtr");if(_selectedAlbum.images.length<=1)e.hide();else{e.show();e=_MTS_JQUERY(".albumScroller");if(0<e.length&&0==e.children().length||_reloadThumbnails){for(var t="",i=0,a=_selectedAlbum.images.length-1;i<=a;i++)t+="<div id='aic_"+_selectedAlbum.images[i].id+"' class='albumImageCtr "+(_selectedAlbum.images[i].id==n.id?"glow":"")+"'><img class='albumImage' src='"+(_selectedAlbum.images[i].container<=0?_MTS_MEDIAURL+"images/eventIcon.png":getImageLink(_selectedAlbum.images[i],0))+"' alt='' /></div>";e.html(t),AdjustSlider(1e3),_reloadThumbnails=!1}else _MTS_JQUERY(".albumImageCtr.glow").toggleClass("glow"),_MTS_JQUERY("#aic_"+n.id+".albumImageCtr").toggleClass("glow"),AdjustSlider(1e3)}_MTS_JQUERY.Query.notrack||"function"!=typeof trackItem||trackItem(0<n.imageId?n.imageId:n.id,"Image"),_MTS_JQUERY(".whiteLeftArrow, .whiteRightArrow").css("height","100%"),HideWhiteLoader(),_MTS_JQUERY(".white").fadeTo(100,1,function(){"function"==typeof o&&null!=o&&o()})},t))}function AdjustSlider(e){setTimeout(function(){var e=_MTS_JQUERY(".asCtr"),t=_MTS_JQUERY(".albumScroller"),i=_MTS_JQUERY(".albumImageCtr"),a=(_MTS_JQUERY(".albumImage"),_MTS_JQUERY(".white"),_MTS_JQUERY(".rightSideCtr"));i.css({height:e.outerHeight()+"px"}),t.css({height:e.outerHeight()+"px"}),i.css({width:i.outerHeight()}),t.css({width:i.outerWidth()*i.length+"px"}),_MTS_JQUERY(window).width()<768&&a.css({"padding-bottom":e.outerHeight()+"px"}),t.width()<_MTS_JQUERY(window).width()?t.addClass("mts_transform_left"):(t.removeClass("mts_transform_left"),_MTS_JQUERY(".asCtr").animate({scrollLeft:i.outerHeight()*_MTS_JQUERY(".albumImageCtr.glow").prevAll().length-e.outerWidth()/2+i.outerHeight()/2}))},e)}function ShowWhiteLoader(){_MTS_JQUERY("#whiteLoader").show()}function HideWhiteLoader(){_MTS_JQUERY("#whiteLoader").hide()}function InsertNewTag(e,t,i,a,n,o,l,r,_){if(""==r||""==n)return"";_MTS_JQUERY(".tagContainer").children("div[id!='currentTag']").remove();var d="";o||null!==_MTS_JQUERY("#currentTag").html()||(d+='<div class="currentTag" id="currentTag"><div class="currentTagLbl">Current Tags:</div> '),d+='<div id="tag_'+i+"_"+e+'" class="imageTag"><a title=\''+n+"' href=\""+r+'">'+n+"</a>";n="";"ScheduleEvent"===i?n=_MTS_JQUERY('#scheduleEntryResultsSelectBox option[value="'+e+'"]'):"Roster"==i?n=_MTS_JQUERY('#rosterTag option[value="'+e+'"]'):"NewsItem"==i&&(n=_MTS_JQUERY('#newsTag option[value="'+e+'"]')),""!=n&&n.attr("disabled","disabled");n=0<_MTS_JQUERY("#tagButton").length;_||o&&!n&&("number"!=typeof _userId||isNaN(_userId)||!(_userId===l||"boolean"==typeof _canUpdate&&_canUpdate))||(d+='<div id="tagDelete_'+t+'" title="Delete Tag" class="imageTagRem">x</div>'),d+="</div> ",o||null!==_MTS_JQUERY("#currentTag").html()||(d+="</div>");var u=0<_MTS_JQUERY("#whiteBox").length?_MTS_JQUERY._data(_MTS_JQUERY("#whiteBox")[0],"events"):void 0;if(null!=u)for(var s=(u=u.click).length,c=0;c<s;c++)if(u[c].selector==="#tagDelete_"+t)return d;return WireImageTag(t,e,a,i),d}function WireImageTag(e,t,i,a){_MTS_JQUERY("#whiteBox").delegate("#tagDelete_"+e,"click",function(){tagPrompt(e,t,i,a)})}function tagPrompt(n,o,e,l){var r=new PopupDialog;r.NewYesNoPrompt("Would you like to permanently delete this tag?","Are you sure?",null,function(e){!1!==e&&DeleteTag(_currentImage,n,function(e){if(e){_MTS_JQUERY("#tag_"+l+"_"+o).remove();e="";"ScheduleEvent"==l?e="#scheduleEntryResultsSelectBox":"Roster"==l?e="#rosterTag":"NewsItem"==l&&(e="#newsTag",_forceRefresh=!0),_MTS_JQUERY(e+' option[value="'+o+'"]').removeAttr("disabled");for(var t=_currentImage.links.length,i=-1,a=0;a<t;a++)if(_currentImage.links[a].tagId==n){i=a;break}0<=i&&(null!=_MTS_JQUERY("#rP_"+o)&&_MTS_JQUERY("#rP_"+o).find("#photo_"+n).parent().remove(),_currentImage.links.splice(i,1))}else r.Hide(),r.NewOkayAlert("An unknown error prevented us from deleting this tag at this time.","Error!")})})}function lightBoxEmailShare(e){var t=void 0!==e&&0<e,i="<div class='emailBg'><div class='emailTemplate' id='sendEmail'><div class='emailTempHead'>Share This "+(t?"Album":"Photo")+"</div>"+(0<_MTS_userId?"":"<input title='"+_lightBoxEmailFrom+"' type='text' class='emailTxt' id='emailFrom' value='"+_lightBoxEmailFrom+"' />")+"<input title='"+_lightBoxEmailReq+"' type='text' class='emailTxt' id='emailList' value='"+_lightBoxEmailReq+"' /><textarea class='emailTxtArea' id='emailMsg'>"+(t?_albumEmailMsg:_lightBoxEmailMsg)+"</textarea><div class='tempButtons'><div class='mts_cc_button tempButton' id='emailSend'>Send</div><input id='shareMode' type='hidden' value='"+(t?"photoAlbum":"photo")+"' /><div class='mts_cc_button tempButton' id='emailCancel'>Cancel</div></div></div></div>";_MTS_JQUERY("body").append(i),_MTS_JQUERY(".emailTempExit, .emailBg").click(function(){_MTS_JQUERY(".emailBg, .emailTemplate").remove()}),_MTS_JQUERY(".emailBg").show(),t&&(_curShareId=e)}function FillWhiteBox(e,t,i){var a="",n=e.links.length,o=getImageLink(e,2),l=_MTS_SITEURL+(_isAlbum&&void 0!==_selectedAlbum.url?_selectedAlbum.url:"photo-single/"+e.id+"/?mode=team");_MTS_JQUERY("#tagContainer").html(""),_MTS_JQUERY(".scheduleEntrySelect").removeAttr("disabled"),_MTS_JQUERY(".albumSelect").children().removeAttr("disabled");var r="";if(0<n){for(var a='<div class="currentTag" id="currentTag"><div class="currentTagLbl">Current Tags:</div> ',_=0;_<n;_++){var d=e.links[_];""==r&&"PhotoAlbum"==d.tagType&&(r=d.tagName),a+=InsertNewTag(d.linkId,d.tagId,d.tagType,d.scheduleId,d.tagName,!0,d.writerId,d.href,"boolean"==typeof e.isTagged)}a+="</div>",_MTS_JQUERY("#tagContainer").html(a)}_MTS_JQUERY(".whiteAlbumTitle").html(0<r.length?"<span style='font-weight: bold;'>Album: </span>"+r:""),_MTS_JQUERY("#whiteTitleNewValue").html(""),_MTS_JQUERY("#whiteTitle").html(e.title+(e.description&&0<e.description.length?"<br><br>"+e.description:"")),_MTS_JQUERY("#whiteBox #fbTitle").val(_isAlbum&&void 0!==_selectedAlbum.urlName?_selectedAlbum.urlName:e.title),_MTS_JQUERY("#whiteBox #fbImgDefault").val(o),_MTS_JQUERY("#whiteBox #fbLink").val(l),_MTS_JQUERY("#twitterPhotoShare").attr("href","https://twitter.com/intent/tweet?hashtags=mts&original_referer="+encodeURI(l)+"&text="+encodeURI(_isAlbum&&void 0!==_selectedAlbum.urlName?_selectedAlbum.urlName:e.title)+"&tw_p=tweetbutton&url="+encodeURI(l)),_curShareId=(_isAlbum&&void 0!==_selectedAlbum.Id?_selectedAlbum:e).id,_MTS_JQUERY("#whiteSummaryNewValue").html(""),void 0!==e.summ&&""!=e.summ?_MTS_JQUERY("#whiteSummary").html(e.summ):_MTS_JQUERY("#whiteSummary").html(""),_MTS_JQUERY("#whiteCreditEditText").html("");l=_MTS_JQUERY("#whiteCredit");""!=e.credit?(l.html(" Credit: "+e.credit),l.show()):l.hide(),_MTS_JQUERY("#photoEditFeatLink").html(""),void 0!==e.featuredUntil&&""!=e.featuredUntil?(u=new Date(e.featuredUntil),_MTS_JQUERY("#photoEditFeatLink").html(u.getMonth()+1+"/"+u.getDate()+"/"+u.getFullYear()),_MTS_JQUERY("#featureDate, #cancelFeatLink").show(),_MTS_JQUERY("#whiteSubmitButton").hide()):(_MTS_JQUERY("#photoEditFeatLink").html(""),_MTS_JQUERY("#featureDate, #cancelFeatLink").hide(),_MTS_JQUERY("#whiteSubmitButton").show());var u=_MTS_JQUERY("#buyPhoto, .buyTxt");if(e.container&&""!=e.container&&-1<parseInt(e.container)&&"undefined"!=typeof _activeContainer){for(var s="",c="",_=_activeContainer.portals.length-1;0<=_;_--)if(_activeContainer.portals[_].id==_currentImage.container){s=_activeContainer.portals[_].url,c=_activeContainer.portals[_].domain;break}""==s||""==c?u.hide():u.show()}else u.hide();ToggleTagBox(!1),void 0!==e.isTagged||"number"!=typeof _userId||isNaN(_userId)?(_MTS_JQUERY("#whiteCaptionEdit").hide(),_MTS_JQUERY("#whiteCreditEdit").hide()):(_userId===e.uploaderId||"boolean"==typeof _canUpdate&&_canUpdate?_MTS_JQUERY("#editImgShowBtn").show():_MTS_JQUERY("#editImgShowBtn").hide(),_userId===e.uploaderId||"boolean"==typeof _canDelete&&_canDelete?_MTS_JQUERY("#whiteImageDelete").show():_MTS_JQUERY("#whiteImageDelete").hide()),MTS_reloadWidget("i="+e.id.toString()+"&t=3","/ext/FancyFlag.aspx",null,"#whiteFlagButton"),MTS_reloadWidget("i="+e.id.toString()+"&t=3","/ext/FancyCheer.aspx",null,"#whiteCheerButton"),_MTS_JQUERY("#whiteImage").html("<div class='whiteLeftArrow'></div><div class='cropMarks'><div class='cmTopLeft'></div><div class='cmTopRight'></div><div class='cmBotRight'></div><div class='cmBotLeft'></div></div><img class='whiteImgSrc' src='"+o+"' alt='[Image]'"+(i?" style='display: none;' ":"")+"/><div class='whiteRightArrow'></div></div>"),_MTS_JQUERY("#downloadOriginal").bind("click",function(){window.open(`/api/downloadOriginalImage.aspx?id=${_currentImage.id}`,"_blank")}),_MTS_JQUERY(".whiteImgSrc").on("load",t),_MTS_JQUERY(".whiteImgSrc").on("error",function(){_MTS_JQUERY(this).attr("src",_MTS_MEDIAURL+"images/blockNoImg.png")})}function PositionWhite(e){var t=_MTS_JQUERY(window).height(),i=_MTS_JQUERY(window).scrollTop(),a=_MTS_JQUERY(".white").outerHeight(),n=_MTS_JQUERY(window).width()/2-_MTS_JQUERY(".white").outerWidth()/2,i=a<t?(t-a)/2+i:i;i<150&&(i=150),_MTS_JQUERY(".white").css({left:n+"px",top:i+"px"})}function GetNextImage(e){if(null==e)return null;e=GetImageByPosition(e.position+1);return e=null==e?_selectedAlbum.images[0]:e}function GetPreviousImage(e){if(null==e)return null;e=GetImageByPosition(e.position-1);return e=null==e?_selectedAlbum.images[_selectedAlbum.images.length-1]:e}function GetImageByPosition(e,t,i){var a=-1;if("string"==typeof e&&null!=e)a=parseInt(e,10);else{if("number"!=typeof e||null==e)return null;a=e}if(void 0!==t&&void 0!==i&&"undefined"!=typeof _MTS_album)for(var n=_MTS_album.length-1;0<=n;n--)if(_MTS_album[n].id==t&&_MTS_album[n].mode==i){0==_archivedAlbum.length&&"undefined"!=typeof _selectedAlbum&&(_archivedAlbum=_selectedAlbum),_selectedAlbum=_MTS_album[n],_reloadThumbnails=!0;break}for(n=0;n<_selectedAlbum.images.length;n++)if(_selectedAlbum.images[n].position===a)return _selectedAlbum.images[n];return null}function DeleteTag(e,t,i){var a=[];"object"==typeof e&&null!=e?(a.push({name:"itemId",value:e.id}),"undefined"!=typeof _teamId&&a.push({name:"teamId",value:_teamId}),a.push({name:"tagId",value:t}),a.push({name:"mode",value:"boolean"==typeof _isPortal&&null!=_isPortal&&_isPortal?"portalImage":"image"}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/deleteTags.aspx",a,function(e){"object"==typeof e&&null!=e||i(!1),"boolean"==typeof e.ok&&null!=e.ok||i(!1),"function"==typeof i&&null!=i&&i(e.ok)})):"function"==typeof i&&null!=i&&i(!1)}function DeleteImage(n,o){var e=[],l=[];"object"==typeof n&&null!=n?(e.push({name:"imageId",value:n.id}),"undefined"!=typeof _teamId&&e.push({name:"teamId",value:_teamId}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/deleteImage.aspx",e,function(e){if("object"==typeof e&&null!=e||o(!1),"boolean"==typeof e.ok&&null!=e.ok||o(!1),e.ok){for(var t=_selectedAlbum.images.length,i=0,a=0;a<t&&(a===n.position&&(i++,t--),!(t<i));a++)i>n.position&&_selectedAlbum.images[i].position--,l[a]=_selectedAlbum.images[i],i++;_selectedAlbum.images=null,_selectedAlbum.images=l}"function"==typeof o&&null!=o&&o(e.ok)})):"function"==typeof o&&null!=o&&o(!1)}function UpdateImageText(t,e,i,a,n){var o=null!=e&&null!=e&&0<e.length,l=null!=i&&null!=i&&0<i.length,r=null!=a&&null!=a&&0<a.length,_=[];l&&_.param("title",i),r&&_.param("summary",a),o&&_.param("credit",e),_.param("teamId","undefined"!=typeof _teamId?_teamId:-1),_.param("imageId",t.id),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/updateImage.aspx",_,function(e){e.ok&&(o&&(t.credit=e.credit,_MTS_JQUERY("#whiteCredit").text(0<t.credit.length?"Credit: "+t.credit:"")),l&&(t.title=e.title,_MTS_JQUERY("#whiteTitle").text(t.title)),r&&(t.summ=e.summary,_MTS_JQUERY("#whiteSummary").text(t.summ))),"function"==typeof n&&null!=n&&n(json.ok)})}function ToggleEdit(e){e?_MTS_JQUERY(".editImgCtr").show():(_MTS_JQUERY(".editImgCtr").hide(),_MTS_JQUERY(".imageInfoWrapper").show()),_MTS_JQUERY("#editCaptionWrap").css("display",$("#featureDate").css("display"))}function ToggleTagBox(e){e?((e=_MTS_JQUERY("#whiteTagButton").parent().parent()).find(".chosen-container").show(),e.find("#albumTag_chosen").hide(),_MTS_JQUERY(".albumSelect").val(-1),_MTS_JQUERY(".scheduleEntrySelect").val(-1),_MTS_JQUERY("#scheduleEntryResultsSelectBox_chosen").hide(),_MTS_JQUERY("#whiteTagButton").fadeTo(300,0,function(){_MTS_JQUERY("#whiteTagEditContainer").fadeTo(0,0),_MTS_JQUERY("#whiteTagEditContainer").show(),_MTS_JQUERY("#whiteTagEditContainer").fadeTo(300,1)})):_MTS_JQUERY("#whiteTagEditContainer").fadeTo(300,0,function(){_MTS_JQUERY("#whiteTagEditContainer").hide(),_MTS_JQUERY("#whiteTagButton").show(),_MTS_JQUERY("#whiteTagButton").fadeTo(300,1)})}function UpdateImageTag(g,m,h,T,S){var e=[];"object"!=typeof g||null==g||"string"!=typeof m&&"string"!=typeof h&&"string"!==T||null==m&&null==h&&null==T?"function"==typeof S&&null!=S&&S(!1):(e.push({name:"itemId",value:g.id}),e.push({name:"teamId",value:_teamId}),e.push({name:"seId",value:m}),e.push({name:"rId",value:h}),e.push({name:"nId",value:T}),e.push({name:"mode",value:"image"}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/updateTags.aspx",e,function(e){"object"==typeof e&&null!=e||S(!1),"boolean"==typeof e.ok&&null!=e.ok||S(!1);var t=e.tags;if(e.ok&&0<t.length)for(var i,a=-1,n=-1,o="",l="",r=0;r<t.length;r++){if("ScheduleEvent"==(i=t[r]).linkType){_MTS_JQUERY("#sE_"+m);for(var n=_MTS_JQUERY("#scheduleResult").val(),o=_MTS_JQUERY("#scheduleEntryResultsSelectBox option[value="+m+"]").html(),l="",a=m.toString(),_=0;_<o.split(" ").length-1;_++)l+=o.split(" ")[_],r<o.split(" ").length-2&&(l+=" ")}else"Roster"==i.linkType?(a=h.toString(),n=-1,l=_MTS_JQUERY("#rE_"+h).html(),null!=_MTS_JQUERY("#rP_"+h).val()&&rCPhotoInsert(h,e.tags[r].id,_currentImage.id)):"NewsItem"==i.linkType&&(a=T.toString(),n=-1,l=_MTS_JQUERY("#nI_"+T).html(),_forceRefresh=!0);var d=i.id,u=i.linkType,s=i.writerId,c=i.href;g.links.push({linkId:a,scheduleId:n,tagId:d,tagName:l,tagType:u,writerId:s,href:c});c=InsertNewTag(a,d,u,n,l,!1,0,c);(null===_MTS_JQUERY("#currentTag").html()?_MTS_JQUERY("#tagContainer"):_MTS_JQUERY("#currentTag")).append(c)}"function"==typeof S&&null!=S&&S(e.ok)}))}function StartImgCrop(){$("#cropImgOpts").show(),_MTS_previewImg=$(".whiteImgSrc");var e=getInitCords();_MTS_previewImg.imgAreaSelect({x1:e.x,y1:e.y,x2:e.x2,y2:e.y2,instance:!0,minWidth:50,minHeight:50,onSelectEnd:handleForm,persistent:!0,handles:!0}),adjustMarks()}function getInitCords(){var e=_MTS_previewImg.width(),t=_MTS_previewImg.height(),i=calculateGCD(_imageSizes.SiteWideMxH,_imageSizes.SiteWideMxW),a=!1;return 1<i&&(50<(i=calculateAspectRatioFit(_imageSizes.SiteWideMxW/i,_imageSizes.SiteWideMxH/i,e,t)).width&&50<i.height&&(e=Math.floor(i.width),t=Math.floor(i.height),a=!0)),a||(t=e=50),{x:0,y:0,x2:e,y2:t}}function calculateGCD(e,t){return t?calculateGCD(t,e%t):e}function calculateAspectRatioFit(e,t,i,a){a=Math.min(i/e,a/t);return{width:e*a,height:t*a}}function adjustMarks(){var e=_MTS_JQUERY(".cropMarks"),t=_MTS_JQUERY(".whiteImgSrc");e.css({width:t.outerWidth()+"px",height:t.outerHeight(),left:t.position().left+"px",top:t.position().top+"px",display:"block"})}function handleForm(e,t){updateCoords(t.x1,t.x2,t.y1,t.y2)}function updateCoords(e,t,i,a){_MTS_JQUERY('input[id="prevX1"]').val(e),_MTS_JQUERY('input[id="prevY1"]').val(i),_MTS_JQUERY('input[id="prevX2"]').val(t),_MTS_JQUERY('input[id="prevY2"]').val(a)}function ToggleNewTag(){_beforeUpload=!1,_MTS_JQUERY(".tagBtn").click(),_MTS_JQUERY(".uploadTagWrapper").addClass("showTagWrapper"),_MTS_sportsEnabled||_MTS_JQUERY(".filterColumn:not('#CategoryFilter,#SubcategoryFilter')").addClass("filterDisabled")}function CenterElement(e){var t,i,a,n=_MTS_JQUERY(e);0!==n.length&&(n[0].parentNode!==document.body&&(n[0].parentNode.removeChild(n[0]),document.body.appendChild(n[0])),i=_MTS_JQUERY(window).width(),t=_MTS_JQUERY(window).height(),a=n.outerWidth(),e=t/2-n.outerHeight()/2,t=i/2-a/2,i=_MTS_JQUERY(document).scrollTop(),a=_MTS_JQUERY(document).scrollLeft(),(e+=i)<150&&(e=150),n.css({left:(t+=a).toString()+"px",top:e.toString()+"px"}))}function WireUpTag(o,e,l){if(_beforeUpload){_tags.push(o),_tagsLinkType.push(l);for(var t=0;t<_wiredTags.length;t++)if(_wiredTags[t]==o)return;_wiredTags.push(o),_MTS_JQUERY("#tagAdd_"+o).hide()}else{setTimeout(function(){(0<_tags.length?_MTS_JQUERY(".uploadContent .tagContainer").children().last():_MTS_JQUERY(".uploadContent .tagContainer").children()).remove()},500);for(var i=_currentImage.links,t=i.length-1;0<=t;t--)if(i[t].linkId==o&&i[t].tagType==l)return!1;var a=[];a.push({name:"itemId",value:_currentImage.id}),a.push({name:"linkType",value:l}),a.push({name:"linkId",value:o}),a.push({name:"mode",value:"portalImage"}),_MTS_ajaxPending=!0,_MTS_JQUERY.getJSON(_MTS_SITEURL+"api/updateTags.aspx",a,function(e){if(e.ok){_MTS_JQUERY(".tagBlock").remove(),_MTS_JQUERY(".portalText").remove();var t=e.tags[0].id,i=e.tags[0].writerId,a=e.tags[0].href,n=e.tags[0].title;newTag={linkId:o,scheduleId:-1,tagId:t,tagName:n,tagType:l,writerId:i,href:a},_currentImage.links.push(newTag);i=InsertNewTag(o,e.tags[0].id,l,-1,n,!1,i,a),a=_MTS_JQUERY("#currentTag");if(0<a.length)return a.append(i),!1;_MTS_JQUERY("#tagContainer").html(i)}})}}function DeleteImagePopup(){var t=new PopupDialog;t.NewYesNoPrompt("Would you like to permanently delete this image?","Are you sure?",null,function(e){!1!==e&&DeleteImage(_currentImage,function(e){e?(_MTS_JQUERY("#photo_"+_currentImage.id).hide(),CloseWiteBox()):(t.Hide(),t.NewOkayAlert("An unknown error prevented us from deleting this image at this time.","Error!"))})})}function StartSlideShow(){_slideShowTimer=setTimeout(function(){var e;null==_currentImage||"none"===_MTS_JQUERY("#whiteBox").css("display")||null!=(e=GetNextImage(_currentImage))&&(ChangeWhiteBoxImage(e),StartSlideShow())},1e4)}function PauseSlideShow(){clearTimeout(_slideShowTimer)}function ResumeSlideShow(){clearTimeout(_slideShowTimer)}function StopSlideShow(){clearTimeout(_slideShowTimer)}function ResetSlideShow(){null!=_slideShowTimer&&(clearTimeout(_slideShowTimer),StartSlideShow())}function RewindSlideShow(){var e=GetImageByPosition(0);null!=e&&ChangeWhiteBoxImage(e)}function findSelectId(e,t,i){var a=-1;return t.each(function(){this.id!=e||"none"==this.parentNode.style.display||this.parentNode.id!=i&&this.parentNode.className!=i||(a=this.value)}),a}function GetIdFromThis(e,t){var i,a="";return"object"!=typeof e||null==e||"string"!=typeof t||null==t||"string"!=typeof(a=e.getAttribute("id"))||null==a||"string"!=typeof(i=a.substring(t.length))||null==i?"":i}function GetImageById(e,t){var i=-1;if("string"==typeof e&&null!=e)i=parseInt(e,10);else{if("number"!=typeof e||null==e)return null;i=e}for(var a=0;a<_selectedAlbum.images.length;a++)if(_selectedAlbum.images[a].id===i)return _selectedAlbum.images[a];return null}function OverwriteUrl(e,t){var i;void 0===t&&(t=!1),"undefined"==typeof _MTS_allowUrlOverwrite||!_MTS_allowUrlOverwrite||null!=history.state&&history.state.haltUpdate||(i=1,null==history.state||void 0===history.state.linkBack||isNaN(history.state.linkBack)||(i=history.state.linkBack+1),history.pushState({linkBack:i,haltUpdate:t},"",_MTS_SITEURL+e))}function ReplacePhotosAndContainer(e,t){void 0!==e&&(_selectedAlbum=e),void 0!==t&&(_activeContainer=t),_reloadThumbnails=!0}function highlightLightboxTags(){_MTS_JQUERY(".whiteTagContainer:visible .imageTag").each(function(){var e=_MTS_JQUERY(this).attr("id").split("_")[2],t=_MTS_JQUERY(this).attr("id").split("_")[1];_MTS_JQUERY(".result[href$='"+e+",\\'"+t+"\\')']").addClass("selectedTag")})}function sizePhoto(){var e=_MTS_JQUERY(".whiteBox"),t=_MTS_JQUERY(".imageInfoWrapper").height(),i=_MTS_JQUERY(".whiteAlbumTitle").height(),a=_MTS_JQUERY(".titleBuy").outerHeight(),n=_MTS_JQUERY(".asCtr").height(),o=_MTS_JQUERY(window).height(),n=o-(t+n+i+a),a=o-(t+i+a);e.css({height:o+"px"}),0<_MTS_JQUERY(".albumImageCtr").length?_MTS_JQUERY("#whiteImage").css({height:n+"px"}):_MTS_JQUERY("#whiteImage").css({height:a+"px"}),_MTS_JQUERY(".white").css({height:o-145+"px"}),"function"==typeof sizeWhiteBox&&sizeWhiteBox()}function _MTS_CloseUploadFunc(){_MTS_JQUERY.getJSON("/api/v1/portal/images/single?image_id="+_currentImage.id,function(e){_currentImage.credit=e.Credit,_currentImage.description=e.Description,_currentImage.title=e.Title,_currentImage.webActiveVersion=e.WebActiveVersion,_MTS_JQUERY(".whiteImgSrc").attr("src",getImageLink(_currentImage,2)),_MTS_JQUERY("#whiteTitle").html(e.Title+(e.Description&&0<e.Description.length?"<br><br>"+e.Description:""));var t=_MTS_JQUERY("#whiteCredit");""!=e.Credit?(t.html(" Credit: "+e.Credit),t.show()):t.hide()})}_MTS_widgetsReady?WireUpLightbox():_MTS_JQUERY(document).one("widgetsloaded",WireUpLightbox);
﻿function Slider(){this.parent=null,this.frames=[],this.callback=function(){},this.last=new Date,this.index=0,this.delay=0,this.drop=0,this.interval=-1}_MTS_JQUERY="undefined"==typeof _MTS_JQUERY?$:_MTS_JQUERY,Slider.prototype={addImage:function(i){this.imageList.push(i)},init:function(s,i,t,n,e,a,l){this.index=0,this.parent=s,this.callback=t,this.delay=1e3*i,this.drop=1.5*this.delay;var h="object"==typeof s,d=h?s:_MTS_JQUERY("#"+s);d.children().filter(function(){return this.id.match(/sli_frame_/)}).remove();for(var o,_,c,f,p,m=d.children(),t=0===_MTS_JQUERY("#featFoto").length?"#bigSlide":"#featFoto",i=(h||_MTS_JQUERY("#"+n),h?s:_MTS_JQUERY(t)),t=i.width()/("undefined"!=typeof _imageSizes?_imageSizes.SlideShowMxW/_imageSizes.SlideShowMxH:16/9),v=0;v<m.length;v++)_MTS_JQUERY(m[v]).css({display:"none"}),o="sli_frame_"+v,_=_MTS_JQUERY("<div id='"+o+"'></div>"),c=_MTS_JQUERY("<div class='whiteBoxTrigger'></div>"),!e&&"bigSlide"!==s||(p=v+"",c.on("click touchend",function(){OpenWhiteBox(GetImageByPosition(p,a,l))})),f=_MTS_JQUERY("<span style='display: inline-block; height: 100%; vertical-align: middle;'></span>"),m[v].src||null!=!_MTS_JQUERY(m[v]).attr("data-original")||(m[v].src=_MTS_JQUERY(m[v]).find(".ytImg").attr("src"),c="portalVideo"==m[v].className?_MTS_JQUERY("<a class='ytCon' href='"+m[v].href+"'><img class='ytPB' src='"+_MTS_MEDIAURL+"images/playBtn.png' /></a>"):_MTS_JQUERY("<div id='yt_"+_MTS_JQUERY(m[v]).find(".ytId").val()+"' class='ytThumb ytCon'><img class='ytPB' src='"+_MTS_MEDIAURL+"images/playBtn.png' /></div>")),r=_MTS_JQUERY("<img class='mts_lazy' data-original='"+(m[v].src||_MTS_JQUERY(m[v]).attr("data-original"))+"' alt='' />"),c.append(f),c.append(r),r.css({"max-width":"none","min-width":"100%","min-height":"100%","vertical-align":"middle",transform:"translateX(-50%)",position:"absolute",top:"0px",left:"50%"}),r.addClass("portraitCenter"),_.css({position:"absolute",top:"0px",left:0==v?"0px":"100%",width:"100%",height:"100%",display:"inline-block",overflow:"hidden"}),c.css({display:"block",width:"100%",height:"100%","text-align":"center"}),_.append(c),d.append(_),this.frames.push(o);i.height(t),_MTS_JQUERY(window).resize(function(){d.children();var i=0===_MTS_JQUERY("#featFoto").length?"#bigSlide":"#featFoto",t=(h||_MTS_JQUERY("#"+n),h?s:_MTS_JQUERY(i)),e=t.width(),i="undefined"!=typeof _imageSizes?_imageSizes.SlideShowMxW/_imageSizes.SlideShowMxH:16/9;t.height(e/i)});var u=this;_MTS_JQUERY(window).on("blur focus",function(i){if(_MTS_JQUERY(this).data("prevType")!=i.type)switch(i.type){case"blur":u.interval&&(clearInterval(u.interval),u.interval=null);break;case"focus":u.interval||(u.last=new Date,u.interval=setInterval(function(){u.timer()},u.delay))}_MTS_JQUERY(this).data("prevType",i.type)}),this.interval=setInterval(function(){u.timer()},this.delay)},kill:function(){clearInterval(this.interval)},timer:function(){var i,t=new Date;t-this.last>this.drop||(i=this.index++,this.index>=this.frames.length&&(this.index=0),this.index!=i&&(this.anim(i,this.index),this.last=t))},rev_timer:function(){var i,t=new Date;t-this.last>this.drop||(i=this.index--,this.index<0&&(this.index=this.frames.length-1),this.index!=i&&(this.rev_anim(i,this.index),this.last=t))},jump_to:function(i,t){var e;i!=t&&(e=new Date,(this.index=t)<i?this.rev_anim(i,t):this.anim(i,t),this.last=e)},anim:function(i,t){this.stop(i),this.stop(t),this.slide(i,0,-100,!1),this.slide(t,100,0,!0)},rev_anim:function(i,t){this.stop(i),this.stop(t),this.slide(i,0,100,!1),this.slide(t,-100,0,!0)},next:function(){clearInterval(this.interval),this.timer();var i=this;this.interval=setInterval(function(){i.timer()},this.delay)},previous:function(){clearInterval(this.interval),this.rev_timer();var i=this;this.interval=setInterval(function(){i.timer()},this.delay)},stop:function(i){null==this.frames[i]||i<0||_MTS_JQUERY(this.frames[i]).stop(!0,!0)},slide:function(i,t,e,s){var n,a;null==this.frames[i]||i<0||(a=(n=this).parent.parents(".photo_slider_widget,.featured_news_panel_widget"),_MTS_JQUERY(this.parent).find("#"+this.frames[i]).css("left",t+"%").animate({left:e+"%"},400,"swing",function(){n.last=new Date,s&&n.callback(i,a),setTimeout(function(){var i=$("img.mts_lazy");i.lazyload({failure_limit:i.length-1}),i.lazyload({event:"mts_lazy"})},0)}))}};
﻿(function ()
{
   var images = ".news_panel_widget #news .item .image";
   var sliders = [];
   if (_MTS_JQUERY(".featured_news_panel_widget #featuredContent").css("display") != "none")
   {
      _MTS_JQUERY(document).on("widgetsloaded", function ()
      {
         setTimeout(begin_slider, 0);
      });
   }
   else
   {
      _MTS_JQUERY("#msNews").click(function ()
      {
         begin_slider();
      });
   }

   _MTS_JQUERY(document).on("resetSlider", function ()
   {
      for (var i = sliders.length - 1; i >= 0; i--)
      {
         sliders[i].kill();
      }

      begin_slider();
   });

   function begin_slider()
   {
      var slideContainers = _MTS_JQUERY(".mts_widget #featuredContent");
      for (var i = slideContainers.length - 1; i >= 0; i--)
      {
         var slider = _MTS_JQUERY(slideContainers[i]);
         if (slider.find(".mts_slide_created").length > 0)
            continue;

         slider.append("<input type='hidden' class='mts_slide_created' />");

         slide = new Slider();
         slide.init(slider.find("#featFoto"), 10, slider_feature_cb, 'features', slider.parent().find(".usePhotoBox").val() == "True", slider.parent().find(".photoModeId").val(), slider.parent().find(".photoMode").val());
         sliders.push(slide);
         wireSlider(slideContainers[i], slide);
         slider_feature_cb(0, slider.parents(".photo_slider_widget, .featured_news_panel_widget"));
         _MTS_JQUERY("#featLink, .featSmall").dotdotdot();
      }

      $("img.mts_lazy").lazyload({
         failure_limit: $("img.mts_lazy").length - 1
      });
   }

   function wireSlider(slideContainer, slide)
   {
      _MTS_JQUERY(slideContainer).find("#bsLeft").off("click").click(function ()
      {
         slide.previous();
      });

      _MTS_JQUERY(slideContainer).find("#bsRight").off("click").click(function ()
      {
         slide.next();
      });

      if (typeof (_MTS_JQUERY().swipe) == "function")
      {
         _MTS_JQUERY(slideContainer).find("#featFoto").off("swipe").swipe(false, false, function (ret)
         {
            if (ret.directionX == "right")
               slide.previous();
            else
               slide.next();
         });
      }

      _MTS_JQUERY(slideContainer).find(".featBox").off("click").click(function ()
      {
         var thisId = this.id.split('_')[1];
         var prevId = _MTS_JQUERY(".selected")[0].id.split('_')[1];
         slide.jump_to(prevId, thisId);
      });
   }

   function slider_feature_cb(i, src)
   {
      var feat = src.find("#f" + i),
      t = feat.children(".t").html(),
      u = feat.children(".tUrl").val(),
      forceUrl = feat.children(".forceUrl").val(),
      featLink = src.find("#featLink"),
      link = _MTS_SITEURL + u;

      var sliFrame = src.find("#sli_frame_" + i + " a");
      if (sliFrame.attr("href") == "javascript:void(0);" || forceUrl == "True")
      {
         sliFrame.attr("href", link);
         featLink.attr('href', link);
      }

      src.find("#featPrev").html(feat.children(".b").html());
      featLink.html(t);
      var background = src.find("#featSty");
      if (t == null || t.length == 0)
         background.hide();
      else
         background.show();
      src.find(".selected").removeClass("selected");
      src.find("#featBox_" + i).addClass("selected");
   }
})();
﻿!function(a){function u(t){var n={},e=null;return"object"!=typeof t.originalEvent||"object"!=typeof t.originalEvent.touches||"object"!=typeof t.originalEvent.changedTouches?null:(0<t.originalEvent.touches.length&&(e=t.originalEvent.touches[0]),"object"!=typeof(e=0<t.originalEvent.changedTouches.length?t.originalEvent.changedTouches[0]:e)||"number"!=typeof e.pageX||null==e.pageX||"number"!=typeof e.pageY||null==e.pageY?null:(n.X=e.pageX,n.Y=e.pageY,n))}function r(t,n,e){try{var o=t-a(e).offset().left,i=n-a(e).offset().top;if(o<a(e).width()&&0<o&&i<a(e).height()&&0<i)return}catch(t){}return 1}a.fn.extend({swipe:function(n,e,o){var i=!1,a={},c="boolean"!=typeof n||n,s="boolean"!=typeof e||e;this.bind("touchstart",function(t){i=!0,a={};t=u(t);null!=t&&(i=!1,a.startX=t.X,a.startY=t.Y)}),this.bind("touchmove",function(t){t.preventDefault();t=u(t);null==t||i||!c&&r(t.X,t.Y,this)&&(i=!0)}),this.bind("touchend",function(t){t.preventDefault();t=u(t);null==t||i||(a.stopX=t.X,a.stopY=t.Y,a.distanceX=Math.abs(a.startX-a.stopX),a.distanceY=Math.abs(a.startY-a.stopY),!s&&r(a.stopX,a.stopY,this)||a.distanceX<40&&a.distanceY<40||(a.directionX=a.startX-a.stopX<0?"right":"left",a.directionY=a.startY-a.stopY<0?"down":"up",a.distanceX<40&&(a.directionX="n/a"),a.distanceY<40&&(a.directionY="n/a"),"function"==typeof n&&n(a),"function"==typeof e&&e(a),"function"==typeof o&&o(a)))})}})}(jQuery);
﻿(function ()
{
   var _hoverState = -1;
   var _interval;
   var _slideVal = 100;

   var _rated = false;
   var _rating = 0;
   var _newRate = 0;
   var _commentType = "user";

   var _teamId = -1;
   var _featChange = false;

   var _articleId = -1;
   var _mts_adCount = 1;

   _MTS_JQUERY(document).ready(function ()
   {
      var pfs = $("#previousStoryTitle");
      $(window).scroll(function ()
      {
         var ni = $("#newsItem");
         if (ni.length > 0) {
            var mctb = ni.offset().bottom;
            if ($(window).scrollTop() > mctb) {
               var pfs = $("#previousStoryTitle");
               pfs.css({ "top": mctb + "px" });
            }
         }
      });

      _MTS_JQUERY(document).on("click", "#previousStoryTitle, .storyArrowRight, .storyArrowLeft, #nextStoryTitle", function ()
      {
         var id = _MTS_JQUERY(this).attr("class").split("_")[1];
         history.pushState({}, "", _MTS_SITEURL + _MTS_JQUERY("#nsUrl_" + id).val());
         getStory(id);
      });

      _MTS_JQUERY(document).on("click", ".ytThumb", function ()
      {
         var vp = _MTS_JQUERY("#vidPlayer");

         if (vp.css("display") == "none")
         {
            var bg = _MTS_JQUERY(".bg");
            bg.height(_MTS_JQUERY(document).height());
            bg.show();

            vp.center();
            vp.fadeTo(600, 1, function ()
            {
               vp.show();
               _MTS_JQUERY(".videoPlayer").show();
            });
         }

         var videoId = "";
         for (var i = 1, j = this.id.split('_').length; i < j; i++)
            videoId += (i > 1 ? "_" : "") + this.id.split('_')[i];

         var vidTitle = _MTS_JQUERY.trim(_MTS_JQUERY("#vidTitle_" + videoId).html()),
         vidDesc = _MTS_JQUERY.trim(_MTS_JQUERY("#vidDesc_" + videoId).html()),
         vidAuth = _MTS_JQUERY.trim(_MTS_JQUERY("#vidAuth_" + videoId).val());

         if (typeof chkPlayer === "function" && chkPlayer != null)
            chkPlayer();

         playVideo(videoId);

         _MTS_JQUERY("#vidTitle").html(vidTitle);
         _MTS_JQUERY("#vidDesc").html(vidDesc);
         _MTS_JQUERY("#vidAuth").html(vidAuth.length > 0 ? vidAuth : "Unknown");
      });

      _MTS_JQUERY(document).on("click", "#closePlayer", function ()
      {
         stopVideo();

         var vp = _MTS_JQUERY("#vidPlayer");
         vp.fadeTo(600, 0, function ()
         {
            vp.hide();
            _MTS_JQUERY(".bg").hide();
         });
      });

      _MTS_JQUERY(document).on("click", "#editFeatLink", function ()
      {
         var self = this;
         getMiniCalendar("select", "Date Range", function (m, d, y)
         {
            var newdate = m.toString() + "/" + d.toString() + "/" + y.toString() + " 12:00 AM";
            displayFeatureImageSelectBox(newdate);
         }, _MTS_JQUERY.trim(self.innerHTML));
      });

      _MTS_JQUERY(document).on("click", "#cancelFeatLink", function ()
      {
         _MTS_JQUERY("#editFeatLink").html("Not Featured");
         _MTS_JQUERY(this).hide();
         _MTS_JQUERY("#featApply").show();
         ajax("/api/editfeatured.aspx", [{ name: 'id', value: _articleId }], function (ret)
         {
            _MTS_JQUERY("#featApply").hide();
         });
      });

      _MTS_JQUERY(document).on("click", ".photoThumb", function ()
      {
         var image = GetImageById(GetIdFromThis(this, "photo_"));
         OpenWhiteBox(image);
      });

      _MTS_JQUERY(document).on("click", "#tweetBtn", function ()
      {
         var params = [];
         params.push({ name: 'mode', value: 'twittershare'})
         params.push({ name: 'id', value: _articleId });

         ajax("/api/updateNewsTracking.aspx", params, function (ret){});
      });
      
      _MTS_JQUERY(document).on("click", "#fbShare", function ()
      {
         var params = [];
         params.push({ name: 'mode', value: 'facebookshare' })
         params.push({ name: 'id', value: _articleId });

         ajax("/api/updateNewsTracking.aspx", params, function (ret) { });
      });

      _MTS_JQUERY(document).on("click", "#followBtn", function ()
      {
         var params = [];
         params.push({ name: 'id', value: _articleId });
         params.push({ name: 'type', value: 'newsitem' });
         if (_MTS_JQUERY(".followIcon").attr("title") == "Unfollow")
            params.push({ name: 'mode', value: 'deltag' });
         else
            params.push({ name: 'mode', value: 'addtag' });

         ajax("/api/updateNotificationSettings.aspx", params, function (ret)
         {
            if (_MTS_JQUERY(".followIcon").attr("title") == "Unfollow")
               _MTS_JQUERY(".followIcon").attr("title", "Follow").attr("class", "far fa-user-check followIcon unfollowed");
            else
               _MTS_JQUERY(".followIcon").attr("title", "Unfollow").attr("class", "fas fa-user-check followIcon followed");
         });
      });
   });
   
   _MTS_JQUERY(document).on("widgetsloaded", fireWidgetsLoaded);

   _MTS_JQUERY(document).one("widgetsloaded", function ()
   {
      addInfoBox();
      trackItem(_articleId, "PortalNews");
      getComments();
      if (typeof (FB) == "object")
      {
         var fb_embed_post_template = '<div class="fb-post" data-href="{embed_post_url}" data-width="{embed_post_width}"></div>';
         var embedPost = false;
         _MTS_JQUERY.each(_MTS_JQUERY('.FacebookEmbedPost'), function (index, value)
         {
            embedPost = fb_embed_post_template.replace("{embed_post_url}", _MTS_JQUERY(value).data('post')).replace("{embed_post_width}", _MTS_JQUERY(value).data('width'));
            _MTS_JQUERY(this).replaceWith(embedPost);
         });
         FB.XFBML.parse();
      }

      _cal.initialize();
      _cal.centerMiniCal();

      _MTS_JQUERY("#back").click(function ()
      {
         if (window.history.length > 1)
            BackAndRefresh();
         else
            window.close();
      });

      _MTS_JQUERY("#rater").mousemove(function (e)
      {
         _newRate = Math.ceil((e.pageX - (_MTS_JQUERY("#mainContent").offset().left + this.offsetLeft)) / 20);
         if (_newRate > 5)
            _newRate = 5;
         else if (_newRate < 1)
            _newRate = 1;

         _MTS_JQUERY(".gold_stars").css('width', '' + (_newRate * 20) + 'px');
      }).hover(function () { /* nothing */ }, function ()
      {
         _MTS_JQUERY(".gold_stars").css('width', '' + _rating + 'px');
      }).click(function ()
      {
         _rating = _newRate * 20;

         var params = [];
         params.push({ name: 'id', value: _articleId });
         params.push({ name: 'r', value: _newRate });

         ajax("/api/rateArticle.aspx", params, function (ret)
         {
            var o;
            eval("o = " + ret);

            if (o.rCount > 0)
            {
               _MTS_JQUERY("#user_score").html((o.rTotal / o.rCount).toFixed(2));
               _MTS_JQUERY(".count").html("(" + o.rCount + " ratings)");
            }
            _MTS_JQUERY(".user_rat").show();
         });
      });

      if (_rated)
         _MTS_JQUERY(".gold_stars").css('width', '' + _rating + 'px');

      _MTS_JQUERY("#vidPlayer, .bg").appendTo("body");

      _MTS_JQUERY("#thisButtonWillActivateVideoPlayer").click(function ()
      {
         var vp = _MTS_JQUERY("#vidPlayer");

         if (vp.css("display") == "none")
         {
            var bg = _MTS_JQUERY(".bg");
            bg.height(_MTS_JQUERY(document).height());
            bg.show();

            vp.center();
            vp.fadeTo(600, 1, function ()
            {
               vp.show();
               _MTS_JQUERY(".videoPlayer").show();
            });
         }
      });

      if (_MTS_JQUERY.slider)
      {
         _MTS_JQUERY("#vidScroller").slider(
         {
            create: vidMenu,
            orientation: "vertical",
            slide: vidMenu,
            min: 0, max: 100,
            value: 100
         });
      }

      _MTS_JQUERY(".vidHover").hover(function ()
      {
         var dir = this.id,
         _slideVal = _MTS_JQUERY("#vidScroller").slider("option", "value");

         if (_interval > 0)
            clearInterval(_interval);

         if (dir == "vidDown")
         {
            _hoverState = 0;

            _interval = setInterval(function ()
            {
               if (_hoverState == 0 && _slideVal > 0)
               {
                  _slideVal = _slideVal - 1;
                  VidHoverMenu(_slideVal);
               }
               else
                  clearInterval(_interval);
            }, 10);
         }
         else
         {
            _hoverState = 1;

            _interval = setInterval(function ()
            {
               if (_hoverState == 1 && _slideVal < 100)
               {
                  _slideVal = _slideVal + 1;
                  VidHoverMenu(_slideVal);
               }
               else
                  clearInterval(_interval);
            }, 10);
         }
      });

      _MTS_JQUERY(".vidHover").mouseout(function ()
      {
         _hoverState = -1;
         clearInterval(_interval);
      });

      _MTS_JQUERY(window).onresize = function ()
      {
         sirsz();
      };

      if (typeof (emailShare) != "function")
         _MTS_JQUERY(".mts_widget .shareBtn, .mts_widget .shareTitle").hide();
   });

   function runAd()
   {
      if (typeof (_MTS_PARA_AD) !== "undefined" && typeof googletag !== 'undefined')
      {
         var para_ad = parseInt(_MTS_PARA_AD);
         if (!isNaN(para_ad) && para_ad >= 0 && (_MTS_ITEM_ADS.length > 0 || _MTS_ITEM_ADS_MOBILE.length > 0))
         {
            var paragraphs = _MTS_JQUERY(".news_content_widget .body p");
            var paraAdIdx = -1;
            var paraAdPlace = -1;

            // if we find any tables in the story do not attempt to place ad
            if (paragraphs.parents("table").length > 0)
               return false;

            for (var i = 0, j = paragraphs.length - 1; i < j; i++)
            {
               var text = _MTS_JQUERY.trim(paragraphs[i].innerHTML);
               if (_MTS_JQUERY("<p/>").append(text).text().length > 20 || text.length > 100)
               {
                  paraAdIdx++;
                  paraAdPlace++;
                  if (paraAdPlace >= para_ad)
                     break;
               }
               else
                  paraAdIdx++;
            }

            if (paraAdPlace >= para_ad && paragraphs.length > paraAdIdx)
            {
               var id = "mts_ad_" + new Date().getTime(),
                  adBuilder = _MTS_JQUERY("<div id='" + id + "' class='borderedAd'></div>");

               var target = _MTS_JQUERY(paragraphs[paraAdIdx]);
               if (target.length > 0 && (!target.next() || !target.next().attr("id") || !target.next().attr("id").startsWith("mts_ad")))
               {
                  target.after(adBuilder);
                  ad = _MTS_ITEM_ADS[0] || { "width": 0, "height": 0 };
                  mobileAd = _MTS_ITEM_ADS_MOBILE[0] || { "width": 0, "height": 0 };

                  if (ad.location.indexOf("widget_") >= 0)
                  {
                     adBuilder.append("<div class='custom_widget'><input name='widgetName' type='hidden' value='" + ad.location.split('_')[1] + "' /></div></div>");
                  }
                  else
                  {
                     var mapping = googletag.sizeMapping().
                        addSize([0, 0], [mobileAd.width, mobileAd.height]).
                        addSize([1024, 768], [ad.width, ad.height]).
                        build();

                     var slot = googletag.defineSlot(ad.location, [ad.width ? ad.width : 300, ad.height ? ad.height : 250], id);
                     if (slot)
                     {
                        slot.defineSizeMapping(mapping)
                           .setTargeting(ad.target, ad.target2)
                           .setCollapseEmptyDiv(true)
                           .addService(googletag.pubads());
                        googletag.display(id);
                     }
                  }

                  _mts_adCount++;
               }
            }
         }
      }
   }

   function /*void*/vidMenu(event, ui)
   {
      var rp = _MTS_JQUERY(".videos"),
      height = rp[0].scrollHeight - rp[0].clientHeight;
      rp.scrollTop(height - (height * (ui.value / 100)));

      _slideVal = ui.value;
   }

   function getMiniCalendar(mode, title, callback, selected)
   {
      var dte = new Date();
      sDate = new Date(selected);

      if (sDate == "Invalid Date")
         sDate = new Date();

      _cal.clearRecycle();
      _cal.mode = mode;
      _cal.wndTitle = title;
      _cal.setContract(sDate.getFullYear(), 0, 0);
      _cal.maxYear = (_cal.startContractYear + 5);
      _cal.setCallback(callback);

      _cal.setSelection(sDate.getMonth() + 1, sDate.getDate(), sDate.getFullYear());
      _cal.show(100, 100);

      _MTS_JQUERY(".listingBg").css({ "height": _MTS_JQUERY(document).height(), "zIndex": 113 });
      _MTS_JQUERY(".listingBg").show();
   }

   function /*void*/getComments()
   {
      if (typeof (loadComments) != "function")
      {
         setTimeout(getComments, 250);
      }
      else
      {
         if (typeof _articleId === "undefined" || _articleId < 1)
            _articleId = _MTS_JQUERY("#MTS_STORY_ID").val();
         var prms = [];
         prms.push({ name: "newsId", value: _articleId });
         prms.push({ name: "currIdx", value: 0 });
         prms.push({ name: "commentType", value: _commentType });
         prms.push({ name: "type", value: 1 });
         loadComments(prms, _articleId, 0);
      }
   }

   function sirsz()
   {
      var img = _MTS_JQUERY("#story .body img");
      var sw = _MTS_JQUERY(".storyWrapper");
      if (sw.width() <= img.width())
      {
         img.css({ "width": "100%" });
      }
   }

   function fireWidgetsLoaded()
   {
      _articleId = _MTS_JQUERY("#MTS_STORY_ID").val();

      if (!_rated)
         _MTS_JQUERY(".user_rat").hide();
      else
         _MTS_JQUERY(".user_rat").show();

      sirsz();
      MTS_updateRegionCss();
      MTS_updateColumnCss();
      runAd();
   }

   function getStory(id)
   {
      var nextId = 0, prevId = 0;
      var currentTarget = _MTS_JQUERY("#delPN_" + id);
      if (currentTarget.length > 0)
      {
         // look at previous to find next story in succession
         var next = _MTS_JQUERY(currentTarget.parent().parent().prevAll(".item")[0]);
         if (next.length > 0)
         {
            nextId = next.find(".delPNBtn").attr("id").split('_')[1];
            if (currentTarget.parent().parent().next(".item").prevAll(".item").length == 0)
               next.parents(".news_panel_widget").find(".showMore").click();
         }

         // look at next to find previous story in succession
         var prev = _MTS_JQUERY(currentTarget.parent().parent().nextAll(".item")[0]);
         if (prev.length > 0)
            prevId = prev.find(".delPNBtn").attr("id").split('_')[1];
      }

      var params = [];
      params.push({ name: "id", value: id });
      params.push({ name: "nextId", value: nextId });
      params.push({ name: "prevId", value: prevId });

      ajax("/api/getPortalNewsContent.aspx", params, function (response)
      {
         _MTS_JQUERY(window).off("scroll");
         var target = _MTS_JQUERY("#newsItem");
         target.empty();
         target.html(response);

         _MTS_waitingOnLoad = [];
         _MTS_widgetsReady = false;
         _archivedAlbum = [];
         MTS_loadWidgets();
         if (typeof googletag !== 'undefined')
            googletag.pubads().refresh();

         if (typeof (adjustNoUserPrompt) !== 'undefined')
            adjustNoUserPrompt();

         if (nextId <= 0 && prevId <= 0)
            window.scrollTo(0, 0);

         trackItem(id, "PortalNews");

         _MTS_JQUERY(document).one("scroll", getComments);

         _MTS_JQUERY(document).one("widgetsloaded", function ()
         {
            _MTS_JQUERY(document).trigger("resetSlider");
            addInfoBox();
         });
      });
   }

   function addInfoBox()
   {
      if (typeof (_info_box) != "undefined" && _info_box != null && _info_box.DataValue != "undefined" && _info_box.DataValue.length > 0)
      {
         var paragraphs = _MTS_JQUERY(".storyWrapper p");
         var location = _info_box.WebParagraphLocation;
         var infoBox = _MTS_JQUERY("<div>");
         infoBox.attr("class", "mts_infoBox");

         var input = _info_box.DataValue;
         input = anchorme({
            input,
            options: {
               attributes: function (string)
               {
                  const attributes = {
                     target: "_blank"
                  };
                  return attributes;
               }
            }
         });

         infoBox.html(input);

         if (_info_box.WebBackgroundColor != null && _info_box.WebBackgroundColor.length > 0)
            infoBox.css("backgroundColor", "#" + _info_box.WebBackgroundColor);

         if (_info_box.WebFontColor != null && _info_box.WebFontColor.length > 0)
            infoBox.css("color", "#" + _info_box.WebFontColor);

         if (_info_box.WebFont != null && _info_box.WebFont.length > 0)
            infoBox.css("fontFamily", _info_box.WebFont);

         infoBox.css("float", _info_box.WebLocation > 0 ? _webLocation[_info_box.WebLocation] : "left");

         if (location <= 1)
            _MTS_JQUERY(paragraphs[0]).prepend(infoBox);
         else if (location - 1 < paragraphs.length)
            _MTS_JQUERY(paragraphs[location - 1]).prepend(infoBox);
         else
            _MTS_JQUERY(paragraphs[paragraphs.length - 1]).prepend(infoBox);
      }
   }

   function displayFeatureImageSelectBox(date)
   {
      var p = [];

      p.push({ name: "newsId", value: _articleId });

      var popup = new PopupDialog();
      popup.NewCustomDialog("", "Select an image to feature", function ()
      {
         var popupId = popup.GetPopupId();
         popup.AddElement("divWithClass", "", null, null, "featureImageCtr");
         popup.AddButton("Save", saveFeatureImage, date);

         popup.AddButton("Cancel", hidePopup);

         popup.Show();

         ajax("/api/getFeatureImageSelectBox.aspx", p, function (r)
         {
            _MTS_JQUERY(".featureImageCtr").html(r);

            if (_isFeatured)
               _MTS_JQUERY("#popUpDialog_" + popupId + " #image_" + _featureImageId).addClass("photoBlockSelected");

               _MTS_JQUERY("#popUpDialog_" + popupId + " .photoBlock").click(function ()
               {
                  _MTS_JQUERY(".photoBlock").removeClass("photoBlockSelected");
                  _MTS_JQUERY(this).addClass("photoBlockSelected");
               });

            var phb = _MTS_JQUERY("#popUpDialog_" + popupId + " .photoBlock");
            phb.css({ "height": phb.outerWidth() + "px" });
         });
      }, hidePopup, null);
   }

   function saveFeatureImage(popup, controlData, date)
   {
      var selectedImage = _MTS_JQUERY(".photoBlockSelected");

      if (selectedImage.length > 0)
      {
         _featureImageId = parseInt(selectedImage.attr("id").split('_')[1]);
         hidePopup(popup);

         featureNews(date);

         _isFeatured = true;
         _MTS_JQUERY("#selectFeatureImage").show();
      }
   }

   function featureNews(date)
   {
      var params = [];

      _MTS_JQUERY("#editFeatLink").html(date);

      params.push({ name: 'id', value: _articleId });
      params.push({ name: 'til', value: date });
      params.push({ name: 'featureImageId', value: _featureImageId });

      _MTS_JQUERY("#featApply").show();
      ajax("/api/editfeatured.aspx", params, function (ret)
      {
         _MTS_JQUERY("#featApply").hide();

         var cFL = _MTS_JQUERY("#cancelFeatLink")

         if (cFL.length == 0)
         {
            var cLink = "<a title='Cancel' id='cancelFeatLink' href='javascript:void(0);'>Cancel</a>";
            _MTS_JQUERY("#editFeatLink").parent().append(cLink);
         }
         else
            cFL.show();
      });
   }

   function hidePopup(popup)
   {
      popup.Hide();
   }
})();
﻿!function (A, u) { "object" == typeof exports && "undefined" != typeof module ? module.exports = u() : "function" == typeof define && define.amd ? define(u) : (A = A || self).anchorme = u() }(this, function () { "use strict"; var t = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}; function A(A) { return A && A.__esModule && Object.prototype.hasOwnProperty.call(A, "default") ? A.default : A } function u(A, u) { return A(u = { exports: {} }, u.exports), u.exports } var N = u(function (A, u) { Object.defineProperty(u, "__esModule", { value: !0 }), u.TLDs = "(AAA|AARP|ABARTH|ABB|ABBOTT|ABBVIE|ABC|ABLE|ABOGADO|ABUDHABI|AC|ACADEMY|ACCENTURE|ACCOUNTANT|ACCOUNTANTS|ACO|ACTOR|AD|ADAC|ADS|ADULT|AE|AEG|AERO|AETNA|AF|AFAMILYCOMPANY|AFL|AFRICA|AG|AGAKHAN|AGENCY|AI|AIG|AIGO|AIRBUS|AIRFORCE|AIRTEL|AKDN|AL|ALFAROMEO|ALIBABA|ALIPAY|ALLFINANZ|ALLSTATE|ALLY|ALSACE|ALSTOM|AM|AMERICANEXPRESS|AMERICANFAMILY|AMEX|AMFAM|AMICA|AMSTERDAM|ANALYTICS|ANDROID|ANQUAN|ANZ|AO|AOL|APARTMENTS|APP|APPLE|AQ|AQUARELLE|AR|ARAB|ARAMCO|ARCHI|ARMY|ARPA|ART|ARTE|AS|ASDA|ASIA|ASSOCIATES|AT|ATHLETA|ATTORNEY|AU|AUCTION|AUDI|AUDIBLE|AUDIO|AUSPOST|AUTHOR|AUTO|AUTOS|AVIANCA|AW|AWS|AX|AXA|AZ|AZURE|BA|BABY|BAIDU|BANAMEX|BANANAREPUBLIC|BAND|BANK|BAR|BARCELONA|BARCLAYCARD|BARCLAYS|BAREFOOT|BARGAINS|BASEBALL|BASKETBALL|BAUHAUS|BAYERN|BB|BBC|BBT|BBVA|BCG|BCN|BD|BE|BEATS|BEAUTY|BEER|BENTLEY|BERLIN|BEST|BESTBUY|BET|BF|BG|BH|BHARTI|BI|BIBLE|BID|BIKE|BING|BINGO|BIO|BIZ|BJ|BLACK|BLACKFRIDAY|BLOCKBUSTER|BLOG|BLOOMBERG|BLUE|BM|BMS|BMW|BN|BNPPARIBAS|BO|BOATS|BOEHRINGER|BOFA|BOM|BOND|BOO|BOOK|BOOKING|BOSCH|BOSTIK|BOSTON|BOT|BOUTIQUE|BOX|BR|BRADESCO|BRIDGESTONE|BROADWAY|BROKER|BROTHER|BRUSSELS|BS|BT|BUDAPEST|BUGATTI|BUILD|BUILDERS|BUSINESS|BUY|BUZZ|BV|BW|BY|BZ|BZH|CA|CAB|CAFE|CAL|CALL|CALVINKLEIN|CAM|CAMERA|CAMP|CANCERRESEARCH|CANON|CAPETOWN|CAPITAL|CAPITALONE|CAR|CARAVAN|CARDS|CARE|CAREER|CAREERS|CARS|CASA|CASE|CASEIH|CASH|CASINO|CAT|CATERING|CATHOLIC|CBA|CBN|CBRE|CBS|CC|CD|CEB|CENTER|CEO|CERN|CF|CFA|CFD|CG|CH|CHANEL|CHANNEL|CHARITY|CHASE|CHAT|CHEAP|CHINTAI|CHRISTMAS|CHROME|CHURCH|CI|CIPRIANI|CIRCLE|CISCO|CITADEL|CITI|CITIC|CITY|CITYEATS|CK|CL|CLAIMS|CLEANING|CLICK|CLINIC|CLINIQUE|CLOTHING|CLOUD|CLUB|CLUBMED|CM|CN|CO|COACH|CODES|COFFEE|COLLEGE|COLOGNE|COM|COMCAST|COMMBANK|COMMUNITY|COMPANY|COMPARE|COMPUTER|COMSEC|CONDOS|CONSTRUCTION|CONSULTING|CONTACT|CONTRACTORS|COOKING|COOKINGCHANNEL|COOL|COOP|CORSICA|COUNTRY|COUPON|COUPONS|COURSES|CPA|CR|CREDIT|CREDITCARD|CREDITUNION|CRICKET|CROWN|CRS|CRUISE|CRUISES|CSC|CU|CUISINELLA|CV|CW|CX|CY|CYMRU|CYOU|CZ|DABUR|DAD|DANCE|DATA|DATE|DATING|DATSUN|DAY|DCLK|DDS|DE|DEAL|DEALER|DEALS|DEGREE|DELIVERY|DELL|DELOITTE|DELTA|DEMOCRAT|DENTAL|DENTIST|DESI|DESIGN|DEV|DHL|DIAMONDS|DIET|DIGITAL|DIRECT|DIRECTORY|DISCOUNT|DISCOVER|DISH|DIY|DJ|DK|DM|DNP|DO|DOCS|DOCTOR|DOG|DOMAINS|DOT|DOWNLOAD|DRIVE|DTV|DUBAI|DUCK|DUNLOP|DUPONT|DURBAN|DVAG|DVR|DZ|EARTH|EAT|EC|ECO|EDEKA|EDU|EDUCATION|EE|EG|EMAIL|EMERCK|ENERGY|ENGINEER|ENGINEERING|ENTERPRISES|EPSON|EQUIPMENT|ER|ERICSSON|ERNI|ES|ESQ|ESTATE|ESURANCE|ET|ETISALAT|EU|EUROVISION|EUS|EVENTS|EXCHANGE|EXPERT|EXPOSED|EXPRESS|EXTRASPACE|FAGE|FAIL|FAIRWINDS|FAITH|FAMILY|FAN|FANS|FARM|FARMERS|FASHION|FAST|FEDEX|FEEDBACK|FERRARI|FERRERO|FI|FIAT|FIDELITY|FIDO|FILM|FINAL|FINANCE|FINANCIAL|FIRE|FIRESTONE|FIRMDALE|FISH|FISHING|FIT|FITNESS|FJ|FK|FLICKR|FLIGHTS|FLIR|FLORIST|FLOWERS|FLY|FM|FO|FOO|FOOD|FOODNETWORK|FOOTBALL|FORD|FOREX|FORSALE|FORUM|FOUNDATION|FOX|FR|FREE|FRESENIUS|FRL|FROGANS|FRONTDOOR|FRONTIER|FTR|FUJITSU|FUJIXEROX|FUN|FUND|FURNITURE|FUTBOL|FYI|GA|GAL|GALLERY|GALLO|GALLUP|GAME|GAMES|GAP|GARDEN|GAY|GB|GBIZ|GD|GDN|GE|GEA|GENT|GENTING|GEORGE|GF|GG|GGEE|GH|GI|GIFT|GIFTS|GIVES|GIVING|GL|GLADE|GLASS|GLE|GLOBAL|GLOBO|GM|GMAIL|GMBH|GMO|GMX|GN|GODADDY|GOLD|GOLDPOINT|GOLF|GOO|GOODYEAR|GOOG|GOOGLE|GOP|GOT|GOV|GP|GQ|GR|GRAINGER|GRAPHICS|GRATIS|GREEN|GRIPE|GROCERY|GROUP|GS|GT|GU|GUARDIAN|GUCCI|GUGE|GUIDE|GUITARS|GURU|GW|GY|HAIR|HAMBURG|HANGOUT|HAUS|HBO|HDFC|HDFCBANK|HEALTH|HEALTHCARE|HELP|HELSINKI|HERE|HERMES|HGTV|HIPHOP|HISAMITSU|HITACHI|HIV|HK|HKT|HM|HN|HOCKEY|HOLDINGS|HOLIDAY|HOMEDEPOT|HOMEGOODS|HOMES|HOMESENSE|HONDA|HORSE|HOSPITAL|HOST|HOSTING|HOT|HOTELES|HOTELS|HOTMAIL|HOUSE|HOW|HR|HSBC|HT|HU|HUGHES|HYATT|HYUNDAI|IBM|ICBC|ICE|ICU|ID|IE|IEEE|IFM|IKANO|IL|IM|IMAMAT|IMDB|IMMO|IMMOBILIEN|IN|INC|INDUSTRIES|INFINITI|INFO|ING|INK|INSTITUTE|INSURANCE|INSURE|INT|INTEL|INTERNATIONAL|INTUIT|INVESTMENTS|IO|IPIRANGA|IQ|IR|IRISH|IS|ISMAILI|IST|ISTANBUL|IT|ITAU|ITV|IVECO|JAGUAR|JAVA|JCB|JCP|JE|JEEP|JETZT|JEWELRY|JIO|JLL|JM|JMP|JNJ|JO|JOBS|JOBURG|JOT|JOY|JP|JPMORGAN|JPRS|JUEGOS|JUNIPER|KAUFEN|KDDI|KE|KERRYHOTELS|KERRYLOGISTICS|KERRYPROPERTIES|KFH|KG|KH|KI|KIA|KIM|KINDER|KINDLE|KITCHEN|KIWI|KM|KN|KOELN|KOMATSU|KOSHER|KP|KPMG|KPN|KR|KRD|KRED|KUOKGROUP|KW|KY|KYOTO|KZ|LA|LACAIXA|LAMBORGHINI|LAMER|LANCASTER|LANCIA|LAND|LANDROVER|LANXESS|LASALLE|LAT|LATINO|LATROBE|LAW|LAWYER|LB|LC|LDS|LEASE|LECLERC|LEFRAK|LEGAL|LEGO|LEXUS|LGBT|LI|LIDL|LIFE|LIFEINSURANCE|LIFESTYLE|LIGHTING|LIKE|LILLY|LIMITED|LIMO|LINCOLN|LINDE|LINK|LIPSY|LIVE|LIVING|LIXIL|LK|LLC|LLP|LOAN|LOANS|LOCKER|LOCUS|LOFT|LOL|LONDON|LOTTE|LOTTO|LOVE|LPL|LPLFINANCIAL|LR|LS|LT|LTD|LTDA|LU|LUNDBECK|LUPIN|LUXE|LUXURY|LV|LY|MA|MACYS|MADRID|MAIF|MAISON|MAKEUP|MAN|MANAGEMENT|MANGO|MAP|MARKET|MARKETING|MARKETS|MARRIOTT|MARSHALLS|MASERATI|MATTEL|MBA|MC|MCKINSEY|MD|ME|MED|MEDIA|MEET|MELBOURNE|MEME|MEMORIAL|MEN|MENU|MERCKMSD|METLIFE|MG|MH|MIAMI|MICROSOFT|MIL|MINI|MINT|MIT|MITSUBISHI|MK|ML|MLB|MLS|MM|MMA|MN|MO|MOBI|MOBILE|MODA|MOE|MOI|MOM|MONASH|MONEY|MONSTER|MORMON|MORTGAGE|MOSCOW|MOTO|MOTORCYCLES|MOV|MOVIE|MP|MQ|MR|MS|MSD|MT|MTN|MTR|MU|MUSEUM|MUTUAL|MV|MW|MX|MY|MZ|NA|NAB|NAGOYA|NAME|NATIONWIDE|NATURA|NAVY|NBA|NC|NE|NEC|NET|NETBANK|NETFLIX|NETWORK|NEUSTAR|NEW|NEWHOLLAND|NEWS|NEXT|NEXTDIRECT|NEXUS|NF|NFL|NG|NGO|NHK|NI|NICO|NIKE|NIKON|NINJA|NISSAN|NISSAY|NL|NO|NOKIA|NORTHWESTERNMUTUAL|NORTON|NOW|NOWRUZ|NOWTV|NP|NR|NRA|NRW|NTT|NU|NYC|NZ|OBI|OBSERVER|OFF|OFFICE|OKINAWA|OLAYAN|OLAYANGROUP|OLDNAVY|OLLO|OM|OMEGA|ONE|ONG|ONL|ONLINE|ONYOURSIDE|OOO|OPEN|ORACLE|ORANGE|ORG|ORGANIC|ORIGINS|OSAKA|OTSUKA|OTT|OVH|PA|PAGE|PANASONIC|PARIS|PARS|PARTNERS|PARTS|PARTY|PASSAGENS|PAY|PCCW|PE|PET|PF|PFIZER|PG|PH|PHARMACY|PHD|PHILIPS|PHONE|PHOTO|PHOTOGRAPHY|PHOTOS|PHYSIO|PICS|PICTET|PICTURES|PID|PIN|PING|PINK|PIONEER|PIZZA|PK|PL|PLACE|PLAY|PLAYSTATION|PLUMBING|PLUS|PM|PN|PNC|POHL|POKER|POLITIE|PORN|POST|PR|PRAMERICA|PRAXI|PRESS|PRIME|PRO|PROD|PRODUCTIONS|PROF|PROGRESSIVE|PROMO|PROPERTIES|PROPERTY|PROTECTION|PRU|PRUDENTIAL|PS|PT|PUB|PW|PWC|PY|QA|QPON|QUEBEC|QUEST|QVC|RACING|RADIO|RAID|RE|READ|REALESTATE|REALTOR|REALTY|RECIPES|RED|REDSTONE|REDUMBRELLA|REHAB|REISE|REISEN|REIT|RELIANCE|REN|RENT|RENTALS|REPAIR|REPORT|REPUBLICAN|REST|RESTAURANT|REVIEW|REVIEWS|REXROTH|RICH|RICHARDLI|RICOH|RIGHTATHOME|RIL|RIO|RIP|RMIT|RO|ROCHER|ROCKS|RODEO|ROGERS|ROOM|RS|RSVP|RU|RUGBY|RUHR|RUN|RW|RWE|RYUKYU|SA|SAARLAND|SAFE|SAFETY|SAKURA|SALE|SALON|SAMSCLUB|SAMSUNG|SANDVIK|SANDVIKCOROMANT|SANOFI|SAP|SARL|SAS|SAVE|SAXO|SB|SBI|SBS|SC|SCA|SCB|SCHAEFFLER|SCHMIDT|SCHOLARSHIPS|SCHOOL|SCHULE|SCHWARZ|SCIENCE|SCJOHNSON|SCOR|SCOT|SD|SE|SEARCH|SEAT|SECURE|SECURITY|SEEK|SELECT|SENER|SERVICES|SES|SEVEN|SEW|SEX|SEXY|SFR|SG|SH|SHANGRILA|SHARP|SHAW|SHELL|SHIA|SHIKSHA|SHOES|SHOP|SHOPPING|SHOUJI|SHOW|SHOWTIME|SHRIRAM|SI|SILK|SINA|SINGLES|SITE|SJ|SK|SKI|SKIN|SKY|SKYPE|SL|SLING|SM|SMART|SMILE|SN|SNCF|SO|SOCCER|SOCIAL|SOFTBANK|SOFTWARE|SOHU|SOLAR|SOLUTIONS|SONG|SONY|SOY|SPACE|SPORT|SPOT|SPREADBETTING|SR|SRL|SS|ST|STADA|STAPLES|STAR|STATEBANK|STATEFARM|STC|STCGROUP|STOCKHOLM|STORAGE|STORE|STREAM|STUDIO|STUDY|STYLE|SU|SUCKS|SUPPLIES|SUPPLY|SUPPORT|SURF|SURGERY|SUZUKI|SV|SWATCH|SWIFTCOVER|SWISS|SX|SY|SYDNEY|SYMANTEC|SYSTEMS|SZ|TAB|TAIPEI|TALK|TAOBAO|TARGET|TATAMOTORS|TATAR|TATTOO|TAX|TAXI|TC|TCI|TD|TDK|TEAM|TECH|TECHNOLOGY|TEL|TEMASEK|TENNIS|TEVA|TF|TG|TH|THD|THEATER|THEATRE|TIAA|TICKETS|TIENDA|TIFFANY|TIPS|TIRES|TIROL|TJ|TJMAXX|TJX|TK|TKMAXX|TL|TM|TMALL|TN|TO|TODAY|TOKYO|TOOLS|TOP|TORAY|TOSHIBA|TOTAL|TOURS|TOWN|TOYOTA|TOYS|TR|TRADE|TRADING|TRAINING|TRAVEL|TRAVELCHANNEL|TRAVELERS|TRAVELERSINSURANCE|TRUST|TRV|TT|TUBE|TUI|TUNES|TUSHU|TV|TVS|TW|TZ|UA|UBANK|UBS|UG|UK|UNICOM|UNIVERSITY|UNO|UOL|UPS|US|UY|UZ|VA|VACATIONS|VANA|VANGUARD|VC|VE|VEGAS|VENTURES|VERISIGN|VERSICHERUNG|VET|VG|VI|VIAJES|VIDEO|VIG|VIKING|VILLAS|VIN|VIP|VIRGIN|VISA|VISION|VIVA|VIVO|VLAANDEREN|VN|VODKA|VOLKSWAGEN|VOLVO|VOTE|VOTING|VOTO|VOYAGE|VU|VUELOS|WALES|WALMART|WALTER|WANG|WANGGOU|WATCH|WATCHES|WEATHER|WEATHERCHANNEL|WEBCAM|WEBER|WEBSITE|WED|WEDDING|WEIBO|WEIR|WF|WHOSWHO|WIEN|WIKI|WILLIAMHILL|WIN|WINDOWS|WINE|WINNERS|WME|WOLTERSKLUWER|WOODSIDE|WORK|WORKS|WORLD|WOW|WS|WTC|WTF|XBOX|XEROX|XFINITY|XIHUAN|XIN|XN--11B4C3D|XN--1CK2E1B|XN--1QQW23A|XN--2SCRJ9C|XN--30RR7Y|XN--3BST00M|XN--3DS443G|XN--3E0B707E|XN--3HCRJ9C|XN--3OQ18VL8PN36A|XN--3PXU8K|XN--42C2D9A|XN--45BR5CYL|XN--45BRJ9C|XN--45Q11C|XN--4GBRIM|XN--54B7FTA0CC|XN--55QW42G|XN--55QX5D|XN--5SU34J936BGSG|XN--5TZM5G|XN--6FRZ82G|XN--6QQ986B3XL|XN--80ADXHKS|XN--80AO21A|XN--80AQECDR1A|XN--80ASEHDB|XN--80ASWG|XN--8Y0A063A|XN--90A3AC|XN--90AE|XN--90AIS|XN--9DBQ2A|XN--9ET52U|XN--9KRT00A|XN--B4W605FERD|XN--BCK1B9A5DRE4C|XN--C1AVG|XN--C2BR7G|XN--CCK2B3B|XN--CG4BKI|XN--CLCHC0EA0B2G2A9GCD|XN--CZR694B|XN--CZRS0T|XN--CZRU2D|XN--D1ACJ3B|XN--D1ALF|XN--E1A4C|XN--ECKVDTC9D|XN--EFVY88H|XN--FCT429K|XN--FHBEI|XN--FIQ228C5HS|XN--FIQ64B|XN--FIQS8S|XN--FIQZ9S|XN--FJQ720A|XN--FLW351E|XN--FPCRJ9C3D|XN--FZC2C9E2C|XN--FZYS8D69UVGM|XN--G2XX48C|XN--GCKR3F0F|XN--GECRJ9C|XN--GK3AT1E|XN--H2BREG3EVE|XN--H2BRJ9C|XN--H2BRJ9C8C|XN--HXT814E|XN--I1B6B1A6A2E|XN--IMR513N|XN--IO0A7I|XN--J1AEF|XN--J1AMH|XN--J6W193G|XN--JLQ61U9W7B|XN--JVR189M|XN--KCRX77D1X4A|XN--KPRW13D|XN--KPRY57D|XN--KPU716F|XN--KPUT3I|XN--L1ACC|XN--LGBBAT1AD8J|XN--MGB9AWBF|XN--MGBA3A3EJT|XN--MGBA3A4F16A|XN--MGBA7C0BBN0A|XN--MGBAAKC7DVF|XN--MGBAAM7A8H|XN--MGBAB2BD|XN--MGBAH1A3HJKRD|XN--MGBAI9AZGQP6J|XN--MGBAYH7GPA|XN--MGBBH1A|XN--MGBBH1A71E|XN--MGBC0A9AZCG|XN--MGBCA7DZDO|XN--MGBCPQ6GPA1A|XN--MGBERP4A5D4AR|XN--MGBGU82A|XN--MGBI4ECEXP|XN--MGBPL2FH|XN--MGBT3DHD|XN--MGBTX2B|XN--MGBX4CD0AB|XN--MIX891F|XN--MK1BU44C|XN--MXTQ1M|XN--NGBC5AZD|XN--NGBE9E0A|XN--NGBRX|XN--NODE|XN--NQV7F|XN--NQV7FS00EMA|XN--NYQY26A|XN--O3CW4H|XN--OGBPF8FL|XN--OTU796D|XN--P1ACF|XN--P1AI|XN--PBT977C|XN--PGBS0DH|XN--PSSY2U|XN--Q7CE6A|XN--Q9JYB4C|XN--QCKA1PMC|XN--QXA6A|XN--QXAM|XN--RHQV96G|XN--ROVU88B|XN--RVC1E0AM3E|XN--S9BRJ9C|XN--SES554G|XN--T60B56A|XN--TCKWE|XN--TIQ49XQYJ|XN--UNUP4Y|XN--VERMGENSBERATER-CTB|XN--VERMGENSBERATUNG-PWB|XN--VHQUV|XN--VUQ861B|XN--W4R85EL8FHU5DNRA|XN--W4RS40L|XN--WGBH1C|XN--WGBL6A|XN--XHQ521B|XN--XKC2AL3HYE2A|XN--XKC2DL3A5EE0H|XN--Y9A3AQ|XN--YFRO4I67O|XN--YGBI2AMMX|XN--ZFR164B|XXX|XYZ|YACHTS|YAHOO|YAMAXUN|YANDEX|YE|YODOBASHI|YOGA|YOKOHAMA|YOU|YOUTUBE|YT|YUN|ZA|ZAPPOS|ZARA|ZERO|ZIP|ZM|ZONE|ZUERICH|ZW|TEST)" }); A(N); N.TLDs; var L = u(function (A, E) { Object.defineProperty(E, "__esModule", { value: !0 }), E.openingParenthesis = "([\"'{", E.closingParenthesis = ")]\"'}", E.parenthesis = E.openingParenthesis.split("").map(function (A, u) { return "" + A + E.closingParenthesis.charAt(u) }), E.htmlAttributes = ["src", "data", "href", "cite", "formaction", "icon", "manifest", "poster", "codebase", "background", "profile", "usemap", "itemtype", "action", "longdesc", "classid", "archive"], E.nonLatinAlphabetRanges = "\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0\\u08A2-\\u08AC\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097F\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C33\\u0C35-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191C\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183\\u2184\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005\\u3006\\u3031-\\u3035\\u303B\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA697\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA793\\uA7A0-\\uA7AA\\uA7F8-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA80-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC", E.TLDs = N.TLDs }); A(L); L.openingParenthesis, L.closingParenthesis, L.parenthesis, L.htmlAttributes, L.nonLatinAlphabetRanges, L.TLDs; var B = u(function (A, u) { function S(A, u, E) { return "function" == typeof E ? E(A, u) : E } Object.defineProperty(u, "__esModule", { value: !0 }), u.transform = function (A, u) { var E = "", N = 1 / 0, C = {}, O = !1; if (u && u.specialTransform) for (var I = 0; I < u.specialTransform.length; I++) { var R = u.specialTransform[I]; if (R.test.test(A.string)) return R.transform(A.string, A) } return u && u.exclude && S(A.string, A, u.exclude) ? A.string : (u && u.protocol && (E = S(A.string, A, u.protocol)), E = A.protocol ? "" : E || (A.isEmail ? "mailto:" : A.isFile ? "file:///" : "http://"), u && u.truncate && (N = S(A.string, A, u.truncate)), u && u.middleTruncation && (O = S(A.string, A, u.middleTruncation)), u && u.attributes && (C = S(A.string, A, u.attributes)), "<a " + Object.keys(C).map(function (A) { return !0 === C[A] ? A : A + '="' + C[A] + '" ' }).join(" ") + 'href="' + E + A.string + '">' + (A.string.length > N ? O ? A.string.substring(0, Math.floor(N / 2)) + "�" + A.string.substring(A.string.length - Math.ceil(N / 2), A.string.length) : A.string.substring(0, N) + "�" : A.string) + "</a>") } }); A(B); B.transform; var e = u(function (A, u) { Object.defineProperty(u, "__esModule", { value: !0 }); var E = "([a-z0-9]+(-+[a-z0-9]+)*\\.)+(" + L.TLDs + ")", N = "a-zA-Z\\d\\-._~\\!$&*+,;=:@%'\"\\[\\]()", C = "((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)", O = "\\[(([a-f0-9:]+:+)+[a-f0-9]+)\\]", I = "(https?:|ftps?:)\\/\\/", R = "(((" + I + ")?(" + E + "|" + C + "|(" + I + ")(" + O + "|" + ("([a-z0-9]+(-+[a-z0-9]+)*\\.)+([a-z0-9][a-z0-9-]{0," + (Math.max.apply(t, L.TLDs.split("|").map(function (A) { return A.length })) - 2) + "}[a-z0-9])") + "))(?!@\\w)(:(\\d{1,5}))?)|(((https?:|ftps?:)\\/\\/)\\S+))", S = R + "((((\\/(([" + N + "]+(\\/[" + N + L.nonLatinAlphabetRanges + "]*)*))?)?)((\\?([" + N + "\\/?]*))?)((\\#([" + N + "\\/?]*))?))?\\b((([" + N + "\\/" + L.nonLatinAlphabetRanges + "][a-zA-Z\\d\\-_~+=\\/" + L.nonLatinAlphabetRanges + "]+)?))+)"; u.email = "\\b(mailto:)?([a-z0-9!#$%&'*+=?^_`{|}~-]+(\\.[a-z0-9!#$%&'*+=?^_`{|}~-]+)*)@(" + E + "|" + C + ")\\b", u.url = "(" + S + ")|(\\b" + R + "(((\\/(([a-zA-Z\\d\\-._~\\!$&*+,;=:@%'\"\\[\\]()]+(\\/[a-zA-Z\\d\\-._~\\!$&*+,;=:@%'\"\\[\\]()]*)*))?)?)((\\?([a-zA-Z\\d\\-._~\\!$&*+,;=:@%'\"\\[\\]()\\/?]*))?)((\\#([a-zA-Z\\d\\-._~\\!$&*+,;=:@%'\"\\[\\]()\\/?]*))?))?\\b(([\\/]?))+)", u.file = "(file:\\/\\/\\/)([a-z]+:(\\/|\\\\)+)?([\\w.]+([\\/\\\\]?)+)+", u.final = "(" + u.url + ")|(" + u.email + ")|(" + u.file + ")", u.finalRegex = new RegExp(u.final, "gi"), u.ipRegex = new RegExp("^(" + C + "|" + O + ")$", "i"), u.emailRegex = new RegExp("^(" + u.email + ")$", "i"), u.fileRegex = new RegExp("^(" + u.file + ")$", "i"), u.urlRegex = new RegExp("^(" + u.url + ")$", "i"); var T = { isURL: 0, isEmail: 0, isFile: 0, file: { fileName: 0, protocol: 0 }, email: { protocol: 0, local: 0, host: 0 }, url: { ipv4: 0, ipv6: 0, ipv4Confirmation: 0, byProtocol: 0, port: 0, protocol1: 0, protocol2: 0, protocol3: 0, protocolWithDomain: 0, path: 0, secondPartOfPath: 0, query: 0, fragment: 0 } }; u.iidxes = T; for (var B = ["file:///some/file/path/filename.pdf", "mailto:e+_mail.me@sub.domain.com", "http://sub.domain.co.uk:3000/p/a/t/h_(asd)/h?q=abc123#dfdf", "http://www.????.com", "http://127.0.0.1:3000/p/a/t_(asd)/h?q=abc123#dfdf", "http://[2a00:1450:4025:401::67]/k/something", "a.org/abc/?_??"].join(" "), e = null, D = 0; null !== (e = u.finalRegex.exec(B));)0 === D && (T.isFile = e.lastIndexOf(e[0]), T.file.fileName = e.indexOf("filename.pdf"), T.file.protocol = e.indexOf("file:///")), 1 === D && (T.isEmail = e.lastIndexOf(e[0]), T.email.protocol = e.indexOf("mailto:"), T.email.local = e.indexOf("e+_mail.me"), T.email.host = e.indexOf("sub.domain.com")), 2 === D && (T.isURL = e.lastIndexOf(e[0]), T.url.protocol1 = e.indexOf("http://"), T.url.protocolWithDomain = e.indexOf("http://sub.domain.co.uk:3000"), T.url.port = e.indexOf("3000"), T.url.path = e.indexOf("/p/a/t/h_(asd)/h"), T.url.query = e.indexOf("q=abc123"), T.url.fragment = e.indexOf("dfdf")), 3 === D && (T.url.byProtocol = e.lastIndexOf("http://www.????.com"), T.url.protocol2 = e.lastIndexOf("http://")), 4 === D && (T.url.ipv4 = e.indexOf("127.0.0.1"), T.url.ipv4Confirmation = e.indexOf("0.")), 5 === D && (T.url.ipv6 = e.indexOf("2a00:1450:4025:401::67"), T.url.protocol3 = e.lastIndexOf("http://")), 6 === D && (T.url.secondPartOfPath = e.indexOf("??")), D++ }); A(e); e.email, e.url, e.file, e.finalRegex, e.ipRegex, e.emailRegex, e.fileRegex, e.urlRegex, e.iidxes; var D = u(function (A, u) { Object.defineProperty(u, "__esModule", { value: !0 }), u.checkParenthesis = function (A, u, E, N) { return N === u && (E.split(A).length - E.split(u).length == 1 || A === u && E.split(A).length % 2 == 0 || void 0) }, u.maximumAttrLength = L.htmlAttributes.sort(function (A, u) { return u.length - A.length })[0].length, u.isInsideAttribute = function (A) { return /\s[a-z0-9-]+=('|")$/i.test(A) || /: ?url\(('|")?$/i.test(A) }, u.isInsideAnchorTag = function (A, u, E) { for (var N = A.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"), C = new RegExp("(?=(<a))(?!([\\s\\S]*)(<\\/a>)(" + N + "))[\\s\\S]*?(" + N + ")(?!\"|')", "gi"), O = null; null !== (O = C.exec(u));) { if (O.index + O[0].length === E) return !0 } return !1 } }); A(D); D.checkParenthesis, D.maximumAttrLength, D.isInsideAttribute, D.isInsideAnchorTag; return A(u(function (A, u) { Object.defineProperty(u, "__esModule", { value: !0 }); function T(I) { for (var R = [], S = null, A = function () { var A = S.index, N = A + S[0].length, C = S[0]; if ("/" === I.charAt(N) && (C += I.charAt(N), N++), -1 < L.closingParenthesis.indexOf(I.charAt(N)) && L.parenthesis.forEach(function (A) { var u = A.charAt(0), E = A.charAt(1); D.checkParenthesis(u, E, C, I.charAt(N)) && (C += I.charAt(N), N++) }), -1 !== ['""', "''", "()"].indexOf(I.charAt(A - 1) + I.charAt(N)) && D.isInsideAttribute(I.substring(A - D.maximumAttrLength - 15, A))) return "continue"; if (-1 < I.substring(N, I.length).indexOf("</a>") && -1 < I.substring(0, A).indexOf("<a") && D.isInsideAnchorTag(C, I, N)) return "continue"; if (S[e.iidxes.isURL]) { var u = (S[e.iidxes.url.path] || "") + (S[e.iidxes.url.secondPartOfPath] || "") || void 0, E = S[e.iidxes.url.protocol1] || S[e.iidxes.url.protocol2] || S[e.iidxes.url.protocol3]; R.push({ start: A, end: N, string: C, isURL: !0, protocol: E, port: S[e.iidxes.url.port], ipv4: S[e.iidxes.url.ipv4Confirmation] ? S[e.iidxes.url.ipv4] : void 0, ipv6: S[e.iidxes.url.ipv6], host: S[e.iidxes.url.byProtocol] ? void 0 : (S[e.iidxes.url.protocolWithDomain] || "").substr((E || "").length), confirmedByProtocol: !!S[e.iidxes.url.byProtocol], path: S[e.iidxes.url.byProtocol] ? void 0 : u, query: S[e.iidxes.url.query] || void 0, fragment: S[e.iidxes.url.fragment] || void 0 }) } else if (S[e.iidxes.isFile]) { var O = C.substr(8); R.push({ start: A, end: N, string: C, isFile: !0, protocol: S[e.iidxes.file.protocol], filename: S[e.iidxes.file.fileName], filePath: O, fileDirectory: O.substr(0, O.length - S[e.iidxes.file.fileName].length) }) } else S[e.iidxes.isEmail] ? R.push({ start: A, end: N, string: C, isEmail: !0, local: S[e.iidxes.email.local], protocol: S[e.iidxes.email.protocol], host: S[e.iidxes.email.host] }) : R.push({ start: A, end: N, string: C }) }; null !== (S = e.finalRegex.exec(I));)A(); return R } function E(A) { var u = "string" == typeof A ? { input: A, options: void 0, extensions: void 0 } : A, E = u.input, N = u.options, C = u.extensions; if (C) for (var O = 0; O < C.length; O++) { var I = C[O]; E = E.replace(I.test, I.transform) } var R = T(E), S = ""; for (O = 0; O < R.length; O++)S = (S || (0 === O ? E.substring(0, R[O].start) : "")) + B.transform(R[O], N) + (R[O + 1] ? E.substring(R[O].end, R[O + 1].start) : E.substring(R[O].end)); return S || E } E.list = function (A) { return T(A) }, E.validate = { ip: function (A) { return e.ipRegex.test(A) }, email: function (A) { return e.emailRegex.test(A) }, file: function (A) { return e.fileRegex.test(A) }, url: function (A) { return e.urlRegex.test(A) || e.ipRegex.test(A) } }, u.default = E })) });
﻿(function ()
{
   _MTS_JQUERY(document).one("widgetsloaded", function ()
   {
      if (_MTS_JQUERY("#loginBottom").length > 0)
      {
         var logbuttonsHereTarget = "";
         var currentButtonHref = _MTS_JQUERY("#loginBottom").attr("href");

         if (currentButtonHref.length > 0)
         {
            if (typeof _encodedPathAndQuery === "string" && _encodedPathAndQuery != null && _encodedPathAndQuery.length > 0)
               logbuttonsHereTarget = _encodedPathAndQuery;

            var portalString = "%2fPortal.aspx";
            _MTS_JQUERY(".lgBot").attr("href", currentButtonHref.replace(currentButtonHref.indexOf(portalString) >= 0 ? portalString : "%2f", logbuttonsHereTarget));
         }
      }

      if (typeof (ToggleCustomDropdowns) == "function")
         ToggleCustomDropdowns(80, "#searchType:visible");
   });
})();
