// check if this person supports ajax requests function can_ajax() { can_xml = (typeof window.XMLHttpRequest != 'undefined'); can_acx = (typeof window.ActiveXObject != 'undefined'); return (can_xml || can_acx); } // get the top position of an element $.fn.postop = function() { var postop = 0; var obj = this.get(0); while(obj && obj != null) { postop += obj.offsetTop; // - obj.scrollTop obj = obj.offsetParent; } return postop; }; // get the left position of an element $.fn.posleft = function() { var posleft = 0; var obj = this.get(0); if(obj) { posleft = obj.offsetLeft; while((obj = obj.offsetParent) != null) { posleft += obj.offsetLeft; } } return posleft; }; $.fn.asMenu = function(){ this.css('position','absolute').css('zIndex','99'); return this; }; $.fn.asLeftMenu = function(link) { show = this.css('display') == 'none'; this.hide(); if(show) { this.asMenu().css('left', link.posleft()+'px').css('top', (link.postop()+link.get(0).offsetHeight)+'px').slideDown("fast"); } return this; }; $.fn.asRightMenu = function(link) { show = this.css('display') == 'none'; this.hide(); if(show) { this.asMenu().css('left',(link.posleft()-(parseInt(this.css('width'))-parseInt(link.get(0).offsetWidth)))+'px').css('top',(parseInt(link.postop())+parseInt(link.get(0).offsetHeight)-1)+'px').slideDown("fast"); } return this; }; // expand the size of a textarea function expand_txt(id) { var elm = $('#'+id).get(0); if(elm.rows >= 20) { elm.rows = 30; } else { elm.rows += 3; } } // reduce the size of a textarea function reduce_txt(id) { var elm = $('#'+id).get(0); if(elm.rows <= 3) { elm.rows = 3; } else { elm.rows -= 3; } } // write the expand/reduce buttons for textareas function txt_control_btns(id) { document.writeln('
'); } // disable all submit and reset buttons on a page function disable_form_buttons() { $("//input[@type='submit'],//input[@type='reset']").each(function(i){ this.disabled = true; }); } // put a loader on the page var loaders = []; function push_loader(text) { loader_id = "loader"+loaders.length; $(document.body).append("