// +----------------------------------------------------------------------+
// | Enerweb Eskom Enterprises                                            |
// | Copyright (c) 2003 Enerweb. All rights reserved.                     |
// +----------------------------------------------------------------------+

/*--------------------------------------------------|
 |						    |
 | Developer : todi mugivhi			    |
 | Date : 03 December 2004			    |
 |						    |
 |--------------------------------------------------*/
 /*disables right-click*/ 
 var DEBUG_MODE = true;
 //document.onsubmit = new Function("return false;");
 if(DEBUG_MODE!=true) document.oncontextmenu=new Function("return false;"); 
 window.onunload = new Function("history.forward();");
 window.onload = new Function("history.forward();");
 /*Avoid history.back()*/
history.forward(0);
 window.focus();
 var BROWSER; 
 var SELECT_LENGTH_LIMIT = 500;
 
 
//check your browser
if(navigator.appName=="Microsoft Internet Explorer") BROWSER = 'IE'; else if(navigator.appName=="Netscape")  BROWSER = 'NN';	

//check passwordo
function vCompare(v1,v2){ if(v1==v2) return true; else return false;}/*end of function*/

//join
function concat(a1,a2){var a = [];/*loop*/for(var i=0;i<a1.length;i++){a[a.length] = ''+a1[i]+'';}/*end loop*//*loop*/for(var i=0;i<a2.length;i++){a[a.length] = ''+a2[i]+'';}/*end loop*/return a;}/*end of function*/

//in array

function inArray(ary,value) {
	var i;
	for (i=0; i < ary.length; i++) {
		if (ary[i] === value) {
			return true;
		}
	}
	return false;
};

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}


function replaceHtml(el, html) {
	var oldEl = (typeof el === "string" ? document.getElementById(el) : el);
	/*@cc_on // Pure innerHTML is slightly faster in IE
		oldEl.innerHTML = html;
		return oldEl;
	@*/
	var newEl = oldEl.cloneNode(false);
	newEl.innerHTML = html;
	oldEl.parentNode.replaceChild(newEl, oldEl);
	/* Since we just removed the old element from the DOM, return a reference
	to the new element, which can be used to restore variable references. */
	return newEl;
};

function clearPhpfebCache()
{
    //try to clear the cache
    try {
      if (typeof top.DATA_SOURCE_FRAME_BODY_STORE == 'object'){
        top.DATA_SOURCE_FRAME_BODY_STORE = []; //clear phpfeb cache!
      }
    } catch(e){}
}

/******************************************************
 * FROM THIS POINT IS FOR DEBUGGING ONLY
 *****************************************************/
function showProp(Obj,intOnly,pOnly){if(DEBUG_MODE==false) return false;var s = "";var ctr =0; for(i in Obj){var value = ''+Obj[i]+'';if(intOnly){if(!(parseFloat(value) > 0)) value=''; }if(pOnly) value='';if(ctr < 20){s+=i+"="+(value)+"\n"; }else{alert(s); s = "";ctr = 0;s+=i+"="+(value)+"\n"; } ctr++; }alert(s);}

function showDebug(str){if(DEBUG_MODE==false) return false;if(!str) str=''; alert(str);return true;}

function windowStatus(str){if(DEBUG_MODE==false) return false;if(!str) str = ''; window.status = str;return true;}
