(function(a){a.fn.jqm=function(b){var m={zIndex:3E3,overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:g,ajaxText:"",target:g,modal:g,toTop:g,onShow:g,onHide:g,onLoad:g};return this.each(function(){if(this._jqm)return c[this._jqm].c=a.extend({},c[this._jqm].c,b);e++;this._jqm=e;c[e]={c:a.extend(m,a.jqm.params,b),a:g,w:a(this).addClass("jqmID"+e),s:e};m.trigger&&a(this).jqmAddTrigger(m.trigger)})};a.fn.jqmAddClose=function(b){return j(this,b,"jqmHide")};a.fn.jqmAddTrigger=
function(b){return j(this,b,"jqmShow")};a.fn.jqmShow=function(b){return this.each(function(){a(".s-Ads").hide();a.jqm.open(this._jqm,b)})};a.fn.jqmHide=function(b){return this.each(function(){a(".s-Ads").show();a.jqm.close(this._jqm,b)})};a.jqm={hash:{},open:function(b,m){var f=c[b],l=f.c,i="."+l.closeClass,k=parseInt(f.w.css("z-index"));k=k>0?k:3E3;var s=a("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":k-1,opacity:l.overlay/100});if(f.a)return g;f.t=m;f.a=
true;f.w.css("z-index",k);if(l.modal){d[0]||t("bind");d.push(b)}else if(l.overlay>0)f.w.jqmAddClose(s);else s=g;f.o=s?s.addClass(l.overlayClass).prependTo("body"):g;if(h){a("html,body").css({height:"100%",width:"100%"});if(s){s=s.css({position:"absolute"})[0];for(var w in{Top:1,Left:1})s.style.setExpression(w.toLowerCase(),"(_=(document.documentElement.scroll"+w+" || document.body.scroll"+w+"))+'px'")}}if(l.ajax){b=l.target||f.w;k=l.ajax;b=typeof b=="string"?a(b,f.w):a(b);k=k.substr(0,1)=="@"?a(m).attr(k.substring(1)):
k;b.html(l.ajaxText).load(k,function(){l.onLoad&&l.onLoad.call(this,f);i&&f.w.jqmAddClose(a(i,f.w));r(f)})}else i&&f.w.jqmAddClose(a(i,f.w));l.toTop&&f.o&&f.w.before('<span id="jqmP'+f.w[0]._jqm+'"></span>').insertAfter(f.o);l.onShow?l.onShow(f):f.w.show();r(f);return g},close:function(b){b=c[b];if(!b.a)return g;b.a=g;if(d[0]){d.pop();d[0]||t("unbind")}b.c.toTop&&b.o&&a("#jqmP"+b.w[0]._jqm).after(b.w).remove();if(b.c.onHide)b.c.onHide(b);else{b.w.hide();b.o&&b.o.remove()}return g},params:{}};var e=
0,c=a.jqm.hash,d=[],h=a.browser.msie&&a.browser.version=="6.0",g=false,q=a('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),r=function(b){if(h)if(b.o)b.o.html('<p style="width:100%;height:100%"/>').prepend(q);else a("iframe.jqm",b.w)[0]||b.w.prepend(q);n(b)},n=function(b){try{a(":input:visible",b.w)[0].focus()}catch(m){}},t=function(b){a()[b]("keypress",o)[b]("keydown",o)[b]("mousedown",o)},o=function(b){var m=c[d[d.length-1]];(b=!a(b.target).parents(".jqmID"+
m.s)[0])&&n(m);return!b},j=function(b,m,f){return b.each(function(){var l=this._jqm;a(m).each(function(){if(!this[f]){this[f]=[];a(this).click(function(){for(var i in{jqmShow:1,jqmHide:1})for(var k in this[i])c[this[i][k]]&&c[this[i][k]].w[i](this);return g})}this[f].push(l)})})}})(jQuery);
jQuery.fn.ajaxSubmit=function(a){function e(){function n(){if(!s++){f.detachEvent?f.detachEvent("onload",n):f.removeEventListener("load",n,false);var u=true;try{if(w)throw"timeout";var p,v;v=f.contentWindow?f.contentWindow.document:f.contentDocument?f.contentDocument:f.document;i.responseText=v.body?v.body.innerHTML:null;i.responseXML=v.XMLDocument?v.XMLDocument:v;if(j.dataType=="json"||j.dataType=="script"){var x=v.getElementsByTagName("textarea")[0];p=x?x.value:i.responseText;j.dataType=="json"?
eval("data = "+p):jQuery.globalEval(p)}else if(j.dataType=="xml"){p=i.responseXML;if(!p&&i.responseText!=null)p=t(i.responseText)}else p=i.responseText}catch(y){u=false;jQuery.handleError(j,i,"error",y)}if(u){j.success(p,"success");k&&jQuery.event.trigger("ajaxSuccess",[i,j])}k&&jQuery.event.trigger("ajaxComplete",[i,j]);k&&!--jQuery.active&&jQuery.event.trigger("ajaxStop");if(j.complete)j.complete(i,u?"success":"error");setTimeout(function(){m.remove();i.responseXML=null},100)}}function t(u,p){if(window.ActiveXObject){p=
new ActiveXObject("Microsoft.XMLDOM");p.async="false";p.loadXML(u)}else p=(new DOMParser).parseFromString(u,"text/xml");return p&&p.documentElement&&p.documentElement.tagName!="parsererror"?p:null}var o=h[0],j=jQuery.extend({},jQuery.ajaxSettings,a),b="jqFormIO"+jQuery.fn.ajaxSubmit.counter++,m=jQuery('<iframe id="'+b+'" name="'+b+'" />'),f=m[0],l=jQuery.browser.opera&&window.opera.version()<9;if(jQuery.browser.msie||l)f.src='javascript:false;document.write("");';m.css({position:"absolute",top:"-1000px",
left:"-1000px"});o.method="POST";o.encoding?(o.encoding="multipart/form-data"):(o.enctype="multipart/form-data");var i={responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){}},k=j.global;k&&!jQuery.active++&&jQuery.event.trigger("ajaxStart");k&&jQuery.event.trigger("ajaxSend",[i,j]);var s=0,w=0;setTimeout(function(){m.appendTo("body");f.attachEvent?f.attachEvent("onload",n):f.addEventListener("load",
n,false);o.action=j.url;var u=o.target;o.target=b;j.timeout&&setTimeout(function(){w=true;n()},j.timeout);o.submit();o.target=u},10)}if(typeof a=="function")a={success:a};a=jQuery.extend({url:this.attr("action")||window.location,type:this.attr("method")||"GET"},a||{});var c=this.formToArray(a.semantic);if(a.beforeSubmit&&a.beforeSubmit(c,this,a)===false)return this;var d={};jQuery.event.trigger("form.submit.validate",[c,this,a,d]);if(d.veto)return this;c=jQuery.param(c);if(a.type.toUpperCase()=="GET"){a.url+=
(a.url.indexOf("?")>=0?"&":"?")+c;a.data=null}else a.data=c;var h=this,g=[];a.resetForm&&g.push(function(){h.resetForm()});a.clearForm&&g.push(function(){h.clearForm()});if(!a.dataType&&a.target){var q=a.success||function(){};g.push(function(n,t){jQuery(a.target).attr("innerHTML",n).evalScripts().each(q,[n,t])})}else a.success&&g.push(a.success);a.success=function(n,t){for(var o=0,j=g.length;o<j;o++)g[o](n,t)};c=jQuery("input:file",this).fieldValue();d=false;for(var r=0;r<c.length;r++)if(c[r])d=true;
a.iframe||d?e():jQuery.ajax(a);jQuery.event.trigger("form.submit.notify",[this,a]);return this};jQuery.fn.ajaxSubmit.counter=0;
jQuery.fn.ajaxForm=function(a){return this.each(function(){jQuery("input:submit,input:image,button:submit",this).click(function(e){var c=this.form;c.clk=this;if(this.type=="image")if(e.offsetX!=undefined){c.clk_x=e.offsetX;c.clk_y=e.offsetY}else if(typeof jQuery.fn.offset=="function"){var d=jQuery(this).offset();c.clk_x=e.pageX-d.left;c.clk_y=e.pageY-d.top}else{c.clk_x=e.pageX-this.offsetLeft;c.clk_y=e.pageY-this.offsetTop}setTimeout(function(){c.clk=c.clk_x=c.clk_y=null},10)})}).submit(function(){jQuery(this).ajaxSubmit(a);
return false})};
jQuery.fn.formToArray=function(a){var e=[];if(this.length==0)return e;var c=this[0],d=a?c.getElementsByTagName("*"):c.elements;if(!d)return e;for(var h=0,g=d.length;h<g;h++){var q=d[h],r=q.name;if(r)if(a&&c.clk&&q.type=="image")!q.disabled&&c.clk==q&&e.push({name:r+".x",value:c.clk_x},{name:r+".y",value:c.clk_y});else{q=jQuery.fieldValue(q,true);if(q!==null)if(q.constructor==Array)for(var n=0,t=q.length;n<t;n++)e.push({name:r,value:q[n]});else e.push({name:r,value:q})}}if(!a&&c.clk){a=c.getElementsByTagName("input");
h=0;for(g=a.length;h<g;h++){d=a[h];(r=d.name)&&!d.disabled&&d.type=="image"&&c.clk==d&&e.push({name:r+".x",value:c.clk_x},{name:r+".y",value:c.clk_y})}}return e};jQuery.fn.formSerialize=function(a){return jQuery.param(this.formToArray(a))};
jQuery.fn.fieldSerialize=function(a){var e=[];this.each(function(){var c=this.name;if(c){var d=jQuery.fieldValue(this,a);if(d&&d.constructor==Array)for(var h=0,g=d.length;h<g;h++)e.push({name:c,value:d[h]});else d!==null&&typeof d!="undefined"&&e.push({name:this.name,value:d})}});return jQuery.param(e)};
jQuery.fn.fieldValue=function(a){for(var e=[],c=0,d=this.length;c<d;c++){var h=jQuery.fieldValue(this[c],a);h===null||typeof h=="undefined"||h.constructor==Array&&!h.length||(h.constructor==Array?jQuery.merge(e,h):e.push(h))}return e};
jQuery.fieldValue=function(a,e){var c=a.name,d=a.type,h=a.tagName.toLowerCase();if(typeof e=="undefined")e=true;if(e&&(!c||a.disabled||d=="reset"||d=="button"||(d=="checkbox"||d=="radio")&&!a.checked||(d=="submit"||d=="image")&&a.form&&a.form.clk!=a||h=="select"&&a.selectedIndex==-1))return null;if(h=="select"){h=a.selectedIndex;if(h<0)return null;e=[];a=a.options;c=(d=d=="select-one")?h+1:a.length;for(h=d?h:0;h<c;h++){var g=a[h];if(g.selected){g=jQuery.browser.msie&&!g.attributes.value.specified?
g.text:g.value;if(d)return g;e.push(g)}}return e}return a.value};jQuery.fn.clearForm=function(){return this.each(function(){jQuery("input,select,textarea",this).clearFields()})};jQuery.fn.clearFields=jQuery.fn.clearInputs=function(){return this.each(function(){var a=this.type,e=this.tagName.toLowerCase();if(a=="text"||a=="password"||e=="textarea")this.value="";else if(a=="checkbox"||a=="radio")this.checked=false;else if(e=="select")this.selectedIndex=-1})};
jQuery.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||typeof this.reset=="object"&&!this.reset.nodeType)this.reset()})};

