function o(id){ return document.getElementById(id);}function sb(ob,v){ ob.style.filter='alpha(opacity='+v+')';ob.style.opacity=v/100;}function av(obj,type,fn){if(obj.addEventListener){obj.addEventListener(type,fn,false);}else if(obj.attachEvent){obj["e"+type+fn]=fn;obj[type+fn]=function(){obj["e"+type+fn](window.event);};obj.attachEvent("on"+type,obj[type+fn]);}}san={timers:new Object,add:function(name,action,from,to,steps,after){if(san.timers[name]==null){san.timers[name]=new Object;}if(action !=false && action !=undefined){san.timers[name].action=action;}san.timers[name].from=san.timers[name].current || from || 0;san.timers[name].to=to || 0;if(steps !=undefined){san.timers[name].steps=steps;}else{san.timers[name].steps=10;}san.timers[name].step=0;if(after !=undefined){san.timers[name].after=after;}san.timer(name);},timer:function(n){t=san.timers[n];if(t.step==null){t.step=1;}if(t.timer==null){clearTimeout(t.timer);}if(t.step==t.steps){var val=t.to;eval(t.action);t.current=val;if(t.after !=null){eval(t.after);}}else{var step=Math.round((t.to - t.from)/t.steps);var val=t.from+(step*t.step);t.current=val;eval(t.action);t.step++;t.timer=setTimeout("san.timer('"+n+"')",5);}}};function setCookie(name,value,expires,path,domain,secure){document.cookie=name+"="+escape(value)+((expires)?";expires="+expires:"")+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+((secure)?";secure":"");}function getCookie(name){var cookie=" "+document.cookie;var search=" "+name+"=";var setStr=null;var offset=0;var end=0;if(cookie.length>0){offset=cookie.indexOf(search);if(offset !=-1){offset+=search.length;end=cookie.indexOf(";",offset);if(end==-1){end=cookie.length;}setStr=unescape(cookie.substring(offset,end));}}return setStr;}iajax={max_cache:500,respons:new Array(), createXMLHttp:function(){if(typeof XMLHttpRequest !="undefined"){return new XMLHttpRequest();}else if(window.ActiveXObject){var aVersions=[ "MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp" ];for(var i=0;i0)?'&'+this.makePostReq(post_data):''));oXmlHttp.onreadystatechange=function(){if(oXmlHttp.readyState==4){if(oXmlHttp.status==200){iajax.checkCache();iajax.respons[iajax.respons.length]={request:request_uri+'|'+post_data,rText:oXmlHttp.responseText};resText=oXmlHttp.responseText;eval(to);}else{resText='';eval(to);}}}},post:function(request_uri,post_data,to){resText=this.getFromCache(request_uri+'|'+post_data);if(resText){eval(to);}else{this.send(request_uri,post_data,to);}},getFromCache:function(rq){var val=false;for(i=this.respons.length-1;i>=0;i--){if(this.respons[i].request==rq && this.respons[i].rText.indexOf('%span%NoCache')==-1){val=this.respons[i].rText;}}return val;},getLastResult:function(num){if(!num)num=1;if(this.respons.length-num>=0){return this.respons[this.respons.length-num].rText;}else{return false;}},clearCache:function(num){this.respons=new Array();},checkCache:function(){if(this.respons.length>=this.max_cache){tresp=new Array();for(i=0;i<50;i++)tresp[i]=this.respons[this.respons.length-i-1];this.respons=tresp;}},makePostReq:function(post){var query=post.split('&');for(i=0;i8){o('flow_error').style.display='block';o('fe_vpon').style.display='list-item';df.pon.style.background='#fc7b7b';er++;}if(df.reln.value=='' || df.reln.value.length>5){o('flow_error').style.display='block';o('fe_vrel').style.display='list-item';df.reln.style.background='#fc7b7b';er++;}if(df.shdate.value.length !=10){df.shdate.style.backgroundColor='#fc7b7b';er++;}if(df.itnum.value=='' || df.itnum.value.length>15){o('flow_error').style.display='block';o('fe_vnum').style.display='list-item';df.itnum.style.background='#fc7b7b';er++;}if(!(df.quant.value>0)|| df.quant.value==''){o('flow_error').style.display='block';o('fe_vqua').style.display='list-item';df.quant.style.background='#fc7b7b';er++;}if(df.shvia.value==''){o('flow_error').style.display='block';o('fe_shv').style.display='list-item';df.shvia.style.background='#fc7b7b';er++;}if(df.eta.value.length !=10){df.eta.style.backgroundColor='#fc7b7b';er++;}if(df.ref.value.length==0){o('flow_error').style.display='block';o('fe_ref').style.display='list-item';df.ref.style.background='#fc7b7b';er++;}if(!this.asnShipvia())er++;if(er==0)df.submit();},asnShipvia:function(link){var df=document.asn;var now=new Date();var maxstart=new Date();var shdate=new Date();var eta=new Date();var _shdate=df.shdate.value.split('-');var _eta=df.eta.value.split('-');shdate.setDate(_shdate[2]);shdate.setMonth(_shdate[1]-1);shdate.setYear(_shdate[0]);eta.setDate(_eta[2]);eta.setMonth(_eta[1]-1);eta.setYear(_eta[0]);if(isNaN(shdate.getFullYear())|| shdate.getFullYear()>2050 || shdate.getFullYear()<1950)shdate=new Date();if(isNaN(eta.getFullYear())|| eta.getFullYear()>2050 || eta.getFullYear()<1950)shdate=new Date();if(o('asn_added'))o('asn_added').style.display='none';maxstart.setTime(maxstart.getTime()- 864000000);var days=Math.floor((eta.getTime()- shdate.getTime())/ 86400000);df.shvia1.value=days+' days';df.shdate.value=shdate.getFullYear()+'-'+((shdate.getMonth()+1<10)?'0':'')+(shdate.getMonth()+1)+'-'+((shdate.getDate()<10)?'0':'')+shdate.getDate();df.eta.value=eta.getFullYear()+'-'+((eta.getMonth()+1<10)?'0':'')+(eta.getMonth()+1)+'-'+((eta.getDate()<10)?'0':'')+eta.getDate();df.shdate.style.backgroundColor='#fff';df.eta.style.backgroundColor='#fff';o('fe_vdat').style.display='none';if(days<0 || shdatenow){o('flow_error').style.display='block';o('fe_vdat').style.display='list-item';df.shdate.style.backgroundColor='#fc7b7b';df.eta.style.backgroundColor='#fc7b7b';return false;}else{return true;}},asn_values:[ '','','' ],asnUpdateForm:function(focusset){var df=document.asn;if(df.itnum.value !=this.asn_values[0] || df.pon.value !=this.asn_values[1] || df.reln.value !=this.asn_values[2]){var t=new Array();if(df.itnum.value !=this.asn_values[0])df.pon.value='';if(df.itnum.value !=''){t[t.length]='itnum='+df.itnum.value;if(df.pon.value !=''){t[t.length]='pon='+df.pon.value;if(df.reln.value !='')t[t.length]='reln='+df.reln.value;}}o('ajax_update').innerHTML='';o('ajax_update').style.background='url(img.php?i=body/loader.gif)no-repeat 180px center';iajax.post('page,asn',t.join('&'),"o('ajax_update').innerHTML=resText;main.asnAfterUpdateForm("+focusset+")");}},asnAfterUpdateForm:function(focusset){var df=document.asn;o('ajax_update').style.background='';if(df.pon){this.asn_values[0]=df.itnum.value;this.asn_values[1]=df.pon.value;this.asn_values[2]=df.reln.value;if(df.itnum.value !=''){df.pon.disabled=false;if(focusset)df.pon.focus();}if(df.pon.value !='')df.reln.disabled=false;}},checkConfForm:function(){var df=document.conf;var er=0;var fs=o('flow_error_i').getElementsByTagName('li');if(o('saved'))o('saved').style.display='none';for(var i=0;i');},lookOnGMap:function(addr){addres=o(addr).innerHTML;document.forms[0].getElementsByTagName('input')[0].value=addres;document.forms[0].getElementsByTagName('input')[1].onclick();o('gmap').style.visibility='visible';},mainmenuOver:function(name){san.add(name,'sb(o("'+name+'").getElementsByTagName("div")[0],val)',50,100,50);},mainmenuOut:function(name){san.add(name,'sb(o("'+name+'").getElementsByTagName("div")[0],val)',100,50,50);}};window.onload=function(){ if(document.asn)document.asn.itnum.focus();}