//net js   update  : sep 02, 2010
/////////////////////////////////////////////////////pagination//////////////////////////////////////////////////////////////
var timerx = 0;
function reloaderimg(){
	return "<div id='raloaderdiv' align='center'><div id='raloader' align='center'><img src='images/reloader.gif'/></div></div>"
	}
function reloaderimgrotate(){
	return "<div id='raloaderdiv2' align='center'><div id='raloader' align='center'><img src='images/ajax-loaderrotate.gif'/></div></div>"
	}

function closena() {
		document.getElementById('msgdocdet').style.display="none";
	}

function viewremarks(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 var tfdregopt	= encodeURI(document.getElementById('tfdreg').value);
	  var tfdregprev	= encodeURI(document.getElementById('tfdregprev').value);
	
      if (tfdregprev==1) {
		  document.getElementById('divremarks').style.display = 'block';
          if (tfdregopt==1 && tfdregprev==1) {
        	  document.getElementById('divremarks').style.display = 'none';
    		 document.getElementById('prac_remarks').value = '';
	       }

	  } else {
	      if (tfdregopt==1) {
		     document.getElementById('divremarks').style.display = 'block';
		  } else {
		    document.getElementById('divremarks').style.display = 'none';
		  }
	  }
}
//code
function checkcode(){
	xmlhttpm=GetXmlHttpObjectm();
    if (xmlhttpm==null)
     {
      alert ("Browser does not support HTTP Request");
      return;
     }
	
	//document.getElementById('clin_cityv').value=''+prevcity;
	// var vmuni = document.getElementById('clin_cityv').value;
	 var url="chkcode.php";
//  url=url+"gprovgetid="+provi+"&gmunigetid="+prevcity;
//url=url+"&sid="+Math.random();
xmlhttpm.onreadystatechange=stateChangedm;
xmlhttpm.open("GET",url,true);
xmlhttpm.send(null);

}

function stateChangedm()
{
if (xmlhttpm.readyState==4)
{
document.getElementById("divcode").innerHTML=xmlhttpm.responseText;
}
}
//end code



//apr 06-2k10
function gotoedit_phealthclosefadeyes(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
 
    var urlback="patient-inbox.php?fainbox=20&pg=9&backfadeid=9&addfade=1&openfa=0"
         urlback=urlback+"#vhfa";
		 
	var url="patient-detfamilyhrecordlist.php?pg=9&openfa=0&addbo=0&fainbox=20&addfade=1&vloadfade=1&vaddfade=1"
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace(urlback);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


//end apr 06-2k10

//new 12-02-2k9  
	
	//mar 16, 2010
	function clickaboutprac(aboutprac) {
		if (aboutprac=='A brief description of your practice or specialty that you think your patients should know about.') {	
			document.getElementById('aboutmypr').value='';
		}
	}
	//end mar 16, 2010
	
	//apr 05, 2010
	function clickexpertise(expertise) {
	
		if (expertise=="Indicate your areas of expertise or health problems that you specialize in.  Separate each entry with a comma (,).") {	
			document.getElementById('prac_exper1').value='';
		}
	}
	//end apr 05, 2010
	
	
	function doc_back2list(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  //	document.getElementById('tdheathr').innerHTML=reloaderimg();
	var url="doctor-inbox-list.php?act=2";
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace('doctors-inbox.php?prv=1#vhfa');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
	
	function gotoedit_phealthclosefade(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}

    var urlback="patient-inbox.php?fainbox=20&pg=9&backfadeid=9&addfade=1&openfa=0"
         urlback=urlback+"#vhfa";
		 
	var url="patient-detfamilyhrecordlist.php?pg=9&openfa=1&addbo=0&fainbox=20&addfade=1&vloadfade=1&vaddfade=1"
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace(urlback);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
	
	// modify 03-05-2010 -z1
	
	//medicinesfa reg - 02-11-2k10

function gotoedit_medicinesdelfa(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (confirm("Are you sure you want to delete?")) {
  	document.getElementById('tdmedicinesfa').innerHTML=reloaderimg();
	var url="inc_pat_medicinesfa.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmedicinesfa').innerHTML=xmlHttp.responseText;
		//location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}

	
	function gotoedit_phealthaddfade(optcmd,xsect, itemid,midfa, br,pro ){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
   if (br=='fox') {
	   
   //alert ("Check Broowser"+optcmd);
    
   //optcmd=pro; 
   }
	   
	var urlback="patient-inbox.php?fainbox=20&pg=9&backfadeid=9&addfade=1&openfa=1"
    	urlback=urlback+'&midfa='+midfa+'&optcmd='+optcmd;
	     urlback=urlback+'#vhfa';
	
	var url="patient-detfamilyhrecordlist.php?pg=9&openfa=1&addbo=1&fainbox=20&addfade=1&vloadfade=1&vaddfade=1"
	url=url+'&midfa='+midfa+'&optcmd='+optcmd;
	

  
  
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		
		location.replace(urlback);
		

		  
	 } 
	}
	
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)		
  
}
// end modify 03-05-2010 -z1

//new 01-15-2k10

	function yesgetinfo(ifind,l_dname,l_clinicaddr,l_specialty,l_trunk_no,l_hospital,l_room_bldg,hdn_clinic) {
	var tmpvar1=document.getElementById(hdn_clinic).value;
	var intIndexOfMatch = tmpvar1.indexOf( "[7" );
   while (intIndexOfMatch != -1){
      tmpvar1 = tmpvar1.replace( "[7", "" )
	  intIndexOfMatch = tmpvar1.indexOf( "[7" );
   }
	if (ifind=='1') {
	 document.getElementById('b_doctor_name').value=l_dname;
	 document.getElementById('b_clinic_address').value=l_clinicaddr;
	 document.getElementById('b_specialty').value=l_specialty;
	  document.getElementById('b_landline').value=l_trunk_no;
	  document.getElementById('b_hospital').value=tmpvar1;
	  document.getElementById('b_room_bldg').value=l_room_bldg;
	 }
	if (ifind=='2') {
	 document.getElementById('m_doctor_name').value=l_dname;
	 document.getElementById('m_clinic_address').value=l_clinicaddr;
	 document.getElementById('m_specialty').value=l_specialty;
	  document.getElementById('m_landline').value=l_trunk_no;
	  document.getElementById('m_hospital').value=tmpvar1;
	  document.getElementById('m_room_bldg').value=l_room_bldg;
	 }
	  document.getElementById("divm").innerHTML=xmlhttp.responseText;
	document.getElementById('divm').style.visibility = 'hidden';  

	}
	
	function nogetinfo(tr1,tr2) {
	document.getElementById(tr1).style.display = 'none'; 
	 document.getElementById(tr2).style.display = 'none';  
	// document.getElementById('trw').style.display = 'none';  
	}
	
	function closelookup(){
	
	 // document.getElementById('divm').innerHTML=reloaderimg();
	 document.getElementById("divm").innerHTML=xmlhttp.responseText;
	document.getElementById('divm').style.visibility = 'hidden';  

	}
	
	function clickok(tr1,tr2){
	
	var doctor_name = encodeURI(document.getElementById('doctor_name').value);
      
    document.getElementById('divm').style.visibility = '';  
	 document.getElementById(tr1).style.display = 'block'; 
	 document.getElementById(tr2).style.display = 'block';  
	  document.getElementById('trw').style.display = 'block'; 
  
}
	
	function clickfindmd(ifind){
	xmlhttp=GetXmlHttpObject1();
    if (xmlhttp==null)
     {
      alert ("Browser does not support HTTP Request");
      return;
     }
	
	 var doctor_name = 'Name';
    document.getElementById('divm').style.visibility = '';  
	// document.getElementById('m_doctor_name').value='testing';
	
     document.getElementById('divm').innerHTML=reloaderimg();
	 var url="patient-detfamilyhrecordlist.php?pg=9&openfa=1&addbo=1&fainbox=20&addfade=1&vloadfade=1&vaddfade=1";
url=url+"&doctor_name="+doctor_name+"&ifind="+ifind;
//url=url+"#lawindowa";
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
location.replace('#lawindowa');
}
	
	
		
	function searchtype(ifind){
	xmlhttp=GetXmlHttpObject1();
    if (xmlhttp==null)
     {
      alert ("Browser does not support HTTP Request");
      return;
     }
	
	 var doctor_name = encodeURI(document.getElementById('doctor_name').value);
	
	// document.getElementById('m_doctor_name').value='testing';
	 if (doctor_name=='') {
	    alert ("Empty Name");
        return;
	 }
     document.getElementById('divm').innerHTML=reloaderimg();
	//   document.getElementById('trw').style.display = 'block';
	// document.getElementById("divsc").innerHTML="style.style.overflow=auto";
	 var url="patient-detfamilyhrecordlist.php?pg=9&openfa=1&addbo=1&fainbox=20&addfade=1&vloadfade=1&vaddfade=1";
url=url+"&doctor_name="+doctor_name+"&ifind="+ifind;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
	
function stateChanged()
{
if (xmlhttp.readyState==4)
{
	
document.getElementById("divm").innerHTML=xmlhttp.responseText;
document.getElementById('divm').style.visibility = '';  
document.getElementById("divm").style.left='734px';
document.getElementById("divm").style.top='1612px';
document.getElementById("divm").style.width='494px';
document.getElementById("divm").style.height='433px';

}
}

function GetXmlHttpObject1()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}	

function savebabybooklook(optcmdfa,midfa){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	// alert ("saving record.");
	
    var msgerr = "";
	var xspace ='     ';
	var bdatebaby		=  document.getElementById('bdatebaby');

	
 var sv_bdatebaby		=  document.getElementById('bdatebaby').value;
 var timebirth = encodeURI(document.getElementById('timebirth').value);
	
	var birthplace = encodeURI(document.getElementById('birthplace').value);
	var hospital_clinic = encodeURI(document.getElementById('hospital_clinic').value);
	var addressos = encodeURI(document.getElementById('addressos').value);
	var phone = encodeURI(document.getElementById('phone').value);
	var type_delivery = encodeURI(document.getElementById('type_delivery').value);
	var condition_birth = encodeURI(document.getElementById('condition_birth').value);
	var weight_birth = encodeURI(document.getElementById('weight_birth').value);
	var weight_birthoz = encodeURI(document.getElementById('weight_birthoz').value);
	var weight_birthkg = encodeURI(document.getElementById('weight_birthkg').value);
	var length_birth = encodeURI(document.getElementById('length_birth').value);
	var length_birthcm = encodeURI(document.getElementById('length_birthcm').value);
	var distinguishing_marks = encodeURI(document.getElementById('distinguishing_marks').value);
	var circumference_head = encodeURI(document.getElementById('circumference_head').value);
	var circumference_headcm = encodeURI(document.getElementById('circumference_headcm').value);
	var circumference_chest = encodeURI(document.getElementById('circumference_chest').value);
	var circumference_chestcm = encodeURI(document.getElementById('circumference_chestcm').value);
	var blood_type = encodeURI(document.getElementById('blood_type').value);
	var weight_leavinghospital = encodeURI(document.getElementById('weight_leavinghospital').value);
	var weight_leavinghospitaloz = encodeURI(document.getElementById('weight_leavinghospitaloz').value);
	var weight_leavinghospitalkg = encodeURI(document.getElementById('weight_leavinghospitalkg').value);
	var b_doctor_name = encodeURI(document.getElementById('b_doctor_name').value);
	var b_clinic_address = encodeURI(document.getElementById('b_clinic_address').value);
	var b_clinic_hours = encodeURI(document.getElementById('b_clinic_hours').value);
	var b_landline = encodeURI(document.getElementById('b_landline').value);
	var b_cellphone = encodeURI(document.getElementById('b_cellphone').value);
	var b_email = encodeURI(document.getElementById('b_email').value);
	var m_doctor_name = encodeURI(document.getElementById('m_doctor_name').value);
	var m_clinic_address = encodeURI(document.getElementById('m_clinic_address').value);
	var m_clinic_hours = encodeURI(document.getElementById('m_clinic_hours').value);
	var m_landline = encodeURI(document.getElementById('m_landline').value);
	var m_cellphone = encodeURI(document.getElementById('m_cellphone').value);
	var m_email = encodeURI(document.getElementById('m_email').value);
	
	
	
	var errval=false;
	if(bdatebaby.value==""){
		bdatebaby.className ="errorfield";
		errval = true;
	}else{
		bdatebaby.className ="okfield"; 		
	}
	if (goisDate(bdatebaby.value)==false){
		bdatebaby.className ="errorfield";
		bdatebaby.focus();
		errval = true;
	}

    
if(errval==true){
	//
	//document.getElementById('msg').innerHTML = err;
	return false;
  }

	
	var url="patient-detfamilyhrecordlist.php";
//	url=url+'?phypertensive='+phypertensive+'&pdrinker='+pdrinker+'&pdiabetic='+pdiabetic+
//	'&pdrinkerctr='+pdrinkerctr+'&psmoker='+psmoker+'&psmokerctr='+psmokerctr+'&pallergies='+pallergies+/
//	'&bdatereg='+sv_bdatereg+'&fname='+fname+'&lname='+lname+'&relationship='+relationship;  
	
	var urlback="patient-inbox.php?fainbox=20&pg=9&backfadeid=9&addfade=0&openfa=1"
  	urlback=urlback+'&midfa='+midfa+'&optcmd='+optcmdfa+'&bdatebaby='+sv_bdatebaby;
	urlback=urlback+'&timebirth='+timebirth+'&birthplace='+birthplace+'&hospital_clinic='+hospital_clinic;
	urlback=urlback+'&addressos='+addressos+'&phone='+phone+'&type_delivery='+type_delivery;
	urlback=urlback+'&condition_birth='+condition_birth+'&weight_birth='+weight_birth;
	urlback=urlback+'&weight_birthoz='+weight_birthoz;
	urlback=urlback+'&weight_birthkg='+weight_birthkg;
	urlback=urlback+'&length_birthcm='+length_birthcm;
	urlback=urlback+'&circumference_headcm='+circumference_headcm;
	urlback=urlback+'&length_birth='+length_birth+'&distinguishing_marks='+distinguishing_marks;
	urlback=urlback+'&circumference_head='+circumference_head+'&blood_type='+blood_type;
	urlback=urlback+'&circumference_chest='+circumference_chest;
	urlback=urlback+'&circumference_chestcm='+circumference_chestcm;
	urlback=urlback+'&weight_leavinghospitaloz='+weight_leavinghospitaloz;
	urlback=urlback+'&weight_leavinghospitalkg='+weight_leavinghospitalkg;
	urlback=urlback+'&weight_leavinghospital='+weight_leavinghospital+'&b_doctor_name='+b_doctor_name;
	urlback=urlback+'&b_clinic_address='+b_clinic_address+'&b_clinic_hours='+b_clinic_hours;
	urlback=urlback+'&b_landline='+b_landline+'&b_cellphone='+b_cellphone;
	urlback=urlback+'&b_email='+b_email+'&m_doctor_name='+m_doctor_name;
	urlback=urlback+'&m_clinic_address='+m_clinic_address+'&m_clinic_hours='+m_clinic_hours;
	urlback=urlback+'&m_landline='+m_landline+'&m_cellphone='+m_cellphone;
	urlback=urlback+'&m_email='+m_email;
	urlback=urlback+"#vhfa"; 
	
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
//	   document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		document.getElementById('tbl3').style.display = 'none';  
		
		
	 } 
	}
	//xmlHttp.open("GET",url,true)
//	xmlHttp.send(null)
	location.replace(urlback);
	
}
	
	function savebabybook(optcmdfa,midfa){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	// alert ("saving record.");
	
    var msgerr = "";
	var xspace ='     ';
	var bdatebaby		=  document.getElementById('bdatebaby');

	
 var sv_bdatebaby		=  document.getElementById('bdatebaby').value;
 var timebirth = encodeURI(document.getElementById('timebirth').value);
	
	var birthplace = encodeURI(document.getElementById('birthplace').value);
	var hospital_clinic = encodeURI(document.getElementById('hospital_clinic').value);
	var addressos = encodeURI(document.getElementById('addressos').value);
	var phone = encodeURI(document.getElementById('phone').value);
	var type_delivery = encodeURI(document.getElementById('type_delivery').value);
	var condition_birth = encodeURI(document.getElementById('condition_birth').value);
	var weight_birth = encodeURI(document.getElementById('weight_birth').value);
	var weight_birthoz = encodeURI(document.getElementById('weight_birthoz').value);
	var weight_birthkg = encodeURI(document.getElementById('weight_birthkg').value);
	var length_birth = encodeURI(document.getElementById('length_birth').value);
	var length_birthcm = encodeURI(document.getElementById('length_birthcm').value);
	var distinguishing_marks = encodeURI(document.getElementById('distinguishing_marks').value);
	var circumference_head = encodeURI(document.getElementById('circumference_head').value);
	var circumference_headcm = encodeURI(document.getElementById('circumference_headcm').value);
	var circumference_chest = encodeURI(document.getElementById('circumference_chest').value);
	var circumference_chestcm = encodeURI(document.getElementById('circumference_chestcm').value);
	var blood_type = encodeURI(document.getElementById('blood_type').value);
	var weight_leavinghospital = encodeURI(document.getElementById('weight_leavinghospital').value);
	var weight_leavinghospitaloz = encodeURI(document.getElementById('weight_leavinghospitaloz').value);
	var weight_leavinghospitalkg = encodeURI(document.getElementById('weight_leavinghospitalkg').value);
	var b_doctor_name = encodeURI(document.getElementById('b_doctor_name').value);
	var b_clinic_address = encodeURI(document.getElementById('b_clinic_address').value);
	var b_room_bldg = encodeURI(document.getElementById('b_room_bldg').value);
	var b_specialty = encodeURI(document.getElementById('b_specialty').value);
	var b_hospital = encodeURI(document.getElementById('b_hospital').value);
	var b_landline = encodeURI(document.getElementById('b_landline').value);
	var b_cellphone = encodeURI(document.getElementById('b_cellphone').value);
	var b_email = encodeURI(document.getElementById('b_email').value);
	var m_doctor_name = encodeURI(document.getElementById('m_doctor_name').value);
	var m_clinic_address = encodeURI(document.getElementById('m_clinic_address').value);
	var m_room_bldg = encodeURI(document.getElementById('m_room_bldg').value);
	var m_specialty = encodeURI(document.getElementById('m_specialty').value);
	var m_hospital = encodeURI(document.getElementById('m_hospital').value);
	var m_landline = encodeURI(document.getElementById('m_landline').value);
	var m_cellphone = encodeURI(document.getElementById('m_cellphone').value);
	var m_email = encodeURI(document.getElementById('m_email').value);	
	
	
	var errval=false;
	if(bdatebaby.value==""){
		bdatebaby.className ="errorfield";
		errval = true;
	}else{
		bdatebaby.className ="okfield"; 		
	}
	if (goisDate(bdatebaby.value)==false){
		bdatebaby.className ="errorfield";
		bdatebaby.focus();
		errval = true;
	}

    
if(errval==true){
	//
	//document.getElementById('msg').innerHTML = err;
	return false;
  }

	
	var url="patient-detfamilyhrecordlist.php";
//	url=url+'?phypertensive='+phypertensive+'&pdrinker='+pdrinker+'&pdiabetic='+pdiabetic+
//	'&pdrinkerctr='+pdrinkerctr+'&psmoker='+psmoker+'&psmokerctr='+psmokerctr+'&pallergies='+pallergies+/
//	'&bdatereg='+sv_bdatereg+'&fname='+fname+'&lname='+lname+'&relationship='+relationship;  
	
	var urlback="patient-inbox.php?fainbox=20&pg=9&backfadeid=9&addfade=0&openfa=1"
  	urlback=urlback+'&midfa='+midfa+'&optcmd='+optcmdfa+'&bdatebaby='+sv_bdatebaby;
	urlback=urlback+'&timebirth='+timebirth+'&birthplace='+birthplace+'&hospital_clinic='+hospital_clinic;
	urlback=urlback+'&addressos='+addressos+'&phone='+phone+'&type_delivery='+type_delivery;
	urlback=urlback+'&condition_birth='+condition_birth+'&weight_birth='+weight_birth;
	urlback=urlback+'&weight_birthoz='+weight_birthoz;
	urlback=urlback+'&weight_birthkg='+weight_birthkg;
	urlback=urlback+'&length_birthcm='+length_birthcm;
	urlback=urlback+'&circumference_headcm='+circumference_headcm;
	urlback=urlback+'&length_birth='+length_birth+'&distinguishing_marks='+distinguishing_marks;
	urlback=urlback+'&circumference_head='+circumference_head+'&blood_type='+blood_type;
	urlback=urlback+'&circumference_chest='+circumference_chest;
	urlback=urlback+'&circumference_chestcm='+circumference_chestcm;
	urlback=urlback+'&weight_leavinghospitaloz='+weight_leavinghospitaloz;
	urlback=urlback+'&weight_leavinghospitalkg='+weight_leavinghospitalkg;
	urlback=urlback+'&weight_leavinghospital='+weight_leavinghospital+'&b_doctor_name='+b_doctor_name;
	urlback=urlback+'&b_clinic_address='+b_clinic_address+'&b_room_bldg='+b_room_bldg;
	urlback=urlback+'&b_specialty='+b_specialty+'&b_hospital='+b_hospital;
	urlback=urlback+'&b_landline='+b_landline+'&b_cellphone='+b_cellphone;
	urlback=urlback+'&b_email='+b_email+'&m_doctor_name='+m_doctor_name;
	urlback=urlback+'&m_clinic_address='+m_clinic_address+'&m_room_bldg='+m_room_bldg;
	urlback=urlback+'&m_specialty='+m_specialty+'&m_hospital='+m_hospital;
	urlback=urlback+'&m_landline='+m_landline+'&m_cellphone='+m_cellphone;
	urlback=urlback+'&m_email='+m_email;
	urlback=urlback+"#vhfa"; 
	
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
//	   document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		document.getElementById('tbl3').style.display = 'none';  
		
		
	 } 
	}
	//xmlHttp.open("GET",url,true)
//	xmlHttp.send(null)
	location.replace(urlback);
	
}
	
	
	function saveviewpro(optcmdfa,midfa){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	
    var msgerr = "";
	var xspace ='     ';
	var bdatereg		=  document.getElementById('bdatereg');
	
	
 var sv_bdatereg		=  document.getElementById('bdatereg').value;
 var phypertensive = encodeURI(document.getElementById('phypertensive').value);
	
	var pdrinker = encodeURI(document.getElementById('pdrinker').value);
	var pdrinkerctr = encodeURI(document.getElementById('pdrinkerctr').value);
	var psmoker = encodeURI(document.getElementById('psmoker').value);
	var psmokerctr = encodeURI(document.getElementById('psmokerctr').value);
	var pdiabetic = encodeURI(document.getElementById('pdiabetic').value);
	var pallergies = encodeURI(document.getElementById('pallergies').value);
	var fname = encodeURI(document.getElementById('fname').value);
	var lname = encodeURI(document.getElementById('lname').value);
	var relationship = encodeURI(document.getElementById('relationship').value);
	
	var errval=false;
	if(bdatereg.value==""){
		bdatereg.className ="errorfield";
		errval = true;
	}else{
		bdatereg.className ="okfield"; 		
	}
	if (goisDate(bdatereg.value)==false){
		bdatereg.className ="errorfield";
		bdatereg.focus();
		errval = true;
	}

    
if(errval==true){
	//
	//document.getElementById('msg').innerHTML = err;
	return false;
  }

	
	
	//var //url="patient-detfamilyhrecordlist.php?pg=9&openfa=1&addbo=1&fainbox=20&addfade=1&vloadfade=1&vaddfade=1"
//	url=url+'&midfa='+midfa+'&bdatereg='+sv_bdatereg;
	
	var url="patient-detfamilyhrecordlist.php";
	url=url+'?phypertensive='+phypertensive+'&pdrinker='+pdrinker+'&pdiabetic='+pdiabetic+
	'&pdrinkerctr='+pdrinkerctr+'&psmoker='+psmoker+'&psmokerctr='+psmokerctr+'&pallergies='+pallergies+
	'&bdatereg='+sv_bdatereg+'&fname='+fname+'&lname='+lname+'&relationship='+relationship;  
	  
	var urlback="patient-inbox.php?fainbox=20&pg=9&backfadeid=9&addfade=0&openfa=1"
    	urlback=urlback+'&midfa='+midfa+'&optcmd='+optcmdfa+'&bdatereg='+sv_bdatereg;
		urlback=urlback+'&phypertensive='+phypertensive+'&pdrinker='+pdrinker+'&pdiabetic='+pdiabetic;
		urlback=urlback+'&relationship='+relationship+'&pdrinkerctr='+pdrinkerctr+'&psmoker='+psmoker;
		urlback=urlback+'&psmokerctr='+psmokerctr+'&pallergies='+pallergies;
		urlback=urlback+'&fname='+fname+'&lname='+lname;
		urlback=urlback+"#vhfa"; 
	
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
//	   document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		document.getElementById('tbl3').style.display = 'none';  
		
		
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	location.replace(urlback);
	
}


function goisDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}

	
	function backsaveviewpro(itemidx,midfa){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	
    var msgerr = "";
	var xspace ='     ';
	
	
	var urlback="patient-inbox.php?fainbox=20&pg=9&backfadeid=9&addfade=0&openfa=1"
    	urlback=urlback+"&midfa="+itemidx
	     urlback=urlback+"#vhfa";
	
	location.replace(urlback);
	   
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
//	   document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		document.getElementById('tbl3').style.display = 'none';  
		
		
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

	
	//end new 01-15-2k10


function savedocmedicinesfa(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var brandloca		= encodeURIComponent(document.getElementById('brandloca').value);
	var indiposi		= encodeURIComponent(document.getElementById('indiposi').value);
	var dose		= encodeURIComponent(document.getElementById('dose').value);

	
	var msgerr = "";
	var xspace ='     ';

  /* if(brandloca==''){
			msgerr +=xspace+'Empty Brand/Generic \n';
			document.getElementById('brandloca').style.backgroundColor = "#FF7171"; 
			  document.getElementById('brandloca').style.border = "1px solid";
		  document.getElementById('brandloca').style.borderBottomColor = "#769DC5";
		  document.getElementById('brandloca').style.borderTopColor = "#769DC5";
		   document.getElementById('brandloca').style.borderLeftColor = "#769DC5";
		   document.getElementById('brandloca').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('brandloca').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('brandloca').style.border = "1px solid";
		  document.getElementById('brandloca').style.borderBottomColor = "#769DC5";
		  document.getElementById('brandloca').style.borderTopColor = "#769DC5";
		   document.getElementById('brandloca').style.borderLeftColor = "#769DC5";
		   document.getElementById('brandloca').style.borderRightColor = "#769DC5";
		}
		
	if(indiposi==''){
			msgerr +=xspace+'Empty Indication \n';
			document.getElementById('indiposi').style.backgroundColor = "#FF7171"; 
			  document.getElementById('indiposi').style.border = "1px solid";
		  document.getElementById('indiposi').style.borderBottomColor = "#769DC5";
		  document.getElementById('indiposi').style.borderTopColor = "#769DC5";
		   document.getElementById('indiposi').style.borderLeftColor = "#769DC5";
		   document.getElementById('indiposi').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('indiposi').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('indiposi').style.border = "1px solid";
		  document.getElementById('indiposi').style.borderBottomColor = "#769DC5";
		  document.getElementById('indiposi').style.borderTopColor = "#769DC5";
		   document.getElementById('indiposi').style.borderLeftColor = "#769DC5";
		   document.getElementById('indiposi').style.borderRightColor = "#769DC5";
		}	
	
		
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			 document.getElementById('tdbgmedicines').bgColor = '#FF7171';
			return false;
		}
	
	*/
  	document.getElementById('tdmedicinesfa').innerHTML=reloaderimg();
	var url="inc_pat_medicinesfa.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&brandloca='+brandloca+'&indiposi='+indiposi+'&dose='+dose;

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmedicinesfa').innerHTML=xmlHttp.responseText;
	//	location.replace('#membership_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_medicines\')', 1000);
	 } 
	}
	  document.getElementById('tdbgmedicinesfa').bgColor = '#FFFFFF';
	 document.getElementById('tdbgmedicinesfa').style.color = '#5C5C5C';
	  document.getElementById('tdbgmedicinesfa').innerHTML = 'Please list down any medications that are currently maintained:';
	// document.getElementById('tdbgmedicinesfa').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function gotoedit_medicinesfa(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (xsect!=4  ) { 
	
	   document.getElementById('tdbgmedicinesfa').bgColor = '#3C81C3';
	 document.getElementById('tdbgmedicinesfa').style.color = '#FFFF00';
	  document.getElementById('tdbgmedicinesfa').innerHTML = 'Please list down any medications that are currently maintained:';
	    
	} else {
	   document.getElementById('tdbgmedicinesfa').bgColor = '#FFFFFF';
	}
  	document.getElementById('tdmedicinesfa').innerHTML=reloaderimg();
	var url="inc_pat_medicinesfa.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmedicinesfa').innerHTML=xmlHttp.responseText;
		//location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
// end medicinefa reg 02-11-2k10
	
	
function backsavephealthfade(itemidx,midfa){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var bdatereg2		=  document.getElementById('bdatereg2');
    var bdatereg2save		=  document.getElementById('bdatereg2').value;
	var phealthr_question1 = encodeURI(document.getElementById('phealthr_question1').value);
	var phealthr_question2 = encodeURI(document.getElementById('phealthr_question2').value);
	var phealthr_question3 = encodeURI(document.getElementById('phealthr_question3').value);
	var phealthr_question4 = encodeURI(document.getElementById('phealthr_question4').value);
	var phealthr_question5 = encodeURI(document.getElementById('phealthr_question5').value);
	var phealthr_question6 = encodeURI(document.getElementById('phealthr_question6').value);
	var phealthr_question7 = document.getElementById('phealthr_question7');
    var phealthr_question72save		=  document.getElementById('phealthr_question7').value;
	
	
  
    var msgerr = "";
	var xspace ='     ';
	
	if(bdatereg2==''){
	   alert("Please enter  required field: Date Consultation")
	   location.replace('#perhealth');
	   bdatereg2.focus();
	   
		return false;
	}
	
	var urlback="patient-inbox.php?fainbox=20&pg=9&backfadeid=9&addfade=0&openfa=1"
    	urlback=urlback+"&midfa="+itemidx
	     urlback=urlback+"#vhfa";
	
	var url="patient-detfamilyhrecordlist.php?act=2&tvafade=2&xsect=4&vloadfade=''&addfade=5&bupdatefade=1&itemid="+itemidx;
	url=url+'&phealthr_question1='+phealthr_question1+'&phealthr_question2='+phealthr_question2+'&phealthr_question3='+phealthr_question3+'&phealthr_question4='+phealthr_question4+'&phealthr_question5='+phealthr_question5+'&phealthr_question6='+phealthr_question6+'&phealthr_question7='+phealthr_question72save+'&bdatereg2='+bdatereg2save;

	   
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
//	   document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		document.getElementById('tbl3').style.display = 'none';  
		location.replace(urlback);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


	
	function savephealthfade(itemidx,midfa){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var bdatereg2		=  document.getElementById('bdatereg2');
    var bdatereg2save		=  document.getElementById('bdatereg2').value;
	var phealthr_question1 = encodeURI(document.getElementById('phealthr_question1').value);
	var phealthr_question2 = encodeURI(document.getElementById('phealthr_question2').value);
	var phealthr_question3 = encodeURI(document.getElementById('phealthr_question3').value);
	var phealthr_question4 = encodeURI(document.getElementById('phealthr_question4').value);
	var phealthr_question5 = encodeURI(document.getElementById('phealthr_question5').value);
	var phealthr_question6 = encodeURI(document.getElementById('phealthr_question6').value);
	var phealthr_question7 = document.getElementById('phealthr_question7');
    var phealthr_question72save		=  document.getElementById('phealthr_question7').value;
	
	
  
    var msgerr = "";
	var xspace ='     ';
	
	if(bdatereg2==''){
	   alert("Please enter  required field: Date Consultation")
	   location.replace('#perhealth');
	   bdatereg2.focus();
	   
		return false;
	}
	
	var urlback="patient-inbox.php?fainbox=20&backfadeid=9&pg=9&addfade=0&openfa=1"
    	urlback=urlback+"&midfa="+itemidx
	     urlback=urlback+"#vhfa";
	
	var url="patient-detfamilyhrecordlist.php?act=1&tvafade=2&xsect=4&vloadfade=''&addfade=5&bupdatefade=1&itemid="+itemidx;
	url=url+'&phealthr_question1='+phealthr_question1+'&phealthr_question2='+phealthr_question2+'&phealthr_question3='+phealthr_question3+'&phealthr_question4='+phealthr_question4+'&phealthr_question5='+phealthr_question5+'&phealthr_question6='+phealthr_question6+'&phealthr_question7='+phealthr_question72save+'&bdatereg2='+bdatereg2save;

	   
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
//	   document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		document.getElementById('tbl3').style.display = 'none';  
		location.replace(urlback);
		//location.replace("patient-inbox.php?&fainbox=20&pg=9&addfade=0&midfa='+itemidx+'&openfa=1#vhfa");
		
	  //   document.getElementById('tbl3').style.display = 'block';  
		//document.getElementById('tdbgtest').style.display = 'block';  
		//setInterval('hidexmsgtimer(\'ajaxmsg_phealth\')', 1000);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

	
	
	
	function gotoedit_phealthaddfa(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  //	document.getElementById('tdheathr').innerHTML=reloaderimg();  pg=7&add=1&vload=1&vadd=1
	var url="patient-regfamilyhrecordlist.php?pg=9&addfa=1&vloadfa=1&vaddfa=1";
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace('patient-inbox.php?pg=9&addfa=1&vddfa=1#vhf');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

	function gotoedit_phealthaddfacancel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  //	document.getElementById('tdheathr').innerHTML=reloaderimg();  pg=7&add=1&vload=1&vadd=1
	var url="patient-regfamilyhrecordlist.php?pg=9&addfa=0&vloadfa=0&vaddfa=0";
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace('patient-inbox.php?pg=9&facancel=9&addfa=0&vddfa=0#vhf');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


		
	// end 12-02-2k9


// new 11-26-2k9
	
	function amessagedelpat(divdel){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var rprevmsg = document.getElementById("rprevmsg").value;
	var urlsuc = "patient-inbox.php?pg="+rprevmsg;
  	divdel.value="deleting...";
	var rmessid = document.getElementById("rmessid").value;
	var url="patient-inbox-messdelete.php";
	url=url+"?rmessid="+rmessid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
	 location.replace(urlsuc);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function pat_back2list(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  //	document.getElementById('tdheathr').innerHTML=reloaderimg();
	var url="patient-inbox-list.php?act=2";
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace('patient-inbox.php?pg=1#vhf');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

	
	// end 11-26-2k9

	// new 11-06-2k9 -mr

//save patient health

//area patient health
function gotoedit_phealthadd(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  //	document.getElementById('tdheathr').innerHTML=reloaderimg();  pg=7&add=1&vload=1&vadd=1
	var url="patient-health-list.php?pg=7&add=1&vload=1&vadd=1";
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace('patient-inbox.php?pg=7&add=1&vdd=1#vhf');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function gotoedit_phealth(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  //	document.getElementById('tdheathr').innerHTML=reloaderimg();
	var url="patient-health-list.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace('patient-inbox.php?pg=7&add=0&vdd=1#vhf');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function savephealth(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
    var bdatereg2		=  document.getElementById('bdatereg2');
    var bdatereg2save		=  document.getElementById('bdatereg2').value;
	var phealthr_question1 = encodeURI(document.getElementById('phealthr_question1').value);
	var phealthr_question2 = encodeURI(document.getElementById('phealthr_question2').value);
	var phealthr_question3 = encodeURI(document.getElementById('phealthr_question3').value);
	var phealthr_question4 = encodeURI(document.getElementById('phealthr_question4').value);
	var phealthr_question5 = encodeURI(document.getElementById('phealthr_question5').value);
	var phealthr_question6 = encodeURI(document.getElementById('phealthr_question6').value);
	var phealthr_question7 = document.getElementById('phealthr_question7');
    var phealthr_question72save		=  document.getElementById('phealthr_question7').value;
	
	
  
    var msgerr = "";
	var xspace ='     ';
	
	if(bdatereg2==''){
	   alert("Please enter  required field: Date Consultation")
	   location.replace('#perhealth');
	   bdatereg2.focus();
	   
		return false;
	}
	/*if(phealthr_question1==''){ 
	
	    document.getElementById('phealthr_question1').style.backgroundColor = "#FF7171"; 
		 document.getElementById('phealthr_question1').style.border = "1px solid";
		  document.getElementById('phealthr_question1').style.borderBottomColor = "#769DC5";
		  document.getElementById('phealthr_question1').style.borderTopColor = "#769DC5";
		   document.getElementById('phealthr_question1').style.borderLeftColor = "#769DC5";
		   document.getElementById('phealthr_question1').style.borderRightColor = "#769DC5"; 
		  
	   alert("Please enter  required field: What i am feeling question.")
	 location.replace('#what'); 
		return false;
	} else {
	document.getElementById('phealthr_question1').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('phealthr_question1').style.border = "1px solid";
		  document.getElementById('phealthr_question1').style.borderBottomColor = "#769DC5";
		  document.getElementById('phealthr_question1').style.borderTopColor = "#769DC5";
		   document.getElementById('phealthr_question1').style.borderLeftColor = "#769DC5";
		   document.getElementById('phealthr_question1').style.borderRightColor = "#769DC5";
	}
	
	if(phealthr_question2==''){ 
	
	    document.getElementById('phealthr_question2').style.backgroundColor = "#FF7171"; 
		 document.getElementById('phealthr_question2').style.border = "1px solid";
		  document.getElementById('phealthr_question2').style.borderBottomColor = "#769DC5";
		  document.getElementById('phealthr_question2').style.borderTopColor = "#769DC5";
		   document.getElementById('phealthr_question2').style.borderLeftColor = "#769DC5";
		   document.getElementById('phealthr_question2').style.borderRightColor = "#769DC5"; 
		  
	   alert("Please enter  required field: Name.")
	  location.replace('#namemo'); 
		return false;
	} else {
	document.getElementById('phealthr_question2').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('phealthr_question2').style.border = "1px solid";
		  document.getElementById('phealthr_question2').style.borderBottomColor = "#769DC5";
		  document.getElementById('phealthr_question2').style.borderTopColor = "#769DC5";
		   document.getElementById('phealthr_question2').style.borderLeftColor = "#769DC5";
		   document.getElementById('phealthr_question2').style.borderRightColor = "#769DC5";
	}
	
	if(phealthr_question7.value!=''){
	if (isDate(phealthr_question7.value)==false){
		phealthr_question7.focus();
		  document.getElementById('phealthr_question7').style.backgroundColor = "#FF7171"; 
		 document.getElementById('phealthr_question7').style.border = "1px solid";
		  document.getElementById('phealthr_question7').style.borderBottomColor = "#769DC5";
		  document.getElementById('phealthr_question7').style.borderTopColor = "#769DC5";
		   document.getElementById('phealthr_question7').style.borderLeftColor = "#769DC5";
		   document.getElementById('phealthr_question7').style.borderRightColor = "#769DC5";
		return false;
	} else {
	  document.getElementById('phealthr_question7').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('phealthr_question7').style.border = "1px solid";
		  document.getElementById('phealthr_question7').style.borderBottomColor = "#769DC5";
		  document.getElementById('phealthr_question7').style.borderTopColor = "#769DC5";
		   document.getElementById('phealthr_question7').style.borderLeftColor = "#769DC5";
		   document.getElementById('phealthr_question7').style.borderRightColor = "#769DC5";
	}
	}*/
       
  //	document.getElementById('tdheathr').innerHTML=reloaderimg();
	var url="patient-health-list.php?act=1&tva=2&xsect=4&vload=''&add=5&bupdate=1&itemid="+itemidx;
	url=url+'&phealthr_question1='+phealthr_question1+'&phealthr_question2='+phealthr_question2+'&phealthr_question3='+phealthr_question3+'&phealthr_question4='+phealthr_question4+'&phealthr_question5='+phealthr_question5+'&phealthr_question6='+phealthr_question6+'&phealthr_question7='+phealthr_question72save+'&bdatereg2='+bdatereg2save;
		
	
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
	//   document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		document.getElementById('tbl2').style.display = 'none';
		document.getElementById('tbl3').style.display = 'none';  
		location.replace('patient-inbox.php?pg=7&add=0#vhf');
		
	  //   document.getElementById('tbl3').style.display = 'block';  
		//document.getElementById('tdbgtest').style.display = 'block';  
		//setInterval('hidexmsgtimer(\'ajaxmsg_phealth\')', 1000);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}



function close1(nscid,tdv,rc) {
var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
//	var hide		= encodeURIComponent(document.getElementById('hide').value);
	
    document.getElementById(tdv).style.display = 'none';
   // document.getElementById('diva').innerHTML=reloaderimg();
    var url="announcenw.php?nsc1="+nscid;
	xmlHttp.onreadystatechange=function () {
//	alert(" gfgf " +xmlHttp.readyState);
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdannouncepo').innerHTML=xmlHttp.responseText;
		// document.getElementById('tdannouncepo').style.display = 'none';
    
	 }
	 
		} 
	


	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function closeblk1(nscid,tdv,ie) {
var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
//	var hide		= encodeURIComponent(document.getElementById('hide').value);
	alert("fijx :"+tdv);
    document.getElementById(tdv).style.display = 'none';
    var url="announcenw.php?nsc1="+nscid+"&ie="+ie;
	xmlHttp.onreadystatechange=function () {
//	alert(" gfgf " +xmlHttp.readyState);
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdannouncepo').innerHTML=xmlHttp.responseText;
		// document.getElementById('tdannouncepo').style.display = 'none';
       	alert("firefoxgrerererepasokakjx");
	 }
	 
		} 
	
	

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
	if (ie==1) {
    	//	document.getElementById('nava').innerHTML="";
			//document.getElementById('tdannouncepo').innerHTML=xmlHttp_two.responseText;
	    //	location.replace('doctors-inbox.php#con');
	  var xhr;
     xhr = new XMLHttpRequest();
     xhr.open("GET", "http://announcenw.php", true);
     xhr.timeout = 10000;

		alert ("ie pasogfgfgfgfgfgggggk"); 
		}
	
	}


function close2() {
var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
    document.getElementById('tb1announce2').style.display = 'none';
	//var url="announce.php?nsc=1";
	//location.replace('doctors-inbox.php?nsc=1');
	
    var url="announce.php?nsc2=2";
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdannouncepo').innerHTML=xmlHttp.responseText;
		//location.replace('#membership_l');
		location.replace('#con');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	//location.replace('doctors-inbox.php?hide=1#con');
}
function close3() {
var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
    document.getElementById('tb1announce3').style.display = 'none';
	//var url="announce.php?nsc=1";
	//location.replace('doctors-inbox.php?nsc=1');
    var url="announce.php?nsc3=3";
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdannouncepo').innerHTML=xmlHttp.responseText;
	//	location.replace('#con');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
	
}

//test
function gotoedit_test(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (xsect!=4  ) {
	   document.getElementById('tdbgtest').bgColor = '#FF7171';
	    
	} else {
	  document.getElementById('tdbgtest').bgColor = '#BCEDEB';
	  
	}
  	document.getElementById('tdtest').innerHTML=reloaderimg();
	var url="inc_pat_test.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdtest').innerHTML=xmlHttp.responseText;
		//location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function gotoedit_testdel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (confirm("Are you sure you want to delete?")) {
  	document.getElementById('tdtest').innerHTML=reloaderimg();
	var url="inc_pat_test.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdtest').innerHTML=xmlHttp.responseText;
		//location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}
function gotoedit_testres(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (confirm("Are you sure you want to restore?")) {
  	document.getElementById('tdtest').innerHTML=reloaderimg();
	var url="inc_pat_test.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdtest').innerHTML=xmlHttp.responseText;
		//location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}



function savedoctest(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var loca		= encodeURIComponent(document.getElementById('loca').value);
	var posi		= encodeURIComponent(document.getElementById('posi').value);
	
	var msgerr = "";
	var xspace ='     ';
/*	if(loca==''){
			msgerr +=xspace+'Empty Name of test \n';
			document.getElementById('loca').style.backgroundColor = "#FF7171"; 
			  document.getElementById('loca').style.border = "1px solid";
		  document.getElementById('loca').style.borderBottomColor = "#769DC5";
		  document.getElementById('loca').style.borderTopColor = "#769DC5";
		   document.getElementById('loca').style.borderLeftColor = "#769DC5";
		   document.getElementById('loca').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('loca').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('loca').style.border = "1px solid";
		  document.getElementById('loca').style.borderBottomColor = "#769DC5";
		  document.getElementById('loca').style.borderTopColor = "#769DC5";
		   document.getElementById('loca').style.borderLeftColor = "#769DC5";
		   document.getElementById('loca').style.borderRightColor = "#769DC5";
		}
	
		
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			 document.getElementById('tdbgtest').bgColor = '#FF7171';
			return false;
		}
	
	*/
  	document.getElementById('tdtest').innerHTML=reloaderimg();
	var url="inc_pat_test.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&loca='+loca+'&posi='+posi;

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdtest').innerHTML=xmlHttp.responseText;
	//	location.replace('#membership_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_test\')', 1000);
	 } 
	}
	 document.getElementById('tdbgtest').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
// end test

//medicines
function gotoedit_medicines(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (xsect!=4  ) {
	   document.getElementById('tdbgmedicines').bgColor = '#FF7171';
	    
	} else {
	  document.getElementById('tdbgmedicines').bgColor = '#BCEDEB';
	  
	}
  	document.getElementById('tdmedicines').innerHTML=reloaderimg();
	var url="inc_pat_medicines.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmedicines').innerHTML=xmlHttp.responseText;
		//location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function gotoedit_medicinesdel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (confirm("Are you sure you want to delete?")) {
  	document.getElementById('tdmedicines').innerHTML=reloaderimg();
	var url="inc_pat_medicines.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmedicines').innerHTML=xmlHttp.responseText;
		//location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}
function gotoedit_medicinesres(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (confirm("Are you sure you want to restore?")) {
  	document.getElementById('tdmedicines').innerHTML=reloaderimg();
	var url="inc_pat_medicines.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmedicines').innerHTML=xmlHttp.responseText;
		//location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}



function savedocmedicines(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var brandloca		= encodeURIComponent(document.getElementById('brandloca').value);
	var indiposi		= encodeURIComponent(document.getElementById('indiposi').value);
	var dose		= encodeURIComponent(document.getElementById('dose').value);
	var num_days		= encodeURIComponent(document.getElementById('num_days').value);
	
	var msgerr = "";
	var xspace ='     ';
	
/*	if(brandloca==''){
			msgerr +=xspace+'Empty Brand/Generic \n';
			document.getElementById('brandloca').style.backgroundColor = "#FF7171"; 
			  document.getElementById('brandloca').style.border = "1px solid";
		  document.getElementById('brandloca').style.borderBottomColor = "#769DC5";
		  document.getElementById('brandloca').style.borderTopColor = "#769DC5";
		   document.getElementById('brandloca').style.borderLeftColor = "#769DC5";
		   document.getElementById('brandloca').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('brandloca').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('brandloca').style.border = "1px solid";
		  document.getElementById('brandloca').style.borderBottomColor = "#769DC5";
		  document.getElementById('brandloca').style.borderTopColor = "#769DC5";
		   document.getElementById('brandloca').style.borderLeftColor = "#769DC5";
		   document.getElementById('brandloca').style.borderRightColor = "#769DC5";
		}
		
	if(indiposi==''){
			msgerr +=xspace+'Empty Indication \n';
			document.getElementById('indiposi').style.backgroundColor = "#FF7171"; 
			  document.getElementById('indiposi').style.border = "1px solid";
		  document.getElementById('indiposi').style.borderBottomColor = "#769DC5";
		  document.getElementById('indiposi').style.borderTopColor = "#769DC5";
		   document.getElementById('indiposi').style.borderLeftColor = "#769DC5";
		   document.getElementById('indiposi').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('indiposi').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('indiposi').style.border = "1px solid";
		  document.getElementById('indiposi').style.borderBottomColor = "#769DC5";
		  document.getElementById('indiposi').style.borderTopColor = "#769DC5";
		   document.getElementById('indiposi').style.borderLeftColor = "#769DC5";
		   document.getElementById('indiposi').style.borderRightColor = "#769DC5";
		}	
	
		
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			 document.getElementById('tdbgmedicines').bgColor = '#FF7171';
			return false;
		}
	
	*/
  	document.getElementById('tdmedicines').innerHTML=reloaderimg();
	var url="inc_pat_medicines.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&brandloca='+brandloca+'&indiposi='+indiposi+'&dose='+dose+'&num_days='+num_days;

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmedicines').innerHTML=xmlHttp.responseText;
	//	location.replace('#membership_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_medicines\')', 1000);
	 } 
	}
	 document.getElementById('tdbgmedicines').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

// end medicines
function checknum(e)
{ 
	isIE=document.all? 1:0
	keyEntry = !isIE? e.which:event.keyCode;
	if((keyEntry=='48'))
	{
		var str = document.getElementById(event.srcElement.name).value;
		if((str.indexOf('0')==-1 || str.indexOf('0')==0) && str.length<=0)
			return false;
		else if(str.indexOf('0')==0 && str.length>0)
			return false;
	}
	else
	{
		if((keyEntry > '47') && (keyEntry < '58')|| (keyEntry == '46') ) 
			return true;
		else if(keyEntry == '8')
			return true;
		else
			return false;
	}
} 

function checknum1(e)
{ 
	isIE=document.all? 1:0
	keyEntry = !isIE? e.which:event.keyCode;
	if((keyEntry=='48'))
	{
		var str = document.getElementById(event.srcElement.name).value;
		if((str.indexOf('0')==-1 || str.indexOf('0')==0) && str.length<=0)
			return false;
		else if(str.indexOf('0')==0 && str.length>0)
			return false;
	}
	else
	{
		if((keyEntry > '47') && (keyEntry < '58')) 
			return true;
		else if(keyEntry == '8')
			return true;
		else
			return false;
	}
} 

	//  end new 11-06-2k9 -mr

	
	
function jpageinbox(from, url, divid, pagelimit){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
  	document.getElementById(divid).innerHTML=reloaderimg(); 
	url=url+"?from="+from+"&actvinbox="+document.getElementById("pageactive").value
	//alert ("dd : "+document.getElementById("pageactive").value)
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById(divid).innerHTML=xmlHttp.responseText 
	 } 
	}
	
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function jpagesent(from, url, divid, pagelimit){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
  	document.getElementById(divid).innerHTML=reloaderimg(); 
	url=url+"?from="+from+"&actvinbox="+document.getElementById("pageactive").value
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById(divid).innerHTML=xmlHttp.responseText 
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function jpageappoint(from, url, divid, pagelimit){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
  	document.getElementById(divid).innerHTML=reloaderimg(); 
	url=url+"?from="+from+"&actvinbox="+document.getElementById("pageactive").value
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById(divid).innerHTML=xmlHttp.responseText 
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function jgenpage(from, url, divid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
  	document.getElementById(divid).innerHTML=reloaderimg(); 
	url=url+"?from="+from
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById(divid).innerHTML=xmlHttp.responseText 
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function jprovsearchpage(from, url, divid,exparam,xoption){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
  	document.getElementById(divid).innerHTML=reloaderimg(); 
	//url=url+"?from="+from+"&exparam="+escape(exparam)+"&option="+escape(xoption);
	url=url+"?from="+from+"&exparam="+exparam+"&option="+escape(xoption);
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById(divid).innerHTML=xmlHttp.responseText 
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//////get province///

function parseprov(regionid, provname, divprov){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
  	document.getElementById(divprov).innerHTML=reloaderimgrotate(); 
	url="inc_province.php?provname="+provname+"&regionid="+regionid
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById(divprov).innerHTML=xmlHttp.responseText 
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
/////////////////////////////////////////////////////pagination//////////////////////////////////////////////////////////////


function gotoedit_ads(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  	document.getElementById('tdads').innerHTML=reloaderimg();
	var url="inc_ads.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdads').innerHTML=xmlHttp.responseText;
		location.replace('#adsinc');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}



function viewmessage(mid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
  	document.getElementById("xviewmess").innerHTML="<img src='images/reloader.gif'/>"; 
	var url="doctors-inbox-message.php"
	url=url+"?mid="+mid
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("xviewmess").innerHTML=xmlHttp.responseText 
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function replyclick(){
	document.getElementById("rajaxmsg").innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;Reply"; 
}

function sendreply(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	document.getElementById("rajaxmsg").innerHTML="saving..."; 
	var rmessage = encodeURIComponent(document.getElementById("inreply").value);
	var rmessid = document.getElementById("rmessid").value;
	//alert("test:"+rmessage);
	if(rmessage==""){
	  document.getElementById('inreply').focus();
	       document.getElementById('inreply').style.backgroundColor = "#D3636B"; 
		 document.getElementById('inreply').style.border = "1px solid";
		  document.getElementById('inreply').style.borderBottomColor = "#769DC5";
		  document.getElementById('inreply').style.borderTopColor = "#769DC5";
		   document.getElementById('inreply').style.borderLeftColor = "#769DC5";
		   document.getElementById('inreply').style.borderRightColor = "#769DC5";
		     document.getElementById("rajaxmsg").innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;Reply"; 
		   return false;
	}else{

		document.getElementById('inreply').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('inreply').style.border = "1px solid";
		  document.getElementById('inreply').style.borderBottomColor = "#979799";
		  document.getElementById('inreply').style.borderTopColor = "#979799";
		   document.getElementById('inreply').style.borderLeftColor = "#979799";
		   document.getElementById('inreply').style.borderRightColor = "#979799";		
	} 
	var url="doctors-inbox-sendreply.php";
	url=url+"?rmessage="+rmessage+"&rmessid="+rmessid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		 document.getElementById("rajaxmsg").innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;Message Sent.";
		 document.getElementById("inreply").value = "";
	 }
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function sendreplypatient(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }

	var rmessage = encodeURIComponent(document.getElementById("inreply").value);
	var rmessid = document.getElementById("rmessid").value;
		if(rmessage==""){
	  document.getElementById('inreply').focus();
	       document.getElementById('inreply').style.backgroundColor = "#D3636B"; 
		 document.getElementById('inreply').style.border = "1px solid";
		  document.getElementById('inreply').style.borderBottomColor = "#769DC5";
		  document.getElementById('inreply').style.borderTopColor = "#769DC5";
		   document.getElementById('inreply').style.borderLeftColor = "#769DC5";
		   document.getElementById('inreply').style.borderRightColor = "#769DC5";
		   return false;
	}else{

		document.getElementById('inreply').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('inreply').style.border = "1px solid";
		  document.getElementById('inreply').style.borderBottomColor = "#979799";
		  document.getElementById('inreply').style.borderTopColor = "#979799";
		   document.getElementById('inreply').style.borderLeftColor = "#979799";
		   document.getElementById('inreply').style.borderRightColor = "#979799";		
	} 
		document.getElementById("rajaxmsg").innerHTML="saving..."; 
	
	
		
	var url="patient-inbox-sendreply.php";
	url=url+"?rmessage="+rmessage+"&rmessid="+rmessid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		 document.getElementById("rajaxmsg").innerHTML="Message Sent.";
		 document.getElementById("inreply").value = "";
	 }
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function approve(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	 	 alert ("Browyuyrt HTTP Request")
	var url="admincheckmess.php?act=1";
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
	 location.replace(urlsuc);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function ads_click() {
//	var rprevmsg = document.getElementById("rprevmsg").value;
//	var urlsuc = "doctors-inbox.php?pg="+rprevmsg;
 // 	divdel.value="deleting...";
//	var rmessid = document.getElementById("rmessid").value;
	//var url="ads700.php";
	//url=url+"?rmessid="+rmessid;
//	xmlHttp.open("GET",url,true)
	//xmlHttp.send(null)
   alert("dfsfdfdf ads click");	
}


function checksendmsg() {
	var sendmsg = document.getElementById("sendmsg").value;
    //var chklen = chkna.length;s.length;
   alert("ilan"+sendmsg);	
}

function rtext() {
  document.getElementById("loguser_name2").value = ''; 
}
function rtext1() {
   document.getElementById("logpass").value = ''; 
    document.getElementById('logpass').type = "password"; 
	
	
}


function amessagedel(divdel){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var rprevmsg = document.getElementById("rprevmsg").value;
	var urlsuc = "doctors-inbox.php?pg="+rprevmsg;
  	divdel.value="deleting...";
	var rmessid = document.getElementById("rmessid").value;
	var url="doctors-inbox-messdelete.php";
	url=url+"?rmessid="+rmessid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
	 location.replace(urlsuc);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function amessageapt(divapt){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }
  	document.getElementById('sapprov').innerHTML="approving...";
  	document.getElementById('sapprov2').innerHTML="approving...";
	var rmessid = document.getElementById("rmessid").value;
	var xrapid = document.getElementById("xrapid").value;
	var url="doctors-inbox-aptaprove.php";
	url=url+"?rmessid="+rmessid+"&xrapid="+xrapid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('sapprov').innerHTML="Appointment Approved.";
		document.getElementById('sapprov2').innerHTML="Appointment Approved.";
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//save doctor profile//

function savedocprof(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	 }

	//var bdate_day	= encodeURI(document.getElementById('bdate_day').value);
	//var bdate_month	= encodeURI(document.getElementById('bdate_month').value);
	//var bdate_year	= encodeURI(document.getElementById('bdate_year').value);
	var bdate	= escape(document.getElementById('bdate').value);
	var prof_gender	= escape(document.getElementById('prof_gender').value);
	var prof_status	= escape(document.getElementById('prof_status').value);
	var prof_nationality	= escape(document.getElementById('prof_nationality').value);
	var prof_prov	= escape(document.getElementById('prof_prov').value);
	var prof_city	= escape(document.getElementById('prof_city').value);
	var prof_street	= escape(document.getElementById('prof_street').value);
	var prof_barangay	= escape(document.getElementById('prof_barangay').value);
	var prof_zip	= escape(document.getElementById('prof_zip').value);
	var prof_phone	= escape(document.getElementById('prof_phone').value);
	var prof_fax	= escape(document.getElementById('prof_fax').value);
	var prof_mobile	= escape(document.getElementById('prof_mobile').value);
	var prof_mobile2	= escape(document.getElementById('prof_mobile2').value);
	var prof_hobbies	= escape(document.getElementById('prof_hobbies').value);
	
	var prac_patientave	= escape(document.getElementById('prac_patientave').value);
	var prac_waiting	= escape(document.getElementById('prac_waiting').value);
	var prac_fee	= escape(document.getElementById('prac_fee').value);
	
	/*var dt=bdate_month+"/"+bdate_day+"/"+bdate_year;
	var msgerr = "";
	var	datemsg = isDate(dt);
	var xspace ='     ';/*
		if(prof_username==''){
			msgerr +=xspace+'Empty Username \n';
		}*/
		
  	document.getElementById('tdperprof').innerHTML=reloaderimg();
	var url="inc_doc_profile.php?act=1";
	url=url+'&prof_gender='+prof_gender+'&prof_status='+prof_status+'&prof_nationality='+prof_nationality+'&prof_prov='+prof_prov+'&prof_city='+prof_city+'&prof_street='+prof_street+'&prof_barangay='+prof_barangay+'&prof_zip='+prof_zip+'&prof_phone='+prof_phone+'&prof_fax='+prof_fax+'&prof_mobile='+prof_mobile+'&prof_mobile2='+prof_mobile2+'&prof_hobbies='+prof_hobbies+'&prac_patientave='+prac_patientave+'&prac_waiting='+prac_waiting+'&prac_fee='+prac_fee+'&bdate='+bdate
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdperprof').innerHTML=xmlHttp.responseText;
		//location.replace('#perinfo_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_prof\')', 1000);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function hidexmsgtimer(mgsdivhide){
	if(timerx>=10){
		document.getElementById(mgsdivhide).style.display = "none";
		timerx = 0;
		return false;
	}else{
		timerx++;
	}
}
//end save doctor profile//


//message contactus
function checkmess() {
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
 var vname 			=  document.getElementById('vname').value;
 var vemail 			=  document.getElementById('vemail').value;
 var vmessage 			=  document.getElementById('vmessage').value;

    var msgerr = "";
	var xspace ='     ';
	
	if(vname==''){
			msgerr +=xspace+'Empty Name \n';
			document.getElementById('vname').style.backgroundColor = "#FF7171"; 
			 document.getElementById('vname').style.border = "1px solid";
		  document.getElementById('vname').style.borderBottomColor = "#979799";
		  document.getElementById('vname').style.borderTopColor = "#979799";
		   document.getElementById('vname').style.borderLeftColor = "#979799";
		   document.getElementById('vname').style.borderRightColor = "#979799";
	} else {
	  	  document.getElementById('vname').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('vname').style.border = "1px solid";
		  document.getElementById('vname').style.borderBottomColor = "#979799";
		  document.getElementById('vname').style.borderTopColor = "#979799";
		   document.getElementById('vname').style.borderLeftColor = "#979799";
		   document.getElementById('vname').style.borderRightColor = "#979799";
	}
	
	
 if (document.getElementById('vemail').value != "" || document.getElementById('vemail').value != '') {
		  if (vmessage=='') {
		   document.getElementById('vmessage').style.backgroundColor = "#FF7171"; 
			 document.getElementById('vmessage').style.border = "1px solid";
		  document.getElementById('vmessage').style.borderBottomColor = "#979799";
		  document.getElementById('vmessage').style.borderTopColor = "#979799";
		   document.getElementById('vmessage').style.borderLeftColor = "#979799";
		   document.getElementById('vmessage').style.borderRightColor = "#979799";
			alert("Empty Message Please re-enter.");
               msgerr = "err : "; msgerr +=xspace+'Empty Message \n';
		return false;  
		  }
		
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('vemail').value)) {
       document.getElementById('vemail').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('vemail').style.border = "1px solid";
		  document.getElementById('vemail').style.borderBottomColor = "#979799";
		  document.getElementById('vemail').style.borderTopColor = "#979799";
		   document.getElementById('vemail').style.borderLeftColor = "#979799";
		   document.getElementById('vemaill').style.borderRightColor = "#979799";
	   
	} else {	
		msgerr +=xspace+'Invalid email address! Please re-enter. \n';
		document.getElementById('vemail').style.backgroundColor = "#FF7171"; 
			 document.getElementById('vemail').style.border = "1px solid";
		  document.getElementById('vemail').style.borderBottomColor = "#979799";
		  document.getElementById('vemail').style.borderTopColor = "#979799";
		   document.getElementById('vemail').style.borderLeftColor = "#979799";
		   document.getElementById('vemail').style.borderRightColor = "#979799";
	
	}
	
	} else {
	   	msgerr +=xspace+'Empty Email \n';
		document.getElementById('vemail').style.backgroundColor = "#FF7171"; 
			 document.getElementById('vemail').style.border = "1px solid";
		  document.getElementById('vemail').style.borderBottomColor = "#979799";
		  document.getElementById('vemail').style.borderTopColor = "#979799";
		   document.getElementById('vemail').style.borderLeftColor = "#979799";
		   document.getElementById('vemail').style.borderRightColor = "#979799";
	}

 

   if (vmessage=='') {
	     
			msgerr +=xspace+'Empty Message \n';
			document.getElementById('vmessage').style.backgroundColor = "#FF7171"; 
			 document.getElementById('vmessage').style.border = "1px solid";
		  document.getElementById('vmessage').style.borderBottomColor = "#979799";
		  document.getElementById('vmessage').style.borderTopColor = "#979799";
		   document.getElementById('vmessage').style.borderLeftColor = "#979799";
		   document.getElementById('vmessage').style.borderRightColor = "#979799";
	} else {
	  	  document.getElementById('vmessage').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('vmessage').style.border = "1px solid";
		  document.getElementById('vmessage').style.borderBottomColor = "#979799";
		  document.getElementById('vmessage').style.borderTopColor = "#979799";
		   document.getElementById('vmessage').style.borderLeftColor = "#979799";
		   document.getElementById('vmessage').style.borderRightColor = "#979799";
	}
	
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			return false;
	}
	
	//if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
//	alert( "pasok");
	//document.getElementById('tdmess').innerHTML=xmlHttp.responseText;
	setInterval('hidexmsgtimerz(\'ajaxmsg_mess\')', 1000);
//	}
}
//end mscontct


function hidexmsgtimerz(mgsdivhide){
	alert(" ilan"+timerx);
	if(timerx>=10){
		alert("pumasok d2");
		document.getElementById(mgsdivhide).style.display = "none";
		timerx = 0;
		return false;
	}else{
		timerx++;
	}
}

//practice information
function savedocpracticereg(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	var psequencechk	= document.getElementById('sequencechk').checked;
	var pemail	= document.getElementById('pemail').value;
	var tfdreg	= encodeURI(document.getElementById('tfdreg').value);
	var tfdreg1	= document.getElementById('tfdreg').value;
	var tfdregprev	= document.getElementById('tfdregprev').value;
	var prof_remarks	= encodeURI(document.getElementById('prof_remarks').value);
	var del_remarks	= encodeURI(document.getElementById('del_remarks').value);
	
	
	//alert("fdfd "+del_remarks);
	
	if (tfdregprev==1 && tfdreg1!=1 || tfdregprev!=1 && tfdreg1==1) {
   	if(prof_remarks==''){
		//	msgerr +=xspace+'Empty Remarks \n';
			document.getElementById('prof_remarks').style.backgroundColor = "#FF7171"; 
			 document.getElementById('prof_remarks').style.border = "1px solid";
		  document.getElementById('prof_remarks').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_remarks').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_remarks').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_remarks').style.borderRightColor = "#769DC5";
		   alert("Empty Remarks Please re-enter.");
       return false;  
	} else {
	  	  document.getElementById('prof_remarks').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('prof_remarks').style.border = "1px solid";
		  document.getElementById('prof_remarks').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_remarks').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_remarks').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_remarks').style.borderRightColor = "#769DC5";
	}
	}
	
	
	var prof_password	= encodeURI(document.getElementById('prof_password').value);
	var prof_cpassword	= encodeURI(document.getElementById('prof_cpassword').value);
	var prof_fname	= encodeURIComponent(document.getElementById('prof_fname').value);
	var prof_mname	= encodeURIComponent(document.getElementById('prof_mname').value);
	var prof_lname	= encodeURIComponent(document.getElementById('prof_lname').value);
	var prof_sname	= encodeURIComponent(document.getElementById('prof_sname').value);
	
	var prac_field	= encodeURI(document.getElementById('prac_field').value);
	var prac_years	= encodeURI(document.getElementById('prac_years').value);
	var prac_prc	= encodeURI(document.getElementById('prac_prc').value);
	var prac_dateisued	= encodeURI(document.getElementById('prac_dateisued').value);
	var specialty1	= encodeURI(document.getElementById('specialty1').value);
	var specialty2	= encodeURI(document.getElementById('specialty2').value);
	
	var prac_exper1	= encodeURIComponent(document.getElementById('prac_exper1').value);
	if (prac_exper1=="Indicate, at most, five (5) areas of expertise that you specialize in.  Separate each entry with a comma (,).") {	
			prac_exper1 = '';
			document.getElementById('prac_exper1').value='';
	}
	
//	var prac_exper2	= encodeURIComponent(document.getElementById('prac_exper2').value);
//	var prac_exper3	= encodeURIComponent(document.getElementById('prac_exper3').value);
//	var prac_exper4	= encodeURIComponent(document.getElementById('prac_exper4').value);
	var prac_sponsor = encodeURIComponent(document.getElementById('prac_sponsor').value);
   	var prac_payment = encodeURIComponent(document.getElementById('prac_payment').value);
	var prac_sequence = encodeURIComponent(document.getElementById('prac_sequence').value);
    var prac_expiry = encodeURIComponent(document.getElementById('prac_expiry').value);
	
	
	
	var tfddtereg	= encodeURI(document.getElementById('tfddtereg').value);
	var prac_oldid	= encodeURI(document.getElementById('prac_oldid').value);

	var msgerr = "";
	var xspace ='     ';
	
   
 /*   if (tfdregprev==1 && tfdreg!=1) {
   	if(prac_remarks==''){
			msgerr +=xspace+'Empty Remarks \n';
			document.getElementById('prac_remarks').style.backgroundColor = "#FF7171"; 
			 document.getElementById('prac_remarks').style.border = "1px solid";
		  document.getElementById('prac_remarks').style.borderBottomColor = "#769DC5";
		  document.getElementById('prac_remarks').style.borderTopColor = "#769DC5";
		   document.getElementById('prac_remarks').style.borderLeftColor = "#769DC5";
		   document.getElementById('prac_remarks').style.borderRightColor = "#769DC5";
	} else {
	  	  document.getElementById('prac_remarks').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('prac_remarks').style.border = "1px solid";
		  document.getElementById('prac_remarks').style.borderBottomColor = "#769DC5";
		  document.getElementById('prac_remarks').style.borderTopColor = "#769DC5";
		   document.getElementById('prac_remarks').style.borderLeftColor = "#769DC5";
		   document.getElementById('prac_remarks').style.borderRightColor = "#769DC5";
	}
	}
   */
   if (document.getElementById('pemail').value != "" || document.getElementById('pemail').value != '') {
		
   if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('pemail').value)) {
	   document.getElementById('pemail').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('pemail').style.border = "1px solid";
		  document.getElementById('pemail').style.borderBottomColor = "#769DC5";
		  document.getElementById('pemail').style.borderTopColor = "#769DC5";
		   document.getElementById('pemail').style.borderLeftColor = "#769DC5";
		   document.getElementById('pemail').style.borderRightColor = "#769DC5";
	   
	} else {	
		msgerr +=xspace+'Invalid email address! Please re-enter. \n';
		document.getElementById('pemail').style.backgroundColor = "#FF7171"; 
			 document.getElementById('pemail').style.border = "1px solid";
		  document.getElementById('pemail').style.borderBottomColor = "#769DC5";
		  document.getElementById('pemail').style.borderTopColor = "#769DC5";
		   document.getElementById('pemail').style.borderLeftColor = "#769DC5";
		   document.getElementById('pemail').style.borderRightColor = "#769DC5";
	
	}
	
	}
	
	var tmpemail	= document.getElementById('pemail').value;
		if(prof_password!=prof_cpassword){
			msgerr +=xspace+'Password do not match \n';
		   document.getElementById('prof_password').style.backgroundColor = "#FF7171"; 
		 document.getElementById('prof_password').style.border = "1px solid";
		  document.getElementById('prof_password').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_password').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_password').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_password').style.borderRightColor = "#769DC5";
		   
		    document.getElementById('prof_cpassword').style.backgroundColor = "#FF7171"; 
		 document.getElementById('prof_cpassword').style.border = "1px solid";
		  document.getElementById('prof_cpassword').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_cpassword').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_cpassword').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_cpassword').style.borderRightColor = "#769DC5";
		} else {
			document.getElementById('prof_password').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('prof_password').style.border = "1px solid";
		  document.getElementById('prof_password').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_password').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_password').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_password').style.borderRightColor = "#769DC5";
		
		document.getElementById('prof_cpassword').style.backgroundColor = "#FFFFFF"; 
		document.getElementById('prof_cpassword').style.border = "1px solid";
		  document.getElementById('prof_cpassword').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_cpassword').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_cpassword').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_cpassword').style.borderRightColor = "#769DC5";
		}
		
		
		if(prof_fname==''){
			msgerr +=xspace+'Empty First Name \n';
			document.getElementById('prof_fname').style.backgroundColor = "#FF7171"; 
			 document.getElementById('prof_fname').style.border = "1px solid";
		  document.getElementById('prof_fname').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_fname').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_fname').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_fname').style.borderRightColor = "#769DC5";
	} else {
	  	  document.getElementById('prof_fname').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('prof_fname').style.border = "1px solid";
		  document.getElementById('prof_fname').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_fname').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_fname').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_fname').style.borderRightColor = "#769DC5";
	}
		if(prof_lname==''){
			msgerr +=xspace+'Empty Last Name \n';
			document.getElementById('prof_lname').style.backgroundColor = "#FF7171"; 
			 document.getElementById('prof_lname').style.border = "1px solid";
		  document.getElementById('prof_lname').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_lname').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_lname').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_lname').style.borderRightColor = "#769DC5";
	} else {
	  	  document.getElementById('prof_lname').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('prof_lname').style.border = "1px solid";
		  document.getElementById('prof_lname').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_lname').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_lname').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_lname').style.borderRightColor = "#769DC5";
	}
		
		if(msgerr!=''){
			alert("Error:\n"+msgerr);
			return false;
		}
  document.getElementById('tdpractice').innerHTML=reloaderimg();
	var url="inc_doc_practice.php?act=1";
	url=url+"&prof_password="+prof_password+"&pemail="+pemail+"&prof_fname="+prof_fname+"&prof_mname="+prof_mname+"&prof_lname="+prof_lname+"&prof_sname="+prof_sname+"&prac_years="+prac_years+"&prac_prc="+prac_prc+"&prac_dateisued="+prac_dateisued+"&prac_field="+prac_field+"&specialty1="+specialty1+"&specialty2="+specialty2+"&prac_exper1="+prac_exper1+"&tfdreg="+tfdreg+"&tfddtereg="+tfddtereg+"&prac_oldid="+prac_oldid+"&prac_sponsor="+prac_sponsor+"&prac_payment="+prac_payment+"&prac_sequence="+prac_sequence+"&prac_expiry="+prac_expiry+"&del_remarks="+del_remarks;
	if (psequencechk==true) {
	   url=url+"&seqchk=1";
	}
	
	 if (tfdregprev==1 && tfdreg1!=1 || tfdregprev!=1 && tfdreg1==1) {
		url=url+"&prof_remarks="+prof_remarks+"&tfdregprev="+tfdregprev; 
	 }
xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdpractice').innerHTML=xmlHttp.responseText;
		//location.replace('#pracinfo_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_practice\')', 1000);
		
	 } 
	}
	
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

}
//end about practice

function savedocpractice(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	var pemail	= encodeURI(document.getElementById('pemail').value);
	var prof_password	= encodeURI(document.getElementById('prof_password').value);
	var prof_cpassword	= encodeURI(document.getElementById('prof_cpassword').value);
	var prof_fname	= encodeURIComponent(document.getElementById('prof_fname').value);
	var prof_mname	=  encodeURIComponent(document.getElementById('prof_mname').value);
	var prof_lname	= encodeURIComponent(document.getElementById('prof_lname').value);
	var prof_sname	= encodeURIComponent(document.getElementById('prof_sname').value);
	
	var prac_field	= encodeURI(document.getElementById('prac_field').value);
	var prac_years	= encodeURI(document.getElementById('prac_years').value);
	var prac_prc	= encodeURI(document.getElementById('prac_prc').value);
	var prac_dateisued	= encodeURI(document.getElementById('prac_dateisued').value);
	var specialty1	= encodeURI(document.getElementById('specialty1').value);
	var specialty2	= encodeURI(document.getElementById('specialty2').value);
	
	var prac_exper1	= encodeURI(document.getElementById('prac_exper1').value);
	if (prac_exper1=="Indicate, at most, five (5) areas of expertise that you specialize in.  Separate each entry with a comma (,).") {	
			prac_exper1 = '';
			document.getElementById('prac_exper1').value='';
	}
//	var prac_exper2	= encodeURI(document.getElementById('prac_exper2').value);
//	var prac_exper3	= encodeURI(document.getElementById('prac_exper3').value);
//	var prac_exper4	= encodeURI(document.getElementById('prac_exper4').value);

	var msgerr = "";
	var xspace ='     ';
			if(!echeck2(pemail)){
			msgerr +=xspace+'Empty email address \n';
		}
		  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('pemail').value)) {
			document.getElementById('pemail').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('pemail').style.border = "1px solid";
		  document.getElementById('pemail').style.borderBottomColor = "#769DC5";
		  document.getElementById('pemail').style.borderTopColor = "#769DC5";
		   document.getElementById('pemail').style.borderLeftColor = "#769DC5";
		   document.getElementById('pemail').style.borderRightColor = "#769DC5";  
	} else {	
		msgerr +=xspace+'Invalid email address! Please re-enter. \n';
		document.getElementById('pemail').style.backgroundColor = "#FF7171"; 
			 document.getElementById('pemail').style.border = "1px solid";
		  document.getElementById('pemail').style.borderBottomColor = "#769DC5";
		  document.getElementById('pemail').style.borderTopColor = "#769DC5";
		   document.getElementById('pemail').style.borderLeftColor = "#769DC5";
		   document.getElementById('pemail').style.borderRightColor = "#769DC5";
	
	
	}
		if(prof_password!=prof_cpassword){
			msgerr +=xspace+'Password do not match \n';
			 document.getElementById('prof_password').style.backgroundColor = "#FF7171"; 
		 document.getElementById('prof_password').style.border = "1px solid";
		  document.getElementById('prof_password').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_password').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_password').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_password').style.borderRightColor = "#769DC5";
		   
		    document.getElementById('prof_cpassword').style.backgroundColor = "#FF7171"; 
		 document.getElementById('prof_cpassword').style.border = "1px solid";
		  document.getElementById('prof_cpassword').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_cpassword').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_cpassword').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_cpassword').style.borderRightColor = "#769DC5";
		} else {
			document.getElementById('prof_password').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('prof_password').style.border = "1px solid";
		  document.getElementById('prof_password').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_password').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_password').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_password').style.borderRightColor = "#769DC5";
		
		document.getElementById('prof_cpassword').style.backgroundColor = "#FFFFFF"; 
		document.getElementById('prof_cpassword').style.border = "1px solid";
		  document.getElementById('prof_cpassword').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_cpassword').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_cpassword').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_cpassword').style.borderRightColor = "#769DC5";
		}

        
		if(prof_fname==''){
			msgerr +=xspace+'Empty First Name \n';
			document.getElementById('prof_fname').style.backgroundColor = "#FF7171"; 
			 document.getElementById('prof_fname').style.border = "1px solid";
		  document.getElementById('prof_fname').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_fname').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_fname').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_fname').style.borderRightColor = "#769DC5";
	} else {
	  	  document.getElementById('prof_fname').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('prof_fname').style.border = "1px solid";
		  document.getElementById('prof_fname').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_fname').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_fname').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_fname').style.borderRightColor = "#769DC5";
	}
		if(prof_lname==''){
			msgerr +=xspace+'Empty Last Name \n';
			document.getElementById('prof_lname').style.backgroundColor = "#FF7171"; 
			 document.getElementById('prof_lname').style.border = "1px solid";
		  document.getElementById('prof_lname').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_lname').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_lname').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_lname').style.borderRightColor = "#769DC5";
	} else {
	  	  document.getElementById('prof_lname').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('prof_lname').style.border = "1px solid";
		  document.getElementById('prof_lname').style.borderBottomColor = "#769DC5";
		  document.getElementById('prof_lname').style.borderTopColor = "#769DC5";
		   document.getElementById('prof_lname').style.borderLeftColor = "#769DC5";
		   document.getElementById('prof_lname').style.borderRightColor = "#769DC5";
	}
		
		if(msgerr!=''){
			alert("Error:\n"+msgerr);
			return false;
		}
  	document.getElementById('tdpractice').innerHTML=reloaderimg();
	var url="inc_doc_practice.php?act=1";
	url=url+'&pemail='+pemail+'&prof_password='+prof_password+'&prof_fname='+prof_fname+'&prof_mname='+prof_mname+'&prof_lname='+prof_lname+'&prof_sname='+prof_sname+'&prac_years='+prac_years+'&prac_prc='+prac_prc+'&prac_dateisued='+prac_dateisued+'&prac_field='+prac_field+'&specialty1='+specialty1+'&specialty2='+specialty2+'&prac_exper1='+prac_exper1
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdpractice').innerHTML=xmlHttp.responseText;
		//location.replace('#pracinfo_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_practice\')', 1000);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end about practice
function savedocabtpractice(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	var aboutmypr	= encodeURI(document.getElementById('aboutmypr').value);

  	document.getElementById('tdabtpract').innerHTML=reloaderimg();
	var url="inc_doc_aboutmyprac.php?act=1";
	url=url+'&aboutmypr='+aboutmypr
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdabtpract').innerHTML=xmlHttp.responseText;
		//location.replace('#aboutprac');
		setInterval('hidexmsgtimer(\'ajaxmsg_abtpractice\')', 1000);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end about practice 
function savedocgeninfo(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	var geninfo	= encodeURI(document.getElementById('geninfo').value);

  	document.getElementById('tdgeninfo').innerHTML=reloaderimg();
	var url="inc_doc_geninfo.php?act=1";
	url=url+'&geninfo='+geninfo
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdgeninfo').innerHTML=xmlHttp.responseText;
		location.replace('#geninfo_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_geninfo\')', 1000);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

//save clinic
function savedocclinic(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var clin_name		= encodeURIComponent(document.getElementById('clin_name').value);
	var clin_bldg		= encodeURIComponent(document.getElementById('clin_bldg').value);
	var clin_dept		= encodeURIComponent(document.getElementById('clin_dept').value);
	var clin_room		= encodeURIComponent(document.getElementById('clin_room').value);
	var clin_prov		= encodeURI(document.getElementById('clin_prov').value);
	var clin_city		= encodeURI(document.getElementById('clin_city').value);
	var clin_district	= encodeURI(document.getElementById('clin_district').value);
	var clin_st			= encodeURI(document.getElementById('clin_st').value);
	var clin_zip		= encodeURI(document.getElementById('clin_zip').value);
	var clin_phone		= encodeURI(document.getElementById('clin_phone').value);
	var clin_trunk		= encodeURI(document.getElementById('clin_trunk').value);
	var clin_local		= encodeURI(document.getElementById('clin_local').value);
	var clin_fax		= encodeURI(document.getElementById('clin_fax').value);
	var clin_position		= encodeURIComponent(document.getElementById('clin_position').value);
	var clin_hmo		= encodeURIComponent(document.getElementById('clin_hmo').value);
	var clin_assitant	= encodeURIComponent(document.getElementById('clin_assitant').value);
	var clin_monf_am	= encodeURI(document.getElementById('clin_monf_am').value);
	var clin_mont_am	= encodeURI(document.getElementById('clin_mont_am').value);
	var clin_monf_pm	= encodeURI(document.getElementById('clin_monf_pm').value);
	var clin_mont_pm	= encodeURI(document.getElementById('clin_mont_pm').value);
	var clin_tuef_am	= encodeURI(document.getElementById('clin_tuef_am').value);
	var clin_tuet_am	= encodeURI(document.getElementById('clin_tuet_am').value);
	var clin_tuef_pm	= encodeURI(document.getElementById('clin_tuef_pm').value);
	var clin_tuet_pm	= encodeURI(document.getElementById('clin_tuet_pm').value);
	var clin_wenf_am	= encodeURI(document.getElementById('clin_wenf_am').value);
	var clin_went_am	= encodeURI(document.getElementById('clin_went_am').value);
	var clin_wenf_pm	= encodeURI(document.getElementById('clin_wenf_pm').value);
	var clin_went_pm	= encodeURI(document.getElementById('clin_went_pm').value);
	var clin_thuf_am	= encodeURI(document.getElementById('clin_thuf_am').value);
	var clin_thut_am	= encodeURI(document.getElementById('clin_thut_am').value);
	var clin_thuf_pm	= encodeURI(document.getElementById('clin_thuf_pm').value);
	var clin_thut_pm	= encodeURI(document.getElementById('clin_thut_pm').value);
	var clin_frif_am	= encodeURI(document.getElementById('clin_frif_am').value);
	var clin_frit_am	= encodeURI(document.getElementById('clin_frit_am').value);
	var clin_frif_pm	= encodeURI(document.getElementById('clin_frif_pm').value);
	var clin_frit_pm	= encodeURI(document.getElementById('clin_frit_pm').value);
	var clin_satf_am	= encodeURI(document.getElementById('clin_satf_am').value);
	var clin_satt_am	= encodeURI(document.getElementById('clin_satt_am').value);
	var clin_satf_pm	= encodeURI(document.getElementById('clin_satf_pm').value);
	var clin_satt_pm	= encodeURI(document.getElementById('clin_satt_pm').value);
	var clin_name_oth	= encodeURIComponent(document.getElementById('clin_name_oth').value);
    
	
	
	
	var msgerr = "";
	var xspace ='     ';
	
	if(clin_name==''){
			msgerr +=xspace+'Empty Clinic Name \n';
	        document.getElementById('clin_name').style.backgroundColor = "#FF7171"; 
			  document.getElementById('clin_name').style.border = "1px solid";
		  document.getElementById('clin_name').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_name').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_name').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_name').style.borderRightColor = "#769DC5";		
	} else {
		document.getElementById('clin_name').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('clin_name').style.border = "1px solid";
		  document.getElementById('clin_name').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_name').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_name').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_name').style.borderRightColor = "#769DC5";
	}
	
	if(clin_name=='others'){
		if (clin_name_oth=='') {
			msgerr +=xspace+'Empty Others-Clinic Name \n';
		    	        document.getElementById('clin_name_oth').style.backgroundColor = "#FF7171"; 
			  document.getElementById('clin_name_oth').style.border = "1px solid";
		  document.getElementById('clin_name_oth').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_name_oth').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_name_oth').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_name_oth').style.borderRightColor = "#769DC5";		

		} else {
					document.getElementById('clin_name_oth').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('clin_name_oth').style.border = "1px solid";
		  document.getElementById('clin_name_oth').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_name_oth').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_name_oth').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_name_oth').style.borderRightColor = "#769DC5";
			
		}
	}
		
	
	
	if(clin_prov==''){
			msgerr +=xspace+'Empty Province \n';
			     document.getElementById('clin_prov').style.backgroundColor = "#FF7171"; 
			  document.getElementById('clin_prov').style.border = "1px solid";
		  document.getElementById('clin_prov').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_prov').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_prov').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_prov').style.borderRightColor = "#769DC5";	
			
		} else {
			document.getElementById('clin_prov').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('clin_prov').style.border = "1px solid";
		  document.getElementById('clin_prov').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_prov').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_prov').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_prov').style.borderRightColor = "#769DC5";
			
		}
	
	if(clin_city==''){
			msgerr +=xspace+'Empty City \n';
			     document.getElementById('clin_city').style.backgroundColor = "#FF7171"; 
			  document.getElementById('clin_city').style.border = "1px solid";
		  document.getElementById('clin_city').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_city').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_city').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_city').style.borderRightColor = "#769DC5";	
	} else {
		document.getElementById('clin_city').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('clin_city').style.border = "1px solid";
		  document.getElementById('clin_city').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_city').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_city').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_city').style.borderRightColor = "#769DC5";
	}
	
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			 document.getElementById('tdbgclinic').bgColor = '#FF7171';
			return false;
		}
	
	
  	document.getElementById('tdclinic').innerHTML=reloaderimg();
	var url="inc_doc_clinic.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&clin_name='+clin_name+'&clin_bldg='+clin_bldg+'&clin_dept='+clin_dept+'&clin_room='+clin_room+'&clin_prov='+clin_prov+'&clin_city='+clin_city+'&clin_district='+clin_district+'&clin_st='+clin_st+'&clin_zip='+clin_zip+'&clin_phone='+clin_phone+'&clin_hmo='+clin_hmo+'&clin_assitant='+clin_assitant+'&clin_monf_am='+clin_monf_am+'&clin_mont_am='+clin_mont_am+'&clin_monf_pm='+clin_monf_pm+'&clin_mont_pm='+clin_mont_pm+'&clin_tuef_am='+clin_tuef_am+'&clin_tuet_am='+clin_tuet_am+'&clin_tuef_pm='+clin_tuef_pm+'&clin_tuet_pm='+clin_tuet_pm+'&clin_wenf_am='+clin_wenf_am+'&clin_went_am='+clin_went_am+'&clin_wenf_pm='+clin_wenf_pm+'&clin_went_pm='+clin_went_pm+'&clin_thuf_am='+clin_thuf_am+'&clin_thut_am='+clin_thut_am+'&clin_thuf_pm='+clin_thuf_pm+'&clin_thut_pm='+clin_thut_pm+'&clin_frif_am='+clin_frif_am+'&clin_frit_am='+clin_frit_am+'&clin_frif_pm='+clin_frif_pm+'&clin_frit_pm='+clin_frit_pm+'&clin_satf_am='+clin_satf_am+'&clin_satt_am='+clin_satt_am+'&clin_satf_pm='+clin_satf_pm+'&clin_satt_pm='+clin_satt_pm+'&clin_name_oth='+clin_name_oth+'&clin_trunk='+clin_trunk+'&clin_local='+clin_local+
'&clin_fax='+clin_fax+'&clin_position='+clin_position;	

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdclinic').innerHTML=xmlHttp.responseText;
		//location.replace('#clinicx_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_clinic\')', 1000);
	 } 
	}
	 document.getElementById('tdbgclinic').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
///===
function savedocclinicisd(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var clin_name		= encodeURIComponent(document.getElementById('clin_name').value);
	var clin_bldg		= encodeURIComponent(document.getElementById('clin_bldg').value);
	var clin_dept		= encodeURIComponent(document.getElementById('clin_dept').value);
	var clin_room		= encodeURIComponent(document.getElementById('clin_room').value);
	var clin_prov		= encodeURI(document.getElementById('clin_prov').value);
	var clin_city		= encodeURI(document.getElementById('clin_city').value);
	var clin_district	= encodeURI(document.getElementById('clin_district').value);
	var clin_st			= encodeURI(document.getElementById('clin_st').value);
	var clin_zip		= encodeURI(document.getElementById('clin_zip').value);
	var clin_phone		= encodeURI(document.getElementById('clin_phone').value);
	var clin_trunk		= encodeURI(document.getElementById('clin_trunk').value);
	var clin_local		= encodeURI(document.getElementById('clin_local').value);
	var clin_fax		= encodeURI(document.getElementById('clin_fax').value);
	var clin_position		= encodeURIComponent(document.getElementById('clin_position').value);
	var clin_seq		= encodeURI(document.getElementById('clin_seq').value);
	var clin_hmo		= encodeURIComponent(document.getElementById('clin_hmo').value);
	var clin_assitant	= encodeURIComponent(document.getElementById('clin_assitant').value);
	var clin_monf_am	= encodeURI(document.getElementById('clin_monf_am').value);
	var clin_mont_am	= encodeURI(document.getElementById('clin_mont_am').value);
	var clin_monf_pm	= encodeURI(document.getElementById('clin_monf_pm').value);
	var clin_mont_pm	= encodeURI(document.getElementById('clin_mont_pm').value);
	var clin_tuef_am	= encodeURI(document.getElementById('clin_tuef_am').value);
	var clin_tuet_am	= encodeURI(document.getElementById('clin_tuet_am').value);
	var clin_tuef_pm	= encodeURI(document.getElementById('clin_tuef_pm').value);
	var clin_tuet_pm	= encodeURI(document.getElementById('clin_tuet_pm').value);
	var clin_wenf_am	= encodeURI(document.getElementById('clin_wenf_am').value);
	var clin_went_am	= encodeURI(document.getElementById('clin_went_am').value);
	var clin_wenf_pm	= encodeURI(document.getElementById('clin_wenf_pm').value);
	var clin_went_pm	= encodeURI(document.getElementById('clin_went_pm').value);
	var clin_thuf_am	= encodeURI(document.getElementById('clin_thuf_am').value);
	var clin_thut_am	= encodeURI(document.getElementById('clin_thut_am').value);
	var clin_thuf_pm	= encodeURI(document.getElementById('clin_thuf_pm').value);
	var clin_thut_pm	= encodeURI(document.getElementById('clin_thut_pm').value);
	var clin_frif_am	= encodeURI(document.getElementById('clin_frif_am').value);
	var clin_frit_am	= encodeURI(document.getElementById('clin_frit_am').value);
	var clin_frif_pm	= encodeURI(document.getElementById('clin_frif_pm').value);
	var clin_frit_pm	= encodeURI(document.getElementById('clin_frit_pm').value);
	var clin_satf_am	= encodeURI(document.getElementById('clin_satf_am').value);
	var clin_satt_am	= encodeURI(document.getElementById('clin_satt_am').value);
	var clin_satf_pm	= encodeURI(document.getElementById('clin_satf_pm').value);
	var clin_satt_pm	= encodeURI(document.getElementById('clin_satt_pm').value);
	var clin_name_oth	= encodeURIComponent(document.getElementById('clin_name_oth').value);
    
	
	
	
	var msgerr = "";
	var xspace ='     ';
	
	if(clin_name==''){
			msgerr +=xspace+'Empty Clinic Name \n';
	        document.getElementById('clin_name').style.backgroundColor = "#FF7171"; 
			  document.getElementById('clin_name').style.border = "1px solid";
		  document.getElementById('clin_name').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_name').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_name').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_name').style.borderRightColor = "#769DC5";		
	} else {
		document.getElementById('clin_name').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('clin_name').style.border = "1px solid";
		  document.getElementById('clin_name').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_name').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_name').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_name').style.borderRightColor = "#769DC5";
	}
	
	if(clin_name=='others'){
		if (clin_name_oth=='') {
			msgerr +=xspace+'Empty Others-Clinic Name \n';
		    	        document.getElementById('clin_name_oth').style.backgroundColor = "#FF7171"; 
			  document.getElementById('clin_name_oth').style.border = "1px solid";
		  document.getElementById('clin_name_oth').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_name_oth').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_name_oth').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_name_oth').style.borderRightColor = "#769DC5";		

		} else {
					document.getElementById('clin_name_oth').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('clin_name_oth').style.border = "1px solid";
		  document.getElementById('clin_name_oth').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_name_oth').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_name_oth').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_name_oth').style.borderRightColor = "#769DC5";
			
		}
	}
		
	
	
	if(clin_prov==''){
			msgerr +=xspace+'Empty Province \n';
			     document.getElementById('clin_prov').style.backgroundColor = "#FF7171"; 
			  document.getElementById('clin_prov').style.border = "1px solid";
		  document.getElementById('clin_prov').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_prov').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_prov').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_prov').style.borderRightColor = "#769DC5";	
			
		} else {
			document.getElementById('clin_prov').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('clin_prov').style.border = "1px solid";
		  document.getElementById('clin_prov').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_prov').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_prov').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_prov').style.borderRightColor = "#769DC5";
			
		}
	
	if(clin_city==''){
			msgerr +=xspace+'Empty City \n';
			     document.getElementById('clin_city').style.backgroundColor = "#FF7171"; 
			  document.getElementById('clin_city').style.border = "1px solid";
		  document.getElementById('clin_city').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_city').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_city').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_city').style.borderRightColor = "#769DC5";	
	} else {
		document.getElementById('clin_city').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('clin_city').style.border = "1px solid";
		  document.getElementById('clin_city').style.borderBottomColor = "#769DC5";
		  document.getElementById('clin_city').style.borderTopColor = "#769DC5";
		   document.getElementById('clin_city').style.borderLeftColor = "#769DC5";
		   document.getElementById('clin_city').style.borderRightColor = "#769DC5";
	}
	
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			 document.getElementById('tdbgclinic').bgColor = '#FF7171';
			return false;
		}
	
	
  	document.getElementById('tdclinic').innerHTML=reloaderimg();
	var url="inc_doc_clinic.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&clin_name='+clin_name+'&clin_bldg='+clin_bldg+'&clin_dept='+clin_dept+'&clin_room='+clin_room+'&clin_prov='+clin_prov+'&clin_city='+clin_city+'&clin_district='+clin_district+'&clin_st='+clin_st+'&clin_zip='+clin_zip+'&clin_phone='+clin_phone+'&clin_hmo='+clin_hmo+'&clin_assitant='+clin_assitant+'&clin_monf_am='+clin_monf_am+'&clin_mont_am='+clin_mont_am+'&clin_monf_pm='+clin_monf_pm+'&clin_mont_pm='+clin_mont_pm+'&clin_tuef_am='+clin_tuef_am+'&clin_tuet_am='+clin_tuet_am+'&clin_tuef_pm='+clin_tuef_pm+'&clin_tuet_pm='+clin_tuet_pm+'&clin_wenf_am='+clin_wenf_am+'&clin_went_am='+clin_went_am+'&clin_wenf_pm='+clin_wenf_pm+'&clin_went_pm='+clin_went_pm+'&clin_thuf_am='+clin_thuf_am+'&clin_thut_am='+clin_thut_am+'&clin_thuf_pm='+clin_thuf_pm+'&clin_thut_pm='+clin_thut_pm+'&clin_frif_am='+clin_frif_am+'&clin_frit_am='+clin_frit_am+'&clin_frif_pm='+clin_frif_pm+'&clin_frit_pm='+clin_frit_pm+'&clin_satf_am='+clin_satf_am+'&clin_satt_am='+clin_satt_am+'&clin_satf_pm='+clin_satf_pm+'&clin_satt_pm='+clin_satt_pm+'&clin_name_oth='+clin_name_oth+'&clin_trunk='+clin_trunk+'&clin_local='+clin_local+
'&clin_fax='+clin_fax+'&clin_position='+clin_position+'&clin_seq='+clin_seq;	

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdclinic').innerHTML=xmlHttp.responseText;
		//location.replace('#clinicx_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_clinic\')', 1000);
	 } 
	}
	 document.getElementById('tdbgclinic').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


//end save clinic
//clinic
function gotoedit_practice(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return  
	}
	if (xsect!=4  ) {
	   document.getElementById('tdbgclinic').bgColor = '#FF7171';
	    
	} else {
	  document.getElementById('tdbgclinic').bgColor = '#BCEDEB';
	  
	}
    
  	document.getElementById('tdclinic').innerHTML=reloaderimg();
	var url="inc_doc_clinic.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdclinic').innerHTML=xmlHttp.responseText;
	//	location.replace('#clinicx_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	
}



function gotoedit_practicedel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return  
	}
	
	
 	if (confirm("Are you sure you want to delete?")) {
         	document.getElementById('tdclinic').innerHTML=reloaderimg();
	var url="inc_doc_clinic.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdclinic').innerHTML=xmlHttp.responseText;
		//location.replace('#clinicx_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

	}
	else {
    
	
	}
}
function gotoedit_practiceres(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return  
	}
	
	
 	if (confirm("Are you sure you want to restore?")) {
         	document.getElementById('tdclinic').innerHTML=reloaderimg();
	var url="inc_doc_clinic.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdclinic').innerHTML=xmlHttp.responseText;
		//location.replace('#clinicx_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

	}
	else {
    
	
	}
}


// end clinic
//////////////////////////////////////////////////////////////////////

//save membership
function savedocmem(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var loca		= encodeURIComponent(document.getElementById('loca').value);
	var posi		= encodeURIComponent(document.getElementById('posi').value);
	
	var msgerr = "";
	var xspace ='     ';
	if(loca==''){
			msgerr +=xspace+'Empty Institution \n';
			document.getElementById('loca').style.backgroundColor = "#FF7171"; 
			  document.getElementById('loca').style.border = "1px solid";
		  document.getElementById('loca').style.borderBottomColor = "#769DC5";
		  document.getElementById('loca').style.borderTopColor = "#769DC5";
		   document.getElementById('loca').style.borderLeftColor = "#769DC5";
		   document.getElementById('loca').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('loca').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('loca').style.border = "1px solid";
		  document.getElementById('loca').style.borderBottomColor = "#769DC5";
		  document.getElementById('loca').style.borderTopColor = "#769DC5";
		   document.getElementById('loca').style.borderLeftColor = "#769DC5";
		   document.getElementById('loca').style.borderRightColor = "#769DC5";
		}
	
		
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			 document.getElementById('tdbgmem').bgColor = '#FF7171';
			return false;
		}
	
	
  	document.getElementById('tdmem').innerHTML=reloaderimg();
	var url="inc_doc_membership.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&loca='+loca+'&posi='+posi;

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmem').innerHTML=xmlHttp.responseText;
		location.replace('#membership_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_mem\')', 1000);
	 } 
	}
	 document.getElementById('tdbgmem').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end save educational background
//membership




function gotoedit_mem(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (xsect!=4  ) {
	   document.getElementById('tdbgmem').bgColor = '#FF7171';
	    
	} else {
	  document.getElementById('tdbgmem').bgColor = '#BCEDEB';
	  
	}
  	document.getElementById('tdmem').innerHTML=reloaderimg();
	var url="inc_doc_membership.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmem').innerHTML=xmlHttp.responseText;
		location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function gotoedit_memdel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (confirm("Are you sure you want to delete?")) {
  	document.getElementById('tdmem').innerHTML=reloaderimg();
	var url="inc_doc_membership.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmem').innerHTML=xmlHttp.responseText;
		location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}
function gotoedit_memres(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (confirm("Are you sure you want to restore?")) {
  	document.getElementById('tdmem').innerHTML=reloaderimg();
	var url="inc_doc_membership.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdmem').innerHTML=xmlHttp.responseText;
		location.replace('#membership_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}

// end membership edit


//save educational background
function savedoceducb(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	


	var edub_level		= encodeURI(document.getElementById('edub_level').value);
	var edub_inst		= encodeURIComponent(document.getElementById('edub_inst').value);
	var edub_year		= encodeURI(document.getElementById('edub_year').value);
	var edub_program		= encodeURIComponent(document.getElementById('edub_program').value);
	var msgerr = "";
	var xspace ='     ';
	if(edub_inst==''){
			msgerr +=xspace+'Empty Institution \n';
			document.getElementById('edub_inst').style.backgroundColor = "#FF7171"; 
			  document.getElementById('edub_inst').style.border = "1px solid";
		  document.getElementById('edub_inst').style.borderBottomColor = "#769DC5";
		  document.getElementById('edub_inst').style.borderTopColor = "#769DC5";
		   document.getElementById('edub_inst').style.borderLeftColor = "#769DC5";
		   document.getElementById('edub_inst').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('edub_inst').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('edub_inst').style.border = "1px solid";
		  document.getElementById('edub_inst').style.borderBottomColor = "#769DC5";
		  document.getElementById('edub_inst').style.borderTopColor = "#769DC5";
		   document.getElementById('edub_inst').style.borderLeftColor = "#769DC5";
		   document.getElementById('edub_inst').style.borderRightColor = "#769DC5";
		}
	
	if(edub_program==''){
			msgerr +=xspace+'Empty Program \n';
			document.getElementById('edub_program').style.backgroundColor = "#FF7171"; 
			  document.getElementById('edub_program').style.border = "1px solid";
		  document.getElementById('edub_program').style.borderBottomColor = "#769DC5";
		  document.getElementById('edub_program').style.borderTopColor = "#769DC5";
		   document.getElementById('edub_program').style.borderLeftColor = "#769DC5";
		   document.getElementById('edub_program').style.borderRightColor = "#769DC5";	
		} else {
			 document.getElementById('edub_program').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('edub_program').style.border = "1px solid";
		  document.getElementById('edub_program').style.borderBottomColor = "#769DC5";
		  document.getElementById('edub_program').style.borderTopColor = "#769DC5";
		   document.getElementById('edub_program').style.borderLeftColor = "#769DC5";
		   document.getElementById('edub_program').style.borderRightColor = "#769DC5";
		}
	
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			 document.getElementById('tdbgeduc').bgColor = '#FF7171';
			return false;
		}
	
  	document.getElementById('tdeducback').innerHTML=reloaderimg();
	var url="inc_doc_edubackground.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&edub_level='+edub_level+'&edub_inst='+edub_inst+'&edub_year='+edub_year+'&edub_program='+edub_program;

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdeducback').innerHTML=xmlHttp.responseText;
		//location.replace('#educback_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_educb\')', 1000);
	 } 
	}
	  document.getElementById('tdbgeduc').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end save educational background
//educational background


function gotoedit_educb(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (xsect!=4  ) {
	   document.getElementById('tdbgeduc').bgColor = '#FF7171';
	    
	} else {
	  document.getElementById('tdbgeduc').bgColor = '#BCEDEB';
	  
	}
	document.getElementById('tdeducback').innerHTML=reloaderimg();
	var url="inc_doc_edubackground.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdeducback').innerHTML=xmlHttp.responseText;
		//location.replace('#educback_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function gotoedit_educbdel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (confirm("Are you sure you want to delete?")) {
  	document.getElementById('tdeducback').innerHTML=reloaderimg();
	var url="inc_doc_edubackground.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdeducback').innerHTML=xmlHttp.responseText;
		//location.replace('#educback_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}
function gotoedit_educbres(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	if (confirm("Are you sure you want to restore?")) {
  	document.getElementById('tdeducback').innerHTML=reloaderimg();
	var url="inc_doc_edubackground.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdeducback').innerHTML=xmlHttp.responseText;
		//location.replace('#educback_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}

// end educational background

//////////////////////////////////////////////////////////////////////


//save workacademe
function savedocworkaca(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var workaca_position		= encodeURIComponent(document.getElementById('workaca_position').value);
	var workaca_dept		= encodeURIComponent(document.getElementById('workaca_dept').value);
	var workaca_inst		= encodeURIComponent(document.getElementById('workaca_inst').value);
	
	var msgerr = "";
	var xspace ='     ';
	var err 			=  'error message.';
	
	if(workaca_inst==''){
			msgerr +=xspace+'Empty Location \n';
			document.getElementById('workaca_inst').style.backgroundColor = "#FF7171"; 
			 document.getElementById('workaca_inst').style.border = "1px solid";
		  document.getElementById('workaca_inst').style.borderBottomColor = "#769DC5";
		  document.getElementById('workaca_inst').style.borderTopColor = "#769DC5";
		   document.getElementById('workaca_inst').style.borderLeftColor = "#769DC5";
		   document.getElementById('workaca_inst').style.borderRightColor = "#769DC5";
	} else {
	  	  document.getElementById('workaca_inst').style.backgroundColor = "#FFFFFF"; 
		   document.getElementById('workaca_inst').style.border = "1px solid";
		  document.getElementById('workaca_inst').style.borderBottomColor = "#769DC5";
		  document.getElementById('workaca_inst').style.borderTopColor = "#769DC5";
		   document.getElementById('workaca_inst').style.borderLeftColor = "#769DC5";
		   document.getElementById('workaca_inst').style.borderRightColor = "#769DC5";
	}
	
	if(workaca_dept==''){
			msgerr +=xspace+'Empty Department \n';
			document.getElementById('workaca_dept').style.backgroundColor = "#FF7171"; 
			  document.getElementById('workaca_dept').style.border = "1px solid";
		  document.getElementById('workaca_dept').style.borderBottomColor = "#769DC5";
		  document.getElementById('workaca_dept').style.borderTopColor = "#769DC5";
		   document.getElementById('workaca_dept').style.borderLeftColor = "#769DC5";
		   document.getElementById('workaca_dept').style.borderRightColor = "#769DC5";
    } else {
	  	  document.getElementById('workaca_dept').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('workaca_dept').style.border = "1px solid";
		  document.getElementById('workaca_dept').style.borderBottomColor = "#769DC5";
		  document.getElementById('workaca_dept').style.borderTopColor = "#769DC5";
		   document.getElementById('workaca_dept').style.borderLeftColor = "#769DC5";
		   document.getElementById('workaca_dept').style.borderRightColor = "#769DC5";
		 
		  
		  
	}

	if(msgerr!=''){
			alert("Error:\n"+msgerr);
		///	 document.getElementById('tdbgwork').bgColor = '#FF7171';
			return false;
     }
  	
		
	document.getElementById('tdworkaca').innerHTML=reloaderimg();
	var url="inc_doc_workacademe.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&workaca_position='+workaca_position+'&workaca_dept='+workaca_dept+'&workaca_inst='+workaca_inst;
	

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdworkaca').innerHTML=xmlHttp.responseText;
	//	location.replace('#workaca_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_workaca\')', 1000);
	 } 
	}
	document.getElementById('tdbgwork').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end save workacademe
//workacademe
function gotoedit_workaca(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (xsect!=4  ) {
	   document.getElementById('tdbgwork').bgColor = '#FF7171';
	    
	} else {
	  document.getElementById('tdbgwork').bgColor = '#BCEDEB';
	  
	}
  	document.getElementById('tdworkaca').innerHTML=reloaderimg();
	var url="inc_doc_workacademe.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdworkaca').innerHTML=xmlHttp.responseText;
		//location.replace('#workaca_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function gotoedit_workacadel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  if (confirm("Are you sure you want to delete?")) {
  document.getElementById('tdworkaca').innerHTML=reloaderimg();
	var url="inc_doc_workacademe.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdworkaca').innerHTML=xmlHttp.responseText;
		//location.replace('#workaca_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
  }
}
function gotoedit_workacares(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  if (confirm("Are you sure you want to restore?")) {
  document.getElementById('tdworkaca').innerHTML=reloaderimg();
	var url="inc_doc_workacademe.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdworkaca').innerHTML=xmlHttp.responseText;
	//	location.replace('#workaca_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
  }
}

// end workacademe
///////////////////////////////////////////////
//save publish work
function savedocpubw(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var pubwork_cat		= encodeURIComponent(document.getElementById('pubwork_cat').value);
	var pubwork_date		= encodeURI(document.getElementById('pubwork_date').value);
	var pubwork_journal		= encodeURIComponent(document.getElementById('pubwork_journal').value);
	var pubwork_title		= encodeURIComponent(document.getElementById('pubwork_title').value);
	
  	var msgerr = "";
	var xspace ='     ';
	if(pubwork_title==''){
			msgerr +=xspace+'Empty Title \n';
			document.getElementById('pubwork_title').style.backgroundColor = "#FF7171"; 
			  document.getElementById('pubwork_title').style.border = "1px solid";
		  document.getElementById('pubwork_title').style.borderBottomColor = "#769DC5";
		  document.getElementById('pubwork_title').style.borderTopColor = "#769DC5";
		   document.getElementById('pubwork_title').style.borderLeftColor = "#769DC5";
		   document.getElementById('pubwork_title').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('pubwork_title').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('pubwork_title').style.border = "1px solid";
		  document.getElementById('pubwork_title').style.borderBottomColor = "#769DC5";
		  document.getElementById('pubwork_title').style.borderTopColor = "#769DC5";
		   document.getElementById('pubwork_title').style.borderLeftColor = "#769DC5";
		   document.getElementById('pubwork_title').style.borderRightColor = "#769DC5";
		}
	if(pubwork_journal==''){
			msgerr +=xspace+'Empty Journal \n';
			document.getElementById('pubwork_journal').style.backgroundColor = "#FF7171"; 
			  document.getElementById('pubwork_journal').style.border = "1px solid";
		  document.getElementById('pubwork_journal').style.borderBottomColor = "#769DC5";
		  document.getElementById('pubwork_journal').style.borderTopColor = "#769DC5";
		   document.getElementById('pubwork_journal').style.borderLeftColor = "#769DC5";
		   document.getElementById('pubwork_journal').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('pubwork_journal').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('pubwork_journal').style.border = "1px solid";
		  document.getElementById('pubwork_journal').style.borderBottomColor = "#769DC5";
		  document.getElementById('pubwork_journal').style.borderTopColor = "#769DC5";
		   document.getElementById('pubwork_journal').style.borderLeftColor = "#769DC5";
		   document.getElementById('pubwork_journal').style.borderRightColor = "#769DC5";
		}	
	
		
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			 document.getElementById('tdbgpubw').bgColor = '#FF7171';
			return false;
		}

	
	document.getElementById('tdpubw').innerHTML=reloaderimg();
	var url="inc_doc_publishwork.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&pubwork_cat='+pubwork_cat+'&pubwork_date='+pubwork_date+'&pubwork_journal='+pubwork_journal+'&pubwork_title='+pubwork_title;

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdpubw').innerHTML=xmlHttp.responseText;
	//	location.replace('#pubw_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_pubw\')', 1000);
	 } 
	}
	document.getElementById('tdbgpubw').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end save publish work
//publish work
function gotoedit_pubw(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (xsect!=4  ) {
	   document.getElementById('tdbgpubw').bgColor = '#FF7171';
	    
	} else {
	  document.getElementById('tdbgpubw').bgColor = '#BCEDEB';
	  
	}
  	document.getElementById('tdpubw').innerHTML=reloaderimg();
	var url="inc_doc_publishwork.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdpubw').innerHTML=xmlHttp.responseText;
		//location.replace('#pubw_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function gotoedit_pubwdel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (confirm("Are you sure you want to delete?")) {
  	document.getElementById('tdpubw').innerHTML=reloaderimg();
	var url="inc_doc_publishwork.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdpubw').innerHTML=xmlHttp.responseText;
	//	location.replace('#pubw_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}
function gotoedit_pubwres(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (confirm("Are you sure you want to restore?")) {
  	document.getElementById('tdpubw').innerHTML=reloaderimg();
	var url="inc_doc_publishwork.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdpubw').innerHTML=xmlHttp.responseText;
		//location.replace('#pubw_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}
// end publish work
//save lecture
function savedoclecdel(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var lecdel_title		= encodeURIComponent(document.getElementById('lecdel_title').value);
	var lecdel_journal		= encodeURIComponent(document.getElementById('lecdel_journal').value);
	var lecdel_date		= encodeURI(document.getElementById('lecdel_date').value);
	
  	var msgerr = "";
	var xspace ='     ';
	if(lecdel_title==''){
			msgerr +=xspace+'Empty Title \n';
			document.getElementById('lecdel_title').style.backgroundColor = "#FF7171"; 
			  document.getElementById('lecdel_title').style.border = "1px solid";
		  document.getElementById('lecdel_title').style.borderBottomColor = "#769DC5";
		  document.getElementById('lecdel_title').style.borderTopColor = "#769DC5";
		   document.getElementById('lecdel_title').style.borderLeftColor = "#769DC5";
		   document.getElementById('lecdel_title').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('lecdel_title').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('lecdel_title').style.border = "1px solid";
		  document.getElementById('lecdel_title').style.borderBottomColor = "#769DC5";
		  document.getElementById('lecdel_title').style.borderTopColor = "#769DC5";
		   document.getElementById('lecdel_title').style.borderLeftColor = "#769DC5";
		   document.getElementById('lecdel_title').style.borderRightColor = "#769DC5";
		}
	if(lecdel_journal==''){
			msgerr +=xspace+'Empty Event \n';
			document.getElementById('lecdel_journal').style.backgroundColor = "#FF7171"; 
			  document.getElementById('lecdel_journal').style.border = "1px solid";
		  document.getElementById('lecdel_journal').style.borderBottomColor = "#769DC5";
		  document.getElementById('lecdel_journal').style.borderTopColor = "#769DC5";
		   document.getElementById('lecdel_journal').style.borderLeftColor = "#769DC5";
		   document.getElementById('lecdel_journal').style.borderRightColor = "#769DC5";	
		} else { 
		   document.getElementById('lecdel_journal').style.backgroundColor = "#FFFFFF"; 
		  document.getElementById('lecdel_journal').style.border = "1px solid";
		  document.getElementById('lecdel_journal').style.borderBottomColor = "#769DC5";
		  document.getElementById('lecdel_journal').style.borderTopColor = "#769DC5";
		   document.getElementById('lecdel_journal').style.borderLeftColor = "#769DC5";
		   document.getElementById('lecdel_journal').style.borderRightColor = "#769DC5";
		}	
	
		
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			 document.getElementById('tdbglecdel').bgColor = '#FF7171';
			return false;
		}

	
	document.getElementById('tdlecdel').innerHTML=reloaderimg();
	var url="inc_doc_lecture.php?act=1&xsect=4&itemid="+itemidx;
	url=url+'&lecdel_title='+lecdel_title+'&lecdel_journal='+lecdel_journal+'&lecdel_date='+lecdel_date;

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdlecdel').innerHTML=xmlHttp.responseText;
		//location.replace('#lecdel_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_lecdel\')', 1000);
	 } 
	}
	document.getElementById('tdbglecdel').bgColor = '#BCEDEB';
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end save lecture
//publish lecture
function gotoedit_lecdel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (xsect!=4  ) {
	   document.getElementById('tdbglecdel').bgColor = '#FF7171';
	    
	} else {
	  document.getElementById('tdbglecdel').bgColor = '#BCEDEB';
	  
	}
  	document.getElementById('tdlecdel').innerHTML=reloaderimg();
	var url="inc_doc_lecture.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdlecdel').innerHTML=xmlHttp.responseText;
	//	location.replace('#lecdel_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function gotoedit_lecdeldel(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (confirm("Are you sure you want to delete?")) {
  	document.getElementById('tdlecdel').innerHTML=reloaderimg();
	var url="inc_doc_lecture.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdlecdel').innerHTML=xmlHttp.responseText;
		//location.replace('#lecdel_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}
function gotoedit_lecdelres(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if (confirm("Are you sure you want to restore?")) {
  	document.getElementById('tdlecdel').innerHTML=reloaderimg();
	var url="inc_doc_lecture.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdlecdel').innerHTML=xmlHttp.responseText;
	//	location.replace('#lecdel_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}

//end lecture
//////////////////////////////////////////////////////////////////////
//save area expertise
function savedocareaex(itemidx){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	var areaex_name = encodeURI(document.getElementById('areaex_name').value);
	var areaex_pub = encodeURI(document.getElementById('areaex_pub').value);
	
  	document.getElementById('tdareaex').innerHTML=reloaderimg();
	var url="inc_doc_expertise.php?act=1&xsect=3&itemid="+itemidx;
	url=url+'&areaex_name='+areaex_name+'&areaex_pub='+areaex_pub;

	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdareaex').innerHTML=xmlHttp.responseText;
		location.replace('#tdareaex_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_areaex\')', 1000);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end save area expertise
//area expertise
function gotoedit_areaex(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  	document.getElementById('tdareaex').innerHTML=reloaderimg();
	var url="inc_doc_expertise.php?act=2&xsect="+xsect+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdareaex').innerHTML=xmlHttp.responseText;
		location.replace('#tdareaex_l');
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end area expertise
//////////////////////////////////////////////////////////////////////
//save patient profile
function savepatientprof(){
	 var dtCh= "/";
 var minYear=1900;
 var maxYear=2100;
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
	//var prof_username	= encodeURI(document.getElementById('prof_username').value);
	var bdate	= escape(document.getElementById('bdate').value);
	var bdatechk	= document.getElementById('bdate');
	var prof_gender	= escape(document.getElementById('prof_gender').value);
	var prof_status	= escape(document.getElementById('prof_status').value);
	var prof_nationality	= escape(document.getElementById('prof_nationality').value);
	var prof_email	= encodeURI(document.getElementById('prof_email').value);
	var prof_password	= encodeURI(document.getElementById('prof_password').value);
	var prof_cpassword	= encodeURI(document.getElementById('prof_cpassword').value);
	var prof_fname	= encodeURI(document.getElementById('prof_fname').value);
	var prof_lname	= encodeURI(document.getElementById('prof_lname').value);
	var prof_phone	= encodeURI(document.getElementById('prof_phone').value);
	var prof_fax	= encodeURI(document.getElementById('prof_fax').value);
	var prof_prov	= encodeURI(document.getElementById('prof_prov').value);
	var prof_city	= encodeURI(document.getElementById('prof_city').value);
	var prof_barangay	= encodeURI(document.getElementById('prof_barangay').value);
	var prof_street	= encodeURI(document.getElementById('prof_street').value);
	var prof_zip	= encodeURI(document.getElementById('prof_zip').value);
	
	  var idregister = encodeURI(document.getElementById('idregister').value);
	 var phypertensivez = encodeURI(document.getElementById('phypertensivez').value);
	var pdrinkerz = encodeURI(document.getElementById('pdrinkerz').value);
	var pdrinkerctrz = encodeURI(document.getElementById('pdrinkerctrz').value);
	var psmokerz = encodeURI(document.getElementById('psmokerz').value);
	var psmokerctrz = encodeURI(document.getElementById('psmokerctrz').value);
	var pdiabeticz = encodeURI(document.getElementById('pdiabeticz').value);
	var pallergiesz = encodeURI(document.getElementById('pallergiesz').value);
	//var prof_gen	= encodeURI(document.getElementById('prof_gen').value);
	
	var msgerr = "";
	var xspace ='     ';
	if(prof_fname==''){
	     alert("Empty First Name.");
		prof_fname.focus();
		return false;
	}
	if(prof_lname==''){
	     alert("Empty Last Name.");
		prof_lname.focus();
		return false;
	}
	
	var errval=false;
	if(bdate.value==""){
		bdate.className ="errorfield";
		errval = true;
	}else{
		bdate.className ="okfield"; 		
	}
	if (datecheck(bdatechk.value)==false){
		bdate.focus();
		errval = true;
	}

   if(errval==true){
	//document.getElementById('msg').style.display = 'block';
	//document.getElementById('msg').innerHTML = err;
	return false;
  }
	
	
		if(prof_email==''){
			msgerr +=xspace+'Empty Email \n';
		}
	
	   if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('prof_email').value)) {
	} else {	
		alert("Invalid email address! Please re-enter.");
		prof_email.focus();
		return false;
	}
		if(prof_password!=prof_cpassword){
			msgerr +=xspace+'Password do not match \n';
		}/*
		if (datemsg!=true){
			msgerr +=xspace+datemsg+' \n';
		}*/
		
		if(msgerr!=''){
			alert("Error:\n"+msgerr);
			return false;
		}
		
		 
	
  	document.getElementById('patient_prof').innerHTML=reloaderimg();
	var url="inc_patient_profile.php?act=1";
	
	url=url+'&prof_email='+prof_email+'&prof_password='+prof_password+'&prof_cpassword='+prof_cpassword+'&prof_fname='+prof_fname+'&prof_lname='+prof_lname+'&prof_phone='+prof_phone+'&prof_fax='+prof_fax+'&prof_prov='+prof_prov+'&prof_city='+prof_city+'&prof_barangay='+prof_barangay+'&prof_street='+prof_street+'&prof_zip='+prof_zip+'&bdate='+bdate+'&prof_gender='+prof_gender+'&prof_status='+prof_status+'&prof_nationality='+prof_nationality+'&phypertensivez='+phypertensivez+'&pdrinkerz='+pdrinkerz+'&pdiabeticz='+pdiabeticz+
	'&pdrinkerctrz='+pdrinkerctrz+'&psmokerz='+psmokerz+'&psmokerctrz='+psmokerctrz+'&pallergiesz='+pallergiesz;
//
//url=url+'&prof_username='+prof_username+'&prof_email='+prof_email+'&prof_password='+prof_password+'&prof_cpassword='+prof_cpassword+'&prof_fname='+prof_fname+'&prof_lname='+prof_lname+'&prof_phone='+prof_phone+'&prof_fax='+prof_fax+'&prof_prov='+prof_prov+'&prof_city='+prof_city+'&prof_barangay='+prof_barangay+'&prof_street='+prof_street+'&prof_zip='+prof_zip+'&prof_gen='+prof_gen;
//
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('patient_prof').innerHTML=xmlHttp.responseText;
		location.replace('#perinfo_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_pprof\')', 1000);
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
//end save patient profile

function datecheck(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		alert("Please enter a valid date")
		return false
	}
return true
}


function savephealthreg(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
  
	//var bdate1 = encodeURI(document.getElementById('bdate1').value);
	var month= document.getElementById('month').value;
	var day= document.getElementById('day').value;
	var year= encodeURI(document.getElementById('year').value);
	var xdt=day+"/"+month+"/"+year;

	var phypertensive = encodeURI(document.getElementById('phypertensive').value);
	var pdrinker = encodeURI(document.getElementById('pdrinker').value);
	var pdrinkerctr = encodeURI(document.getElementById('pdrinkerctr').value);
	var psmoker = encodeURI(document.getElementById('psmoker').value);
	var psmokerctr = encodeURI(document.getElementById('psmokerctr').value);
	var pdiabetic = encodeURI(document.getElementById('pdiabetic').value);
	var pallergies = encodeURI(document.getElementById('pallergies').value);

	var msgerr = "";
	var xspace ='     ';
	var	datemsg = isDatechk(xdt);
	if (datemsg!=true){
		msgerr +=xspace+datemsg+' \n';
		
	}
	
	if(msgerr!=''){
			alert("Error:\n"+msgerr);
			return false;
		}
	
	document.getElementById('tdheathr').innerHTML=reloaderimg();
	var url="inc_patient_healthr.php?act=1&xsect=3";
	url=url+'&phypertensive='+phypertensive+'&pdrinker='+pdrinker+'&pdiabetic='+pdiabetic+
	'&pdrinkerctr='+pdrinkerctr+'&psmoker='+psmoker+'&psmokerctr='+psmokerctr+'&pallergies='+pallergies+
	'&year='+year+'&month='+month+'&day='+day;
	
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace('#perhealth');
		document.getElementById('tbl2').style.display = 'none';
		document.getElementById('tbl3').style.display = 'block';
		setInterval('hidexmsgtimer(\'ajaxmsg_phealth\')', 1000);
	 } 
	}
	
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function savephealthreg1(){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
  
	var bdate1 = encodeURI(document.getElementById('bdate1').value);
//	var phypertensive = encodeURI(document.getElementById('phypertensive').value);
//	var pdrinker = encodeURI(document.getElementById('pdrinker').value);
//	var pdrinkerctr = encodeURI(document.getElementById('pdrinkerctr').value);
//	var psmoker = encodeURI(document.getElementById('psmoker').value);
//	var psmokerctr = encodeURI(document.getElementById('psmokerctr').value);
//	var pallergies = encodeURI(document.getElementById('pallergies').value);
//	document.getElementById('tdheathr').innerHTML=reloaderimg();
//	var url="inc_patient_healthr.php?act=1&xsect=3";
//	url=url+'&bdate1='+bdate1+'&phypertensive='+phypertensive+'&pdrinker='+pdrinker+'&pdrinkerctr='+pdrinkerctr+'&psmoker='+psmoker+'&psmokerctr='+psmokerctr+'&pallergies='+pallergies;
	alert(""+phypertensive);
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace('#tdheathr_l');
		setInterval('hidexmsgtimer(\'ajaxmsg_phealth\')', 1000);
	 } 
	}
	
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


//end save patient health
//area patient health

function drinkcbo() {
	var pdrinker = encodeURI(document.getElementById('pdrinker').value);
	if (pdrinker==1) {
		document.getElementById('tbledriker').style.display = 'block';
	} else {
  	    document.getElementById('tbledriker').style.display = 'none';
	
	}
}

function drinkcboprof() {
	var pdrinkerz = encodeURI(document.getElementById('pdrinkerz').value);
	if (pdrinkerz==1) {
		document.getElementById('tbledrikerz').style.display = 'block';
	} else {
  	    document.getElementById('tbledrikerz').style.display = 'none';
		
	}
}

function smokercbo() {
	var psmoker = encodeURI(document.getElementById('psmoker').value);
	if (psmoker==1) {
		document.getElementById('tblesmoke').style.display = 'block';
	} else {
  	    document.getElementById('tblesmoke').style.display = 'none';
   	    
	}
}

function smokercboprof() {
	var psmokerz = encodeURI(document.getElementById('psmokerz').value);
	if (psmokerz==1) {
		document.getElementById('tblesmokez').style.display = 'block';
	} else {
  	    document.getElementById('tblesmokez').style.display = 'none';
   
	}
}


function gotodel_phealth(xsect, itemid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
  if (confirm("Are you sure you want to delete?")) {
	
	document.getElementById('tdheathr').innerHTML=reloaderimg();
	var url="inc_patient_healthr.php?dva=5&act=1&xsect=7&itemid="+itemid+'&itemid='+itemid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('tdheathr').innerHTML=xmlHttp.responseText;
		location.replace('#perhealth');
	 } 
	}
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


//end patient health
function showhide(divid,url,act,onpage, aoption) {
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if(document.getElementById(divid).style.display == "none") {
       document.getElementById(divid).style.display = "block";
	   document.getElementById(divid).innerHTML=reloaderimgrotate();
		//var url= escape(url)+'?act='+escape(act)+'&onpage='+onpage+'&option='+escape(aoption);
		var url= escape(url)+'?act='+act+'&onpage='+onpage+'&option='+escape(aoption);
		xmlHttp.onreadystatechange=function () {
		if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
			document.getElementById(divid).innerHTML=xmlHttp.responseText;
		 } 
		}
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}
	 else {
	 	document.getElementById(divid).style.display = "none";
	 	//alert("hhh");
	 } 
}

function showhideonly(divid,url,act,onpage, aoption) {
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	if(document.getElementById(divid).style.display == "none") {
       document.getElementById(divid).style.display = "block";
	   //document.getElementById(divid).innerHTML=reloaderimgrotate();
		//var url= escape(url)+'?act='+escape(act)+'&onpage='+onpage+'&option='+escape(aoption);
		//var url= escape(url)+'?act='+act+'&onpage='+onpage+'&option='+escape(aoption);
		//xmlHttp.onreadystatechange=function () {
		//if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		//	document.getElementById(divid).innerHTML=xmlHttp.responseText;
		// } 
		//}
		//xmlHttp.open("GET",url,true)
		//xmlHttp.send(null)
	}
	 else {
	 	document.getElementById(divid).style.display = "none";
	 	//alert("hhh");
	 } 
}

function show(divid,url,act,onpage, aoption) {
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	
       document.getElementById(divid).style.display = "block";
	   document.getElementById(divid).innerHTML=reloaderimgrotate();
		//var url= escape(url)+'?act='+escape(act)+'&onpage='+onpage+'&option='+escape(aoption);
		var url= escape(url)+'?act='+act+'&onpage='+onpage+'&option='+escape(aoption);
		xmlHttp.onreadystatechange=function () {
		if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
			document.getElementById(divid).innerHTML=xmlHttp.responseText;
		 } 
		}
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	 
}


//////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////doctor schedule///////////////////////////
////////////////////////////////////////////////doctor schedule///////////////////////////
function getdocsched(locationx, docid){
	var xmlHttp=null;
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
	 alert ("Browser does not support HTTP Request")
	 return
	}
	document.getElementById('docsched').style.display = 'block';
  	document.getElementById('docsched').innerHTML=reloaderimg();
	var url="inc_docavail_schedule.php?location="+locationx+'&docid='+docid;
	xmlHttp.onreadystatechange=function () {
	if (xmlHttp.readyState == 4 || xmlHttp.readyState=="complete"){
		document.getElementById('docsched').innerHTML=xmlHttp.responseText;
	 } 
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
////////////////////////////////////////////////end doctor schedule///////////////////////////
////////////////////////////////////////////////end doctor schedule///////////////////////////

function GetXmlHttpObjectm()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}	


function GetXmlHttpObject(){
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
/*Product:   AutoCAD 2008 
Serial number:   653-12354321 
Request code:   ZFSR H63W 384R Y2P3 T3AC AZH5 CC24 
*/
