// JavaScript Document // Genereal functions function createCookie(name,value,days) { // create cookie 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 readCookie(name) { // read cookie 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 deleteCookie(name) { // delete cookie createCookie(name,"",-1); } function findObj(theObj, theDoc) // find an object with id or name { var p, i, foundObj; if(!theDoc) theDoc = document; if( (p = theObj.indexOf("?")) > 0 && parent.frames.length) { theDoc = parent.frames[theObj.substring(p+1)].document; theObj = theObj.substring(0,p); } if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj]; for (i=0; !foundObj && i < theDoc.forms.length; i++) foundObj = theDoc.forms[i][theObj]; for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) foundObj = findObj(theObj,theDoc.layers[i].document); if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj); return foundObj; } function countTag (TagName, theDoc) { // count given tag if(!theDoc) theDoc = document; // find tags var count=theDoc.getElementsByTagName(TagName); return count; } function ie() { // check if client browser is IE if (navigator.appName == 'Microsoft Internet Explorer') return true; } function netscape() { // check if client browser is Netscape if (navigator.appName == 'Netscape') return true; } function opera() { // check if client browser is Opera if (navigator.appName == 'Opera') return true; } function confirmDelete(delUrl, warning) { // delete confirmation if (confirm(warning)) { document.location = delUrl; } } function disable(obj) { // disable object findObj(obj).disabled = true; } function enable(obj) { // enable object findObj(obj).disabled = false; } function show(obj) { // show object findObj(obj).style.visibility = 'visible'; } function hide(obj) { // hide object findObj(obj).style.visibility = 'hidden'; } // Ajax related function GetXmlHttpObject() { var objXMLHttp=null; if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); } return objXMLHttp; } function ajax_load(url, query, Obj) { function ajax_result() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { findObj(Obj).innerHTML=xmlHttp.responseText; } } xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { return; } url=url+"?"+query; url=url+"&sid="+Math.random(); xmlHttp.open("GET",url,true); xmlHttp.send(null); if(Obj !=''){ xmlHttp.onreadystatechange=ajax_result; } } ////////////////////////// // Form related function getRadioValue(radioObj) { if(!radioObj) return ""; var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return radioObj.value; else return ""; for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } } return ""; } // set the radio button with the given value as being checked // do nothing if there are no radio buttons // if the given value does not exist, all the radio buttons // are reset to unchecked function setCheckedValue(radioObj, newValue) { if(!radioObj) return; var radioLength = radioObj.length; if(radioLength == undefined) { radioObj.checked = (radioObj.value == newValue.toString()); return; } for(var i = 0; i < radioLength; i++) { radioObj[i].checked = false; if(radioObj[i].value == newValue.toString()) { radioObj[i].checked = true; } } } //////////////////////////// JavaScript Document // Interface related functions function collapseFrame(c, e, cp, ep) { // collapse or expand frame var c; var e; var cp; var ep; if (document.getElementById("collapse_expand").align == 'right') { parent.document.all['frameset'].cols = +c+',*'; collapse_expand.align = 'left'; document.getElementById("collapse_expand_img").src = ep; } else { parent.document.all['frameset'].cols = +e+',*'; collapse_expand.align = 'right'; document.getElementById("collapse_expand_img").src = cp; } } function loading() { // show loading message until the page loads completely findObj("loading").style.display = 'none'; } ////////////////////////// // Toolbar Functions function save(form) { // save action findObj(form).submit(); } function copy() { // copy action therange=document.selection.createRange(); therange.execCommand("Copy"); } function cut() { // cut action therange=document.selection.createRange(); therange.execCommand("Cut"); } function setpastepoint(f, fn) { if (f && fn) { findObj('paste').onclick = function(){paste(f,fn)}; } else findObj('paste').onclick = ''; } function paste(f,fn) { // paste action if (!f && !fn) return; document.all[f.name][fn].focus(); therange = document.selection.createRange(); therange.execCommand("Paste"); } function refresh() { // refresh action location.reload(1);} function back() { // history back action history.back(); } function frwd() { // history forward action history.forward(); } function home(path) { // go home page action location.href = path+'mainframe';} function wtoolbar(m, form) { // create toolbar // check browser ie4 = (document.all)? true : false; // define vars var input = countTag('input'); var textarea = countTag('textarea'); var img = countTag('img'); var content = ""; var spacer = ""; function tbutton(act, title, actvars) { // create button if (!actvars) actvars = ""; if (ie()) var id = act; var over = "this.style.border = \'solid #cccccc 2px\'"; var down = "this.style.border = \'solid #ffcc00 2px\'"; var out = "this.style.border = \'solid #ffffff 2px\'"; var up = "this.style.border = \'solid #999999 2px\'"; button = ""; return button; } // save button if ((m == '1' || m == '2') && form) content += tbutton('save', 'Yadda saxla', form); // cut copy paste buttons if (m == '1' && ie()) { content += tbutton ('cut', ''); content += tbutton ('copy', ''); content += tbutton ('paste', ''); for (var i=0;i