//--------------------------------------------------------------------

/*
function checkUnique(fld,val)
{
	if (confirm("Are You sure?"))
	{
		mysend(fld,val);
		//alert("checkUnique  fld=" +fld+", val="+val);
		unique=true;
	}
}//function checkUnique(fld)

*/
function changePass()
{
	frm=document.forms.editprofile;
	frm.mod.value='userpsw';
	frm.action='';
	frm.submit();
}//function changePass()


//self.onerror=function() {return true;}
 //function doNothing() { return true; }
//window.onerror = doNothing;
var alldivs;
alldivs=Array("wholescreen","new_message","iecdata4vup","msgcontent");

function initNM()
{
	if(document.getElementById('wholescreen'))
	{
		//showMesgDiv(0);
		 hideMesgDiv();
	}
}//function initNM()

	//-----------------------
	function _gid(id)
	{
		return document.getElementById(id);
	}//	function _gid(id)
	//-----------------------
	function _gfrm(frmname)
	{
		return document.forms[frmname];
	}//	function _gid(id)

	//-----------------------
	function GetLeft(element)
	{
		var curNode = element;
		var left    = 0;
		do {
			left += curNode.offsetLeft;
			curNode = curNode.offsetParent;
		} while(curNode.tagName.toLowerCase() != 'body');
		return left;
	}//	function GetLeft(element)
	//-----------------------
	function GetTop(element)
	{
		var curNode = element;
		var top    = 0;
		do {
			top += curNode.offsetTop;
			curNode = curNode.offsetParent;
		} while(curNode.tagName.toLowerCase() != 'body');
		return top;
	}//	function GetTop(element)
	//-----------------------
	function showGmap(mapplace)
	{
		gmapwindow= window.open ("showlocation.php?location="+mapplace, "gmapwindow","titlebar=1,toolbars=0,location=0,directories=0,top=150,left=50,status=0,menubar=0,scrollbars=1,resizable=1,border=1,width=520,height=320");
	//	gmapwindow.moveTo(50,150);
	}//	function showGmap(mapplace)
	//---------------------------
	function age(dob)
	{
		var dt,by,bm,bd,age,res,td,tm,ty;
		if (dob=="" || dob=="0000-00-00" || dob=="0") return 0;
		dt=dob.split("-");
		by=parseInt(dt[0]); bm=parseInt(dt[1]-1); bd=parseInt(dt[2]);
		dt = new Date();
		td=parseInt(dt.getDate()); tm=parseInt(dt.getMonth()); ty=parseInt(dt.getFullYear());
		if((tm > bm)||(tm==bm && td>=bd)) age=by;
		else age=by+1;
		res=ty-age;
		if (age>ty) return 0;
		return res;
	}//function age(dob)
	function showFA(fid)
	{
		fawindow= window.open ("show_fa.php?fid="+fid, "fawindow","titlebar=1,toolbars=0,location=0,top=150,left=50,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,border=1,width=680,height=480");
//		fawindow.moveTo(50,150);
	}//	function showGmap(mapplace)

	function showMar(mid)
	{
		marwindow= window.open ("show_marshrut.php?mid="+mid, "marwindow","titlebar=1,toolbars=0,location=0,top=150,left=50,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,border=1,width=520,height=320");
//		marwindow.moveTo(50,150);
	}//	function showGmap(mapplace)

	function makeHeight(o)
	{
		var mama;
		mama=(o.parentElement)?o.parentElement : o.parentNode;
		o.style.height=parseInt(mama.offsetHeight)-18;
	}//	function makeHeight(o)
	//---------------------------- onkeypress='return numbersonly(this,event)' 
	function numbersonly(myfield, e, dec) 
	{
	  var key;
	  var keychar;

	  if (window.event)
		key = window.event.keyCode;
	  else if (e)
		key = e.which;
	  else
		return true;
	  keychar = String.fromCharCode(key);

	  // control keys
	  if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
		return true;

	  // numbers
	  else if ((("0123456789").indexOf(keychar) > -1))
		return true;

	  // decimal point jump
	  else if (dec && (keychar == ".")) {
		
		//myfield.form.elements[dec].focus();
		return true;
	  } else
		return false;
	}//function numbersonly(myfield, e, dec) 

//----------------------------
	function alphasonly(myfield, e) 
	{
	  var key;
	  var keychar;

	  if (window.event)
		key = window.event.keyCode;
	  else if (e)
		key = e.which;
	  else
		return true;
	  keychar = String.fromCharCode(key);

	  // control keys
	  if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) )
		return true;
	  // numbers
	  else if ((("ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz0123456789").indexOf(keychar) > -1))
		return true;

	  else
		return false;
	}//function numbersonly(myfield, e, dec) 

