function showLoading(divid){ dialog = getElementId(divid); dialog.style.display='block'; } function hideLoading(divid){ dialog = getElementId(divid); dialog.style.display='none'; } function Forum(){ this.preloader = new PreLoader(); this.handleFailure=function(o){alert("failed to retrieve data!");} //////////////////////////////// this.post=function(topicId,city_id){ forumURL = GLOBAL_URI+"forum/addThread/"+topicId+"/"+city_id+".html?ajaxcall=true"; x = getElementId("threadForm"); handleSuccess = function( o ){ if(parseInt(o.responseText) == 1){ location.href=GLOBAL_URI+"forum/view/"+topicId+"/"+city_id+".html"; } else {getElementId("postThreadDiv").innerHTML=o.responseText; } } callback={success:handleSuccess,failure:this.handleFailure} YAHOO.util.Connect.setForm(x); YAHOO.util.Connect.asyncRequest("POST", forumURL, callback); } this.preview=function(topicId){ getElementId("msgBox").innerHTML=''; getElementId("msgBox2").innerHTML=''; if(document.threadForm.title.value == ''){ getElementId("msgBox").innerHTML="You must provide a subject for your new post."; } if(document.threadForm.thread.value == ''){ getElementId("msgBox2").innerHTML="You must provide a body for your new post."; } if(document.threadForm.title.value != '' && document.threadForm.thread.value != ''){ forumURL = GLOBAL_URI+"forum/preview/"+topicId+"?ajaxcall=true"; x = getElementId("threadForm"); handleSuccess = function( o ){ getElementId("postThreadDiv").innerHTML=o.responseText; //alert(o.responseText); //location.href=GLOBAL_URI+"forum/view/"+topicId; } callback={success:handleSuccess,failure:this.handleFailure} YAHOO.util.Connect.setForm(x); YAHOO.util.Connect.asyncRequest("POST", forumURL, callback); } } this.previewReply=function(threadId,topic,city_id){ getElementId("msgBox").innerHTML=''; getElementId("msgBox2").innerHTML=''; if(document.threadForm.title.value == ''){ getElementId("msgBox").innerHTML="You must provide a subject for your new post."; } if(document.threadForm.thread.value == ''){ getElementId("msgBox2").innerHTML="You must provide a body for your new post."; } if(document.threadForm.title.value != '' && document.threadForm.thread.value != ''){ forumURL = GLOBAL_URI+"forum/previewReply/"+threadId+","+topic+","+city_id+"?ajaxcall=true"; x = getElementId("threadForm"); handleSuccess = function( o ){ getElementId("postThreadDiv").innerHTML=o.responseText; //alert(o.responseText); //location.href=GLOBAL_URI+"forum/view/"+topicId; } callback={success:handleSuccess,failure:this.handleFailure} YAHOO.util.Connect.setForm(x); YAHOO.util.Connect.asyncRequest("POST", forumURL, callback); } } this.postThread=function(threadId,topicId,city_id){ forumURL = GLOBAL_URI+"forum/addReply/"+threadId+"/"+topicId+"/"+city_id+".html?ajaxcall=true"; x = getElementId("threadForm"); handleSuccess = function( o ){ if(parseInt(o.responseText) == 1){ location.href=GLOBAL_URI+"forum/posts/"+threadId+"/"+topicId+"/"+city_id+".html"; } else {getElementId("postThreadDiv").innerHTML=o.responseText; } } callback={success:handleSuccess,failure:this.handleFailure} YAHOO.util.Connect.setForm(x); YAHOO.util.Connect.asyncRequest("POST", forumURL, callback); } this.subscribeOptions=function(topicId){ location.href = "#wrapper"; getElementId('subscribeDialog').style.display='block'; subscribeDialog.show(); forumURL = GLOBAL_URI+"forum/subscribeForm/"+topicId+".html?ajaxcall=true"; handleSuccess = function( o ){ getElementId('subscribeOptions').innerHTML = o.responseText; } callback={success:handleSuccess,failure:this.handleFailure} YAHOO.util.Connect.asyncRequest("GET", forumURL, callback); } this.subscribe=function(){ forumURL = GLOBAL_URI+"forum/subscribe/?ajaxcall=true"; showLoading("subFormLoad"); x = getElementId("subscribe"); handleSuccess = function( o ){ hideLoading("subFormLoad"); getElementId('subscribeOptions').innerHTML = o.responseText; } callback={success:handleSuccess,failure:this.handleFailure} YAHOO.util.Connect.setForm(x); YAHOO.util.Connect.asyncRequest("POST", forumURL, callback); } }