
$.fn.ajaxSubmit=function(target,post_cb,pre_cb,url,mth){if(!this.vars)this.serialize();if(pre_cb&&pre_cb.constructor==Function&&pre_cb(this.vars)===false)return;var f=this.get(0);var url=url||f.action||'';var mth=mth||f.method||'POST';if(target&&target.constructor==Function)
$.ajax(mth,url,$.param(this.vars),target);else if(target&&target.constructor==String)
$(target).load(url,this.vars,post_cb);else{this.vars.push({name:'evaljs',value:1});$.ajax(mth,url,$.param(this.vars),function(r){eval(r.responseText);});}
return this;};$.fn.ajaxForm=function(target,post_cb,pre_cb){return this.each(function(){$("input[@type=submit],input[@type=image]",this).click(function(ev){this.form.clicked=this;if(ev.offsetX!=undefined){this.form.clicked_x=ev.offsetX;this.form.clicked_y=ev.offsetY;}else{this.form.clicked_x=ev.pageX-this.offsetLeft;this.form.clicked_y=ev.pageY-this.offsetTop;}});}).submit(function(e){$(this).ajaxSubmit(target,post_cb,pre_cb);return false;});};$.fn.formdata=function(){this.serialize();return this.vars;};$.fn.serialize=function(){var a=[];var ok={INPUT:true,TEXTAREA:true,OPTION:true};$('*',this).each(function(){var par=this.parentNode;var p=par.nodeName.toUpperCase();var n=this.name||p=='OPTGROUP'&&par.parentNode.name||p=='SELECT'&&par.name||this.id;if(!n||this.disabled||this.type=='reset'||(this.type=='checkbox'||this.type=='radio')&&!this.checked||!ok[this.nodeName.toUpperCase()]||(this.type=='submit'||this.type=='image')&&this.form.clicked!=this||(p=='SELECT'||p=='OPTGROUP')&&!this.selected)return;if(this.type=='image'&&this.form.clicked_x)
return a.push({name:this.name+'_x',value:this.form.clicked_x},{name:this.name+'_y',value:this.form.clicked_y});a.push({name:n,value:this.value});});this.vars=a;return this;};$(document).ready(function()
{$('#preview').bind('click',function(){var oForm=$('#message_form');var composeForm=$(oForm).serialize();var oParams={};for(i=0;oItem=composeForm.vars[i];i++)
{if(oItem.name=='option[]')
{if(oItem.value.length>0)
{oParams['option['+i+']']=oItem.value;}}
else
{oParams[oItem.name]=oItem.value;}}
oParams['framework']='inline-popup';if(document.getElementById('GVResponse'))
{oMessage.hide();}
var url=$(oForm).attr('action');var sAction=oParams['action'];if(sAction=="addpoll")
{oParams['action']='previewpoll';}
else
{oParams['action']='preview';}
url=oParams['previewurl'];$("#previewMessage").load(url,oParams,function()
{TB_show('Message Preview','#TB_inline?height=500&width=630&inlineId=previewMessage');});return false;});$('.advLink').bind('click',function(){var sType=$('#action').val();var url=$('.advLink').href();sType=sType.replace("help-search-","");if(sType!="blog")
{sType=sType+"/advanced";}
this.href=url+sType;});});