String.prototype.fx=function(){var parts=this.split(".");var fnc=window;var len=parts.length;for(var i=0;i < len;i++){fnc=fnc[parts[i]];}fnc.apply(this,arguments);} $(document).ready(function(){$('body').click(function(){if ($(':focus')[0]) click_id=($(':focus')[0]['id']||'');else click_id='';for (var key in popup_divs){var value=popup_divs[key];if (!click_id||!is_in(click_id, key)){if (value){$('#'+key).hide();popup_divs[key]=0;}}}});});function between(p_test, p_left, p_right){return (p_test >= p_left&&p_test <= p_right ? true : false);}function bg_fade(p_uid, red1, grn1, blu1, red2, grn2, blu2, steps){sred=red1;sgrn=grn1;sblu=blu1;ered=red2;egrn=grn2;eblu=blu2;inc=steps;step=0;bg_fade_fx(p_uid);}function bg_fade_fx(p_uid){var epct=step/inc;var spct=1-epct;var v_rgb=Math.floor(sred*spct+ered*epct)*256*256+Math.floor(sgrn*spct+egrn*epct)*256+Math.floor(sblu*spct+eblu*epct);var v_hex=v_rgb.toString(16);document.getElementById(p_uid).style.backgroundColor=v_hex;if ( step < inc ){setTimeout('bg_fade_fx("'+p_uid+'")',50);}step++;}function block_collapse(div_id){var which_div=document.getElementById(div_id);if (!which_div){return;}which_div.className='blockcollapse';}function block_expand(div_id){var which_div=document.getElementById(div_id);if (!which_div){return;}which_div.className='blockexpand';}function browser_window_size(){var x=0, y=0;if( typeof( window.innerWidth )=='number' ){x=window.innerWidth;y=window.innerHeight;} else if (document.documentElement&&(document.documentElement.clientWidth ||document.documentElement.clientHeight)){x=document.documentElement.clientWidth;y=document.documentElement.clientHeight;}else if (document.body&&(document.body.clientWidth||document.body.clientHeight)){x=document.body.clientWidth;y=document.body.clientHeight;}return [x, y];}function captcha_image(mydiv){document.getElementById(mydiv).innerHTML='';var elem=document.createElement('img');var uid2=uniqid();elem.setAttribute('src', '/utils/captcha_code.php?uid='+mydiv+'&nocache='+uid2);elem.setAttribute('height', '30');elem.setAttribute('width', '85');elem.setAttribute('alt', 'Captcha Code');document.getElementById(mydiv).appendChild(elem);}function cookieCreate(name,value,days){if (days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires=";expires="+date.toGMTString();}else var expires="";document.cookie=name+"="+value+expires+";path=/";}function cookieRead(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i < ca.length;i++){var c=ca[i];while (c.charAt(0)==' ') c=c.substring(1,c.length);if (c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length);}return null;}function cookieDelete(name){cookieCreate(name,"",-1);}function dnd_allow_drop(ev){ev.preventDefault();}function dnd_drag(ev){ev.dataTransfer.setData('text/plain', ev.target.id);}function dnd_drop(ev){ev.preventDefault();var data=ev.dataTransfer.getData('text/plain');dnd_drop_action(data)}function element_id(p_id){return document.getElementById(p_id);}function element_bgcolor(eid, color){eid.style.background=color;}function element_scroll_to(pageElement, voffset){var positionX=0, positionY=0;while(pageElement != null){positionX += pageElement.offsetLeft;positionY += pageElement.offsetTop;if (voffset) positionY += voffset;pageElement=pageElement.offsetParent;window.scrollTo(positionX, positionY);}}function is_blank(str){return (!str||/^\s*$/.test(str));}function is_empty(str){return (!str||0 === str.length);}function execute_scripts_id(whichtarget){var div=document.getElementById(whichtarget);var x=div.getElementsByTagName('script');for(var i=0;i', '');while(script){eval(script);str=str.replace('');}}function exit(){throw new FatalError('Something went badly wrong!');}function flash_field(p_uid){bg_fade(p_uid, 0, 255, 0, 255, 255, 255, 10);}function flash_field_error(p_uid){bg_fade(p_uid, 255, 0, 0, 255, 255, 255, 10);}function form_add(p_id, p_key, p_value){var v_form=document.getElementById(p_id);var v_input=document.createElement('input') ;v_input.setAttribute('name', 'form['+p_key+']') ;v_input.setAttribute('type', 'hidden') ;v_input.setAttribute('value', p_value);v_form.appendChild(v_input);}function form_submit(form_id){var whichform=document.forms[form_id];if (whichform){HTML_AJAX.formSubmit(whichform, 'target');}}function form_value(p_id, p_field){return document.getElementById(p_id).elements[p_field].value;}function form_value_put(p_id, p_field, p_value){document.getElementById(p_id).elements[p_field].value=p_value;}function getElementsByStyleClass(className){var all=document.all ? document.all : document.getElementsByTagName('*');var elements=new Array();for (var e=0;e < all.length;e++){if (all[e].className==className) elements[elements.length]=all[e];}return elements;}function getObjById(name){if (document.getElementById){this.obj=document.getElementById(name);this.style=document.getElementById(name).style;}else if (document.all){this.obj=document.all[name];this.style=document.all[name].style;}else if (document.layers){this.obj=getObjNN4(document,name);this.style=this.obj;}}function getObjNN4(obj,name){var x=obj.layers;var foundLayer;for (var i=0;i= 0){return 1;}else{return 0;}}function is_ini(haystack, needle){if (haystack.toLowerCase().indexOf(needle.toLowerCase()) >= 0){return 1;}else{return 0;}}var ac_last='';var ac_last_time=0;var ac_next='';var ac_next_time=0;function js_autocomplete(p_link, p_target, p_delay){p_delay=(p_delay||200);if ((Date.now()-ac_last_time)ac_last_time) js_autocomplete(ac_next, p_target);ac_next='';}}function js_autocomplete_response(jsonarray){var v_html=jsonarray['html'];var v_target=jsonarray['target'];$('#'+v_target).html(v_html);js_autocomplete_pending(v_target);}function link_confirm(url, message){if (!message){message='Please Confirm';}if (confirm(message)){location.href=url;}}function link_input(url, text, force, pdef, progress){var myval=prompt(text, (pdef||''));if (myval||force){if (progress) messx('Please Wait');location.href=url+myval;}}function link_new_tab(url){window.open(url, '_blank');}function link_new_tab_input(url, text, force, pdef){var myval=prompt(text, (pdef||''));if (myval||force){window.open(url+myval, '_blank');}}function link_new_tab_input_post(url, text, force, pdef){var myval=prompt(text, (pdef||''));if (myval||force){var mapForm=document.createElement('form');mapForm.target='_blank';mapForm.method='POST';mapForm.action=url;var mapInput=document.createElement('input');mapInput.type='text';mapInput.name='i';mapInput.value=(myval||'');mapForm.appendChild(mapInput);document.body.appendChild(mapForm);mapForm.submit();}}function link_popup(p_url, p_name, p_w, p_h){p_w=(p_w||0.50);var v_win=popup_window(p_url, p_name, p_w, p_h);if (v_win){v_win.focus()}}function link_popup_big(url, name){var win=popup_window(url, name, 0.80);if (win){win.focus()}}function link_popup_big_form(myform,name){if (!window.focus) return true;var win=popup_window('', name, 0.80);myform.target=name;return true;}function link_popup_confirm(url,message){if (!message){message='Please Confirm';}if (confirm(message)){link_popup(url);}}function link_popup_confirm_big(url,message){if (!message){message='Please Confirm';}if (confirm(message)){link_popup_big(url);}}function link_popup_form(p_id,p_name,p_w,p_h){p_name=(p_name||uniqid());var v_form=document.getElementById(p_id);var v_win=link_popup('',p_name,p_w,p_h);v_form.target=p_name;v_form.submit();}function link_popup_form_big(p_id,p_name){p_name=(p_name||uniqid());var v_form=document.getElementById(p_id);var v_win=link_popup_big('',p_name);v_form.target=p_name;v_form.submit();}function link_popup_input(url, text, name, force, pdef){var myval=prompt(text, (pdef||''));if (myval||force){link_popup(url+myval, name);}}function link_popup_input_big(url, text, name, force, pdef){var myval=prompt(text, (pdef||''));if (myval||force){link_popup_big(url+myval, name);}}function markup_add(num, pc){return round_price(num*(1+pc/100));}function messx(p_message, p_time){if (!p_message){p_message='Please Wait';}else{p_message=messx_cancel_html(p_message);}var v_subdiv="
"+p_message+"
";$('#messx').hide();document.getElementById('messx').innerHTML=v_subdiv;$('#messx').show();if (p_time){v_messxid=setInterval('messx_cancel("-F");', p_time*1000);}}function messx_cancel(flags){flags=(flags||'');if (typeof v_messxid != 'undefined'){clearInterval(v_messxid);}if (is_in(flags, '-F')) $('#messx').fadeOut('slow');else $('#messx').hide();}function messx_cancel_html(p_message){var v_click="[X]";if (p_message&&!is_in(p_message, '\n')) return p_message+' '+v_click;else if (p_message) return "
"+v_click+"
"+p_message;else return "
"+v_click+"
";}function messx_form(p_globals, p_recs, p_flags){if (p_recs){var v_link='?a=lib_form_quick&p='+encodeURIComponent(p_globals)+'&p2='+encodeURIComponent(p_recs)+'&p3='+encodeURIComponent(p_flags);messx_link(v_link);}}function messx_link(p_link){var v_html=fetch_url(p_link);var v_subdiv="
"+ messx_cancel_html()+v_html+"
";$('#messx').hide();document.getElementById('messx').innerHTML=v_subdiv;$('#messx').show();execute_scripts_id('messx');}function num_add(num1, num2){return num1*1+num2*1;}function parseUri(sourceUri){var uriPartNames=["source","protocol","authority","domain","port","path","directoryPath","fileName","query","anchor"];var uriParts=new RegExp("^(?:([^:/?#.]+):)?(?://)?(([^:/?#]*)(?::(\d*))?)?((/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[\?#]|$)))*/?)?([^?#/]*))?(?:\?([^#]*))?(?:#(.*))?").exec(sourceUri);var uri ={};for(var i=0;i < 10;i++){uri[uriPartNames[i]]=(uriParts[i] ? uriParts[i] : "");}if(uri.directoryPath.length > 0){uri.directoryPath=uri.directoryPath.replace(/\/?$/, "/");}return uri;}function play_sound(p_url){var v_audio=new Audio(p_url);v_audio.play();}var popup_divs=[];function popup_div(e, div_id0, action, param){var div_id='#'+div_id0;if ($(div_id).is(':visible')){$(div_id).hide();popup_divs[div_id0]=0;}else{var str=$(div_id).html();if (!str){str=fetch_url('?a='+action+'&p='+param);$(div_id).html(str);}$(div_id).hide();var ret=popup_div_place(e, div_id);xm=ret[0];ym=ret[1];$(div_id).css({'top':ym,'left':xm, 'position':'absolute'});$(div_id).show();popup_divs[div_id0]=1;}}function popup_div_place(e, div_id){ret=browser_window_size();x0=ret[0];y0=ret[1];xm=e.pageX;ym=e.pageY;xd=$(div_id).width();yd=$(div_id).height();if (x0-xm < xd) xm-=xd;if (y0-ym < yd) ym-=yd;return [xm, ym];}function popup_window(p_url, p_name, p_w, p_h){localStorage.setItem('last_seen', Date.now());p_name=(p_name||uniqid());if (!p_h){p_h=768*p_w;p_w=1360*p_w;}return window.open(p_url, p_name, "menubar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=yes,width="+p_w+",height="+p_h);}function post_data(myurl, myarray){var myform=document.createElement('form');myform.method='POST';myform.action=myurl;for (var mykey in myarray){var myinput=document.createElement('input') ;myinput.setAttribute('name', mykey) ;myinput.setAttribute('value', myarray[mykey]);myform.appendChild(myinput);}document.body.appendChild(myform);myform.submit();document.body.removeChild(myform);}function redirect(url){location.href=url;}function round_price(num){return Math.round(num *100)/100;}function send_form(p_form_id){var v_form=document.getElementById(p_form_id);v_form.submit();}function str_begins(haystack, needle){mylen=needle.length;if (haystack.substring(0, mylen)==needle) return true;}function str_ends(str, suffix){return str.indexOf(suffix, str.length-suffix.length) !== -1;}function str_pair(str, sleft, sright){var ret=str.match(sleft+'(.*?)'+sright);if (ret) return ret[1];}function str_replace_all(p_from, p_to, p_str){return p_str.split(p_from).join(p_to);}function table_edit_jsonstring(p_uid){if (str_ends(p_uid, '~checkbox')) var v_val=document.getElementById('myform').elements[p_uid].checked;else if (str_ends(p_uid, '~onoff')){var v_image=document.getElementById(p_uid).src;if (str_ends(v_image, 'switch_off.png')) var v_val=1;else var v_val=0;}else if (str_ends(p_uid, '~tickcross')){var v_image=document.getElementById(p_uid).src;if (str_ends(v_image, 'cross.gif')) var v_val=1;else var v_val=0;}else var v_val=document.getElementById('myform').elements[p_uid].value;var jsonobject ={'uid':p_uid,'value':v_val};return JSON.stringify(jsonobject);}function table_edit_reaction(jsonarray){var v_uid=jsonarray['uid'];var v_val=jsonarray['value'];if (str_ends(v_uid, '~checkbox')) ;else if (str_ends(v_uid, '~onoff')){if (v_val==1) document.getElementById(v_uid).src='/data/icons/switch_on.png';else document.getElementById(v_uid).src='/data/icons/switch_off.png';}else if (str_ends(v_uid, '~tickcross')){if (v_val==1) document.getElementById(v_uid).src='/data/icons/tick.gif';else document.getElementById(v_uid).src='/data/icons/cross.gif';}else{document.getElementById('myform').elements[v_uid].value=v_val;if (jsonarray['fail']) flash_field_error(v_uid);else flash_field(v_uid);}if (jsonarray['uid2']) document.getElementById(jsonarray['uid2']).innerHTML=jsonarray['value2'];if (jsonarray['message']) alert(jsonarray['message']);}function toggle_expansion(div_id,img_id,img1,img2){var which_div=document.getElementById(div_id);if (!which_div){return;}if (which_div.className=='blockexpand'){which_div.className='blockcollapse';}else{which_div.className='blockexpand';}if (img_id){var which_img=document.getElementById(img_id);if (which_img&&img1&&img2){var uri=parseUri(which_img.src);var prefix=uri['protocol']+'://'+uri['domain']+uri['directoryPath'];if(uri['fileName']==img1){which_img.src=prefix+img2;}else{which_img.src=prefix+img1;}}}}function toggle_visibility(div_id, p_force, p_speed){if (p_force=='visible') $('#'+div_id).show(p_speed);else if (p_force=='hidden') $('#'+div_id).hide(p_speed);else $('#'+div_id).toggle(p_speed);}function uniqid(p_prefix){p_prefix=(p_prefix||'');var ts=String(new Date().getTime()), i=0, out='';for(i=0;i