function create_div(id,className,html){
	var ele = document.createElement("div");
	if(id) ele.id = id;
	if(className) ele.className = className;
	if(html)  ele.innerHTML = html;
	return ele;
}
function create_form(id,ons,met,act){
  var form = document.createElement("<form name="+id+" onsubmit='return "+ons+"()'></form>");
  form.id = id;
  if(met) form.method = met;  
  if(act) form.action = act;
  return form;
}
function create_table(w,h,className){
	var table = document.createElement("table");
	if (className) table.className = className;	
  if(w) table.width = w;
  else  table.style.width = '100%';
  if(h) table.height = h;
  table.border = 0;
  table.cellPadding = 0;
  table.cellSpacing = 0;  
	return table;
}
function setPosition(obj,l,t,w,h){
  with(obj.style){
    if(l >= 0) posLeft=l;
    if(t >= 0) posTop=t;
    if(w >= 0) posWidth=w;
    if(h >= 0) posHeight=h;
  }
}
function AlimiDhtmlObjectControl(){
  this.getObject = getObject;
  this.rewrite   = rewrite;
  this.writeBefore = writeBefore;
  this.writeAfter = writeAfter;
  this.remove    = remove;
  this.getPosition = getPosition;
  this.showcell = showcell;
  this.hidecell = hidecell;
  this.show     = show;
  this.hide     = hide;
  this.move     = move;
  this.setStyle = setStyle;
  this.getStyle = getStyle;
  this.innerOpen= innerOpen;
  this.open     = open;
  this.showProps = showProps;
  
  function getObject(id){
		if (typeof(id) == "object")	return id;
		else if (typeof(window.document.all[id]) == "object")	return window.document.all[id];
		else	return null;
	}
	function rewrite(id,h) {
		var oElement=this.getObject(id);
		if (oElement)	oElement.innerHTML=h;
	}
	function writeAfter(id,html){
		var oElement=this.getObject(id);
		if (oElement)	oElement.insertAdjacentHTML("afterEnd",html);
	}
	function writeBefore(id,html){
		var oElement=this.getObject(id);
		if (oElement)	oElement.insertAdjacentHTML("beforeBegin",html);
	}	
	function remove(id){
		var oElement=this.getObject(id);
		if (oElement)	oElement.removeNode(true);		
	}	
	function getPosition(point){
		var p = new Object();
		var xName=point+"X";
		var yName=point+"Y";
		p.x=event[xName];		
		p.y=event[yName];
		return p;		
	}	
	function hide(){
		this.setStyle(arguments,'visibility','hidden');
	}
	function show(){	 
		this.setStyle(arguments,'visibility','visible');
	}
	function hidecell(){
		this.setStyle(arguments,'display','none');
	}
	function showcell(){
		this.setStyle(arguments,'display','');
	}	
	function move(id,l,t){
		var oElement=window.document.all[id].style;		
		if (oElement){			
			oElement.posLeft=l;			
			oElement.posTop=t;
		}
	}
	function setStyle(args,prop,value){
		var oElement;
		for (var i=0;i<args.length;i++){
			if (oElement=this.getStyle(args[i])) oElement[prop]=value;
		}
	}	
	function getStyle(id){
		var oElement=this.getObject(id);
		if (oElement && typeof(oElement.style)=="object")	return oElement.style;
		else							return null;
	}
	function innerOpen(url,width,height,isScroll){
		return window.showModelessDialog(url,window,'dialogWidth:'+width+'px;dialogHeight:'+height+'px;status:no;scroll:'+isScroll);
	}	
	function open(url,target,width,height,scrollbar,resizable){
		if (!scrollbar)	scrollbar='no';
		if (!resizable)	resizable='no';
		var posLeft=parseInt((window.screen.availWidth-width)/2);
		var posTop=parseInt((window.screen.availHeight-height)/2);
		var oWindow = window.open(url,target,"left="+posLeft+",top="+posTop+",width="+width+",height="+height+",menubar=no,scrollbars="+scrollbar+",resizable="+resizable);
		if (oWindow){
			oWindow.focus();
			return oWindow;
		}
		else	return null;
	}		
	function showProps(id){
		var oElement=this.getObject(id);
		var msg='Properties In Object \n';
		var i=0;
		if (oElement){
			for (prop in oElement){
				i++;
				msg +=i+". " + prop+'='+oElement[prop] +'\n';
				if (i % 10 ==0){
					alert (msg);
					msg='';
				}
			}
			if (msg)	alert (msg);
		}
	}
	
}
oc = new AlimiDhtmlObjectControl();