// Get Element By Id
function gebid(i) { return document.getElementById(i); }

// Create Element
function ce(e, obj)
{
	var a = document.createElement(e);
	for(prop in obj)
	{
		a[prop] = obj[prop];
	}
	return a;
}

// Append Child
function ac()
{
	var a = ac.arguments[0];
	for(i=1; i<ac.arguments.length; i++)
	{
		if(arguments[i])
		{
			a.appendChild(ac.arguments[i]);
		}
	}
	return a;
}

// Remove Child
function rc(node)
{
	if(node == null) return;
	node.parentNode.removeChild(node);
}

function toggle(id)
{ 
	document.getElementById(id).style.display = ( document.getElementById(id).style.display == 'none' ) ? '' : 'none';
}

function setCookie(c_name, value, expiredays)
{
	var exdate = new Date();
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value) + ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookie(c_name)
{
	if(document.cookie.length>0)
	{
		c_start=document.cookie.indexOf(c_name + "=");
		if(c_start!=-1)
		{ 
			c_start=c_start + c_name.length+1;
			c_end=document.cookie.indexOf(";",c_start);
			if (c_end==-1) c_end=document.cookie.length;
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}

function changeInputType(oldObject, oType)
{
  var newObject = document.createElement('input');
  newObject.type = oType;
  if(oldObject.size) newObject.size = oldObject.size;
  if(oldObject.value) newObject.value = oldObject.value;
  if(oldObject.name) newObject.name = oldObject.name;
  if(oldObject.id) newObject.id = oldObject.id;
  if(oldObject.className) newObject.className = oldObject.className;
  oldObject.parentNode.replaceChild(newObject,oldObject);
  setTimeout("document.getElementById('"+ oldObject.id +"').focus();", 100);
  return newObject;
}