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;};Salem.RegisterNamespace("Search.Cookie");Salem.Search.Cookie=function(value){var cookieName="Search.Cookie";if(typeof value!="undefined"){$.cookie(cookieName,value);}else{var ret="";if($.cookie(cookieName)!=null){ret=$.cookie(cookieName);}$.cookie(cookieName,null);return ret;}};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){for(var property in response){response=response[property];break;}response=JSON.parse(response);callback(response);},error:error});};};Salem.RegisterNamespace("Salem.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;},Format:function(str){for(var i=1;i<arguments.length;i++){var re=new RegExp("\\{"+(i-1)+"\\}","gm");var val=(Salem.String.IsNullOrEmpty(arguments[i]))?"":arguments[i];str=str.replace(re,val);}return str;},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);}};