//getElement by Id
getField=function(name){	var target=new obj(name);	return target;	}
obj=function(target){ 	this.src = document.getElementById(target); }
obj.prototype.addEvent = function(el, evname, func) { //document, onxx, function
	if (el.attachEvent) { // IE
		el.attachEvent("on" + evname, func);
	} else if (el.addEventListener) { // Gecko / W3C
		el.addEventListener(evname, func, true);
	} else {
		el["on" + evname] = func;
	}
}
obj.prototype.setBorder=function(border){if(border==null || border=="undefined"){	this.src.style.border = '1px solid #999999';}else{	this.src.style.border = '1px solid '+border;}}
obj.prototype.setBgColor=function(color){if(color==null || color=="undefined"){	this.src.style.backgroundColor = '#FFFFFF';	}else{	this.src.style.backgroundColor = color;	}}
obj.prototype.setColor=function(color){	if(color==null || color=="undefined"){	this.src.style.color = 'black';	}else{	this.src.style.color = color;	}}
obj.prototype.getColor=function(){	return this.src.style.color; }
obj.prototype.getName=function(){	return this.src.name; }
obj.prototype.setHeight=function(height){ this.src.style.height = height; }
obj.prototype.setWidth=function(width){	this.src.style.width = width; }
obj.prototype.setLeft=function(left){ this.src.style.left = left; }
obj.prototype.setTop=function(top){ this.src.style.top = top; }
obj.prototype.setDisplay=function(){ this.src.style.display = "inline"; }
obj.prototype.setNone=function(){ this.src.style.display = "none"; }
obj.prototype.setValue=function(value){	this.src.value = value; }
obj.prototype.getValue=function(){ return this.src.value; }
obj.prototype.setInnerHTML=function(reply){	this.src.innerHTML = reply; }
obj.prototype.getInnerHTML=function(){	return this.src.innerHTML; }
obj.prototype.setVisible=function(){ this.src.style.visibility = "visible"; }
obj.prototype.setHidden=function(){	this.src.style.visibility = "hidden"; }
obj.prototype.setClass=function(className){	this.src.className = className; }
obj.prototype.setCursor=function(type){	this.src.style.cursor=type; }
obj.prototype.focus=function(){	this.src.focus(); }

function buildPOST(theFormName) { 
    theForm = document.forms[theFormName]; 
    var qs = '' 
    for (e=0;e<theForm.elements.length;e++) { 
        if (theForm.elements[e].name=='using_db[]' || theForm.elements[e].name=='know_from[]' ){
			if (theForm.elements[e].checked ){
				var name = theForm.elements[e].name; 
				qs+=(qs=='')?'':'&';
				qs+= name+'='+escape(theForm.elements[e].value); 
			}

		}else if (theForm.elements[e].name!='') { 
            var name = theForm.elements[e].name; 
            qs+=(qs=='')?'':'&' 
            qs+= name+'='+escape(theForm.elements[e].value); 
        } 
    } 
    //qs+="\n"; 

    return qs;
} 


// reduce blank space
function trim(str){
    for(var  i  =  0  ;  i<str.length  &&  str.charAt(i)==" "  ;  i++  )  ;
    for(var  j  = str.length;  j>0  &&  str.charAt(j-1)==" "  ;  j--)  ;
    if(i>j)  return  "";  
    return  str.substring(i,j);  
} 
