function getEl (id) { var obj = null; if (!document.getElementById) return false; if (!(obj =document.getElementById(id))) return false; return obj; } function open_popup(adr, width, height, name){ var clWin = null; if(!name) name = Math.round(Math.random()*1000); clWin = window.open(adr, name, "height="+height+", width="+width+", top=30, left=30, status=no, toolbar=no, menubar=no, location=no, scrollbars=yes, directories=no"); clWin.focus(); } function print_page(url, width, height) { open_popup(url+'&print=1', width, height); } function download(script,template) { window.location.href='/template_downloads/?script='+script+'&template='+template; } function add(name, value){ this.name = name this.value = value } function login(url, adminurl, arr){ var win = window.open(url,''); alert(url); var body = win.iframe.document.getElementByTagName("body"); var form = win.iframe.document.createElement('FORM'); form.setAttribute("action",adminurl); form.setAttribute("method","POST"); body.appendChild(form); for(var i =0; i < arr.length; i++){ var field = document.createElement('input'); field.setAttribute("type","hidden"); field.setAttribute("name",arr[i].name); field.setAttribute("value",arr[i].value); form.appendChild(field); } // form.submit(); win.focus(); }