if(typeof f=="undefined"||!salem){var salem={};}salem.registerNamespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i++){d=a[i].split(".");o=salem;for(j=(d[0]=="salem")?1:0;j<d.length;j++){o[d[j]]=o[d[j]]||{};o=o[d[j]];}}return o;};String.prototype.format=function(){var args=arguments;return this.replace(/{(\d+)}/g,function(match,number){return typeof args[number]!="undefined"?args[number]:match;});};salem.bind=function(obj,fun,args){return function(){if(obj===true){obj=this;}var f=typeof fun==="string"?obj[fun]:fun;return f.apply(obj,Array.prototype.slice.call(args||[]).concat(Array.prototype.slice.call(arguments)));};};salem.registerNamespace("getRelativeBaseUrl");salem.getRelativeBaseUrl=function(){if(location.href.toLowerCase().indexOf("crossbridge")>=0){return"/crossbridge/";}return"/";};salem.registerNamespace("getBaseUrl");salem.getBaseUrl=function(){var url=location.href;var baseURL=url.substring(0,url.indexOf("/",14));if(baseURL.indexOf("http://localhost")!=-1){url=location.href;var pathname=location.pathname;var index1=url.indexOf(pathname);var index2=url.indexOf("/",index1+1);var baseLocalUrl=url.substr(0,index2);return baseLocalUrl+"/";}else{return baseURL+"/";}};salem.registerNamespace("getFullSiteDomain");salem.getFullSiteDomain=function(){var parts=document.domain.split(".");var len=parts.length;return".{0}.{1}".format(parts[len-2],parts[len-1]);};salem.registerNamespace("ajax.service");salem.ajax.service=function AjaxService(serviceUrl){var Instance=this;this.serviceUrl=serviceUrl;this.JsonGet=function(method,data,callback,error){this.Invoke("GET",method,data,callback,error,false);};this.JsonPost=function(method,data,callback,error){this.Invoke("POST",method,data,callback,error,false);};this.Invoke=function(action,method,data,callback,error,bare){var url=Instance.serviceUrl+method;$.ajax({url:url,data:data,type:action,processData:true,contentType:"application/json",timeout:5000,dataType:"json",success:function(response){if(!bare){for(var property in response){response=response[property];break;}}response=JSON.parse(response);callback(response);},error:error});};};salem.registerNamespace("string");salem.string={isNullOrEmpty:function(){var ret=false;for(var i=0;i<arguments.length;i++){if(ret==false&&(arguments[i]==null||salem.string.trim(arguments[i].toString()).length==0)){ret=true;}}return ret;},trim:function(str){return str.replace(/^\s+|\s+$/g,"");}};salem.registerNamespace("validation");salem.validation={isValidEmail:function(email){var reg=new RegExp("^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,4}$");return reg.test(email);}};salem.registerNamespace("sound");salem.sound={Play:function(sound,debug){var embed=document.getElementById("__SoundFrame");if(embed!=null){embed.parentNode.removeChild(embed);}embed=document.createElement("embed");embed.setAttribute("id","__SoundFrame");embed.setAttribute("src",sound);embed.setAttribute("loop","false");embed.setAttribute("volume","200");embed.setAttribute("autostart","true");if(debug==null||debug==false){embed.setAttribute("hidden","true");}document.body.appendChild(embed);}};salem.registerNamespace("social");salem.social={shareEmail:function(siteName,url){var email="";var subject="Check out this article at "+siteName+"!";var body_message="I thought you might be interested in seeing this "+url;var mailto_link="mailto:"+email+"?subject="+subject+"&body="+body_message;win=window.open(mailto_link,"emailWindow");if(win&&win.open&&!win.closed){win.close();}}};salem.registerNamespace("animation");salem.animation={HighlightThenFade:function(elem,postFadeBgColor){elem.removeClass("Highlight");elem.addClass("Highlight");setTimeout(function(){elem.animate({backgroundColor:postFadeBgColor},500);},3000);}};salem.registerNamespace("browserCompatability");salem.browserCompatability={testAttribute:function(element,attribute){var test=document.createElement(element);return attribute in test;}};salem.registerNamespace("form");salem.form={smartTextBox:function(elements,blurredClass){$.each(elements,function(i,element){var elem=$(element);var defaultVal=elem.attr("placeholder")||elem.val();elem.val(defaultVal);elem.addClass(blurredClass).focus(function(){$(this).val("").removeClass(blurredClass);}).blur(function(){if($(this).val()==defaultVal||$(this).val()==""){$(this).val(defaultVal).addClass(blurredClass);}});});}};