/** * @name: global.js * @author: Albert Harounian * @copyright: inManage LTD * @since: August 1, 2007 * @desc: Global JS functions */ var dlgWin = null; var ie = /msie/i.test(navigator.userAgent); function obj(id,type,elm){ switch(type){ case "tag": if(elm.getElementsByTagName(id)){ return elm.getElementsByTagName(id); } break; case "id": default: if(document.getElementById(id)){ return document.getElementById(id); } } } function show(id){ if(typeof id=='object'){ id.style.display = 'block'; }else{ obj(id).style.display = 'block'; } } function hide(id){ if(typeof id=='object'){ id.style.display = 'none'; }else{ obj(id).style.display = 'none'; } } function switchDisplay(id){ if(typeof id=='object'){ id.style.display = id.style.display == '' ? 'none' : ''; }else{ obj(id).style.display = obj(id).style.display == '' ? 'none' : ''; } } function innerData(id, data){ if(typeof id=='object'){ id.innerHTML = data; }else{ obj(id).innerHTML = data; } } function gotoURL(url){ document.location.href = url; } function newWindow(mypage,myname,w,h,scroll,pos){ if (typeof pos == 'undefined') pos='center'; if (typeof scroll == 'undefined') scroll='auto'; if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;} if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;} else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20} settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no'; if(dlgWin){dlgWin.close();} dlgWin=window.open(mypage,myname,settings); } function invertValue(inpId, Event, txt){ switch(Event){ case "focus": if(inpId.value==txt){ inpId.value=''; } break; case "blur": if(inpId.value==''){ inpId.value=txt; } break; } } function initTxtInputs(){ var inps = obj("input","tag",document); for(i=0;i