/* =================== /* Program : Ajax Commucator Version : 1.7 Author : Neil Yuming Kuo @ Jaby Group [http://jaby.heyxu.com] Website : http://match.heyxu.com/user/neil or http://neil.heyxu.com Email : neilbaby.k at gmail.com /* =================== */ var ProcessTimer; var StepChecker=-1; var http_request = false; var Executing = false; var RequestQueue=[]; var RequestCache=[]; var RequestCacheName=""; var TryTime = 3; var RequestData=false; var AjaxFileBoxSelectedID=''; if (window.ActiveXObject)var OperSystem = 'IE'; //ie if (window.XMLHttpRequest)var OperSystem = 'MF'; //Mozilla and firefox,Safari,... document.write('
'); document.write(''); document.write(''); document.write(''); document.write(''); /* Upload form ------ */ function InitAjaxFileBox(submit_link,condition){ AjaxFileBoxSelectedID=''; //only way to set innerHTML by object name (ie,mf) AjaxFileBox.document.charset ='big5'; AjaxFileBox.document.body.innerHTML=""; } function AjaxChoiseFileObj(evt,obj_id){ var AjaxFileBoxForm = AjaxFileBox.document.getElementById('AjaxFileBoxForm'); if(!AjaxFileBoxForm)return false; var evt = evt||window.event; var frm = document.getElementById('AjaxFileBox'); var obj = AjaxFileBox.document.getElementById(obj_id); if(AjaxFileBoxSelectedID==''){ obj.style.top='0px'; obj.style.left='-25px'; frm.style.width='20px'; frm.style.height='20px'; } else if(AjaxFileBoxSelectedID!=obj_id){ var a=AjaxFileBox.document.getElementById(AjaxFileBoxSelectedID); a.style.top='100px';a.style.left='100px'; obj.style.top='0px';obj.style.left='-25px'; } AjaxFileBoxSelectedID=obj_id; frm.style.left=evt.clientX-10+document.body.scrollLeft; frm.style.top=evt.clientY-15+document.body.scrollTop; } /* Upload form File-Add */ function AjaxAddFile(file_id,func){ var AjaxFileBoxForm = AjaxFileBox.document.getElementById('AjaxFileBoxForm'); if(!AjaxFileBoxForm)return false; if(AjaxFileBoxForm.childNodes[file_id])return true; //alert(AjaxFileBoxForm.childNodes); //if(AjaxFileBoxForm.children==undefined){alert('IE supported only');return false;} //if(AjaxFileBoxForm.children(file_id))return true; var oinput = AjaxFileBox.document.createElement('input'); oinput.setAttribute('type','file'); oinput.setAttribute('id',file_id); oinput.setAttribute('name',file_id); oinput.style.position='absolute'; oinput.style.left='100px'; oinput.style.top='100px'; oinput.style.cursor='pointer'; oinput.size='1'; oinput.onreadystatechange=func; oinput.onchange =func; var d = AjaxFileBoxForm.appendChild(oinput); } /* Upload form File-Add */ function AjaxRemoveFile(file_id){ var AjaxFileBoxForm = AjaxFileBox.document.getElementById('AjaxFileBoxForm'); var ochild = AjaxFileBox.document.getElementById(file_id); if(ochild!=null) AjaxFileBoxForm.removeChild(ochild); } /* LoadBox----------- */ function ShowLoadBox(sw){ if(sw==0)var frid='AjaxLoadBox'; if(sw==1)var frid='AjaxUploadBox'; var AjaxLoadBox = document.getElementById(frid); var Img = document.getElementById("BoxImg"); AjaxLoadBox.style.top = (document.body.clientHeight/2)-(AjaxLoadBox.offsetHeight/2)+(document.body.scrollTop)-Math.floor(gBrowser.imgHeight(Img)/2); AjaxLoadBox.style.left = (document.body.clientWidth/2)-(AjaxLoadBox.offsetWidth/2)+(document.body.scrollLeft)-Math.floor(gBrowser.imgWidth(Img)/2); AjaxLoadBox.style.display = 'block'; showDiv(frid,'Help'+frid,true); } function CloseLoadBox(sw){ if(sw==0)var frid='AjaxLoadBox'; if(sw==1)var frid='AjaxUploadBox'; var AjaxLoadBox = document.getElementById(frid); AjaxLoadBox.style.display = 'none'; showDiv(frid,'Help'+frid,false); } /* Request ---------- */ function AjaxRequestSilence(iUrl,iParam){return AjaxHandle(0,1,iUrl,iParam);} function AjaxRequest(iUrl,iParam){return AjaxHandle(0,0,iUrl,iParam);} function AjaxHandle(iQueue,iSilence,iUrl,iParam){ //escape(?); if(!iQueue)RequestQueue[RequestQueue.length] = [iSilence,iUrl,iParam]; if(Executing ||RequestQueue.length<1)return true; Executing = true; iSilence = RequestQueue[0][0]; iUrl = RequestQueue[0][1]; iParam = RequestQueue[0][2]; RequestQueue = RequestQueue.slice(1); // caching or not RequestCacheName=""; for(var x=0;x