
var rooster_uri='/ajax/rooster_ajax.php';function urlencode(str){return encodeURIComponent(str);}
function ajaxEncodeForm(form)
{var codedString='';var ampersand='';var formLength=form.elements.length;for(index=0;index<formLength;index++){var element=form.elements[index];var placeholderValue=element.getAttribute('placeholder');if(placeholderValue!==null&&placeholderValue==element.value)
continue;if(!element.name||element.name==''||element.name=='undefined'||!element.value||element.value==''){continue;}
switch(element.type){case'text':case'hidden':case'password':case'textarea':case'select-one':codedString+=ampersand+element.name+'='+urlencode(element.value);break;case'radio':case'checkbox':if(element.checked)
codedString+=ampersand+element.name+'='+urlencode(element.value);break;}
ampersand='&';}
return codedString;}
function hideRooster(divid,constructForm){ge(divid).style.display='none';if(constructForm!=null){var formIdStr='temp_rooster_form';var form=document.createElement('form');form.action='/ajax/rooster_ajax.php';form.method='post';form.style.display='none';form.id=formIdStr;var input=document.createElement('input');input.type='hidden';input.name='post_form_id';input.value=ge('post_form_id').value;form.appendChild(input);var input=document.createElement('input');input.type='hidden';input.name='storytype';input.value=ge('storytype').value;form.appendChild(input);var input=document.createElement('input');input.type='hidden';input.name='storyid';input.value=ge('storyid').value;form.appendChild(input);document.body.appendChild(form);ajaxSubmitForm(formIdStr,'');}else{ajaxSubmitForm(divid,'');}
return false;}
function submitTOS(divid){form=document.forms[divid];if(form){ackElement=form.elements['ack'];if(ackElement){if(ackElement.checked){ge(divid).style.display='none';ajaxSubmitForm(divid,'');}}}
return false;}
function submitSecurity(divid){form=document.forms[divid];if(form){ansElement=form.elements['seca'];if(ansElement&&ansElement.value!=''){ge(divid).style.display='none';ajaxSubmitForm(divid,'');}}
return false;}
function submitBday(divid){form=document.forms[divid];if(form){month=form.elements['birthday_month'];day=form.elements['birthday_day'];year=form.elements['birthday_year'];if((month&&month.value>0)&&(day&&day.value>0)&&(year&&year.value>0)){ge(divid).style.display='none';ajaxSubmitForm(divid,'');}}
return false;}
function submitEmail(divid,emailid){form=document.forms[divid];if(form){email=form.elements[emailid];if(email&&email.value!=''&&is_email(email.value)){ge(divid).style.display='none';ajaxSubmitForm(divid,'');}}
return false;}
function showEmailEntry(divid){form=document.forms[divid];if(form){if(form.style.display=='none'){form.style.display='block';form.elements['newemail'].focus();}else{form.elements['newemail'].value='';form.style.display='none';}}
return false;}
function resendEmail(divid,type,id){if(divid!=''&&type!=''){form=document.forms[divid];if(form){if(form.elements['newemail']){form.elements['newemail'].value='';}
ge(divid).style.display='none';ajaxSubmitForm(divid,'&resend=1');}}
return false;}
function cancelEmail(divid,type,id){if(divid!=''&&type!=''){form=document.forms[divid];if(form){if(form.elements['newemail']){form.elements['newemail'].value='';}
ge(divid).style.display='none';ajaxSubmitForm(divid,'&cancel=1');}}
return false;}
function toggleHelp(spanid){ele=ge(spanid);ele.style.display=(ele.style.display=='none')?'block':'none';}
function ajaxSubmitForm(formid,extra)
{var codedForm=ajaxEncodeForm(document.forms[formid]);var query=(codedForm+extra);var ajax=new Ajax();ajax.onDone=function(ajaxObj,responseText){}
ajax.onFail=function(ajaxObj){}
ajax.post(rooster_uri,query,false,true);return false;}
