var OP = (window.opera) ? 1:0; 
var IE4 = (document.all && !OP) ? 1:0; 
var IE5 = (IE4 && document.getElementById) ? 1:0; 
var NN4 = (document.layers) ? 1:0; 
var NN6 = (!IE4 && !NN4 && document.getElementById) ? 1:0; 
var NOT = (!OP && !IE4 && !IE5 && !NN4 && !NN6) ? 1:0; 

function getObj(doc, objName){
	var s;
	if (NN4==1){ 
		//Netscape 4
		s = doc.layers[objName];
	}else if(NN6==1){ 
		//Netscape 6.x, Firefox
		s = doc.getElementById(objName);
		//alert("Mozilla:" + s);
	}else if ((IE5==1)||(IE4==1)){ 
		//Explorer		
		s = doc.all[objName];
	}	
	return s;
}

function getClientHeight(doc){
	var  myHeight = 0;
  	if(NN4==1) {
    	//Non-IE
    	myHeight = window.innerHeight;
  	} else if(NN6==1) {
    	//IE 6+ in 'standards compliant mode'
    	myHeight = doc.documentElement.clientHeight;
  	} else if((IE5==1)||(IE4==1)) {
    	//IE 4 compatible
    	myHeight = doc.body.clientHeight;
  	}
	
	return myHeight;
}

function getClientWidth(doc){
	var  myWidth = 0;
  	if(NN4==1) {
    	//Non-IE
    	myWidth = window.innerWidth;
  	} else if(NN6==1) {
    	//IE 6+ in 'standards compliant mode'
    	myWidth = doc.documentElement.clientWidth;
  	} else if((IE5==1)||(IE4==1)) {
    	//IE 4 compatible
    	myWidth = doc.body.clientWidth;
  	}
	
	return myWidth;
}

function setImagePath(doc, img_name, path){
	if (NN4==1){ 
		//Netscape 4
		doc.layers[img_name].src 			= path
	}else if(NN6==1){ 
		//Netscape 6.x
		doc.getElementById(img_name).src 	= path;
	}else if ((IE5==1)||(IE4==1)){ 
		//Explorer
		doc.all[img_name].src 				= path;
	}
}

function IsDate(txtDate){
    try{
        if (txtDate.length != 10){
            return null;
        }
        else if (
                 isNaN(txtDate.substring(0, 2))       ||
                       txtDate.substring(2, 3) != "/" ||
                 isNaN(txtDate.substring(3, 5))       ||
                       txtDate.substring(5, 6) != "/" ||
                 isNaN(txtDate.substring(6, 10))
             )
        {
            return false;
        }else{
            return true;
        }
    }
    catch (e){
        return null;
    }
}

// Removes leading whitespaces
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function Trim( value ) {
	
	return LTrim(RTrim(value));
	
}
