
var DHTML = (document.getElementById || document.all || document.layers);

function jsGetObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function jsVisible(obj,flag)
{
	if (!DHTML) return;
	//alert('hi1'+obj);
	var x = new jsGetObj(obj);
	if (x)
		x.style.display = (flag) ? 'block' : 'none';
	//alert('hi');
}
		
function jsCheckEntry(obj,warn)
{
	if (obj.value != '')
	{
		return true;
	}
	else
	{
		alert(warn);
		obj.focus();
		return false;
	}
}


function jsCheckMsgBoardEntry()
{
	return jsCheckEntry(document.messageboard.message,'You haven\'t entered a message!') && jsCheckEntry(document.messageboard.msgby,'You haven\'t entered a user!');
}


function jsSubmitDlg(name, submitbtn)
{
	jsVisible(name, 1);
	return true;
}


function jsCreateCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else 
		var expires = "";
		
	document.cookie = name+"="+value+expires+"; path=/";
}


function jsSetCookieHideSmsNot(babyid, hide)
{
	jsCreateCookie('hide_sms_sub_'+babyid, '1', 365);
} 


function jsAutoTextBoxSize(obj)
{
	var y=obj.value;
	var r = 1;
	
	a=y.split('\n');
	
	for (z=0; z < a.length; z++)
	{
		r = r + 1 + parseInt(a[z].length / 90);
	}
	
	newheight = r * 13;
	if (newheight < 42)
		newheight = 42;
	
	obj.style.height = newheight+'px';
	jsEvenColumns();
}


function jsAutoTextBoxSize3(obj)
{
	newheight = 0;
	
	if (newheight < 200)
		newheight = 200;
	
	obj.style.height = newheight+'px';
	jsEvenColumns();
}


