﻿//<!--
function body_load()  
{  
  if (typeof(page_load) != 'undefined')  
    page_load();  
}

function addEvent(id, eventType, eventFunction){
	if (id.attachEvent){
		id.attachEvent("on" + eventType, eventFunction);
	}else if (id.addEventListener){
		id.addEventListener(eventType, eventFunction, false);
	}else{
		id["on" + eventType] = eventFunction;
	}
}

function ObjectWrite(value)
{
    document.write(value);
}

function trim(value){
    return rtrim(ltrim(value));    
}

function ltrim(value){
    var v_length = value.length;
    if(v_length < 1){
        return"";
    }
    var w_space = String.fromCharCode(32);
    var strTemp = "";

    var iTemp = 0;

    while(iTemp < v_length){
        if(value.charAt(iTemp) != w_space){
            strTemp = value.substring(iTemp, v_length);
            break;
        }
        iTemp = iTemp + 1;
    } //End While
    
    return strTemp;
    
}
function rtrim(value){
    var w_space = String.fromCharCode(32);
    if(v_length < 1){
        return "";
    }    
    
    var strTemp = value;
    var v_length = value.length;
    var iTemp = v_length;

    while(iTemp > 0){
        if(value.charAt(iTemp) != w_space){
            strTemp = value.substring(0, iTemp);
            break;
        }else if (iTemp == 1){
            strTemp = "";
            break;
        }else{        
            iTemp = iTemp - 1;
        }
    } //End While
    
    return strTemp;
}

function isEmail(elm) {
	if (elm.value.indexOf("@") != "-1" && elm.value.indexOf(".") != "-1" && elm.value != "")
	    return true;
	return false;
} 
 
function isFilled(elm) {
	if (elm.value == "" || elm.value == null)
	    return false;
	return true;
}

function clickControlOnEnter(event, ctl){
    if (event.keyCode == 13){
        document.getElementById(ctl).click();
        return false;
    }
}

//-->
