function getstate(icountry,selected)
{
	$.post('/class/ajaxselect.php', { selected: selected, mod: 'getStateList',parent:icountry } ,function(data)
	{
		var mdlhtml="<select name='iState' id='iState' class='enq_content' style='width:205px;' tabindex='7'>"+data+"</select>";
		$('#div_state').html(mdlhtml);
	},"html");
}
function getDoctors(vals)
{
$('#doctors').html('');

$.post('ajaxfiles/ajaxactions.php',{ param:vals ,mode: 'doctors'},function(data)
		{
			if(data.length >0) 
			{
			
			var mdlhtml=data;
			$('#doctors').html(mdlhtml);
			}
			else
			{
				$('#doctors').html('');
			}
		},"html");
		
}

function remove(ids)
{
	$('#tr'+ids).remove();
}

function clearprv()
{
	
	doct=$('#iDoctorID').val();
	
	if(doct!=0 && doct!='')
	{
	
	GetTimeTable(doct);
	
	}
}
function onlineapp()
{
	
	if($('#iClinicID').val()!=0 && $('#iClinicID').val() !=0)
	{
		clid=$('#iClinicID').val();
		window.self.location='online_appointment.php?cid='+clid;
	}
	else
	{
		alert('Please select your Clinic');
		return false;
	}
	
}

function submit(cid,did)
{
	
	
	var sun;
	var mon;
	var tue;
	var wed;
	var thu;
	var fri;
	var sat;

	
	if ($('#sSunday').attr('checked')) { sun=1;  }else{ sun=0; }
	if ($('#sMonday').attr('checked')) { mon=1;  }else{ mon=0; }
	if ($('#sTuesday').attr('checked')) { tue=1;  }else{ tue=0; }
	if ($('#sWednesday').attr('checked')) { wed=1;  }else{ wed=0; }
	if ($('#sThursday').attr('checked')) { thu=1;  }else{ thu=0; }
	if ($('#sFriday').attr('checked')) { fri=1;  }else{ fri=0; }
	if ($('#sSaturday').attr('checked')) { sat=1;  }else{ sat=0; }
	
	
	
$.post('ajaxfiles/ajaxactions.php',{ 
	sun:sun,
	mon:mon,
	tue:tue,
	wed:wed,
	thu:thu,
	fri:fri,
	sat:sat,
	cid:cid,
	did:did,
	mode: 'adddays'},function(data)
		{
			if(data.length >0) 
			{
			jQuery(document).trigger('close.facebox');
			alert($.trim(data));
		
			}
			getDoctors(cid);
			
		},"html");
		
	
}




function getDoctforUser(sel)
{
	
		$('#rdo').removeClass('required');
	dept=$('#iDepartment').val();
		
	$('#timeTable').html('');
	$('#doctors').html('');
$('#rad').html('');
	
	clid=$('#iClinicID').val();

	$.post('admin/appointment/visittimeandday/ajaxfiles/ajaxactions.php',{clid:clid, doctid:sel, dept:dept,mode: 'DoctforUser'},function(data)
		{
			if(data.length >0) 
			{
		
			var mdlhtml="<select name='iDoctorID' id='iDoctorID' style='width:205px;' class='sel_content2' onchange='GetTimeTable(this.value);'>"+$.trim(data)+"</select>";
			
			$('#doctors').html(mdlhtml);
		
			}
	
			
		},"html");
	
	
}


function getclinDept(sel)
{
	$('#rdo').removeClass('required');
vals=$('#iClinicID').val();
	
$('#depart').html('');
$('#timeTable').html('');
$('#doctors').html('');
$('#rad').html('');
$.post('admin/appointment/clinicdoctors/ajaxfiles/ajaxactions.php',{ param:vals ,sel:sel, mode: 'departmentforonline'},function(data)
		{
		
			if(data.length >0) 
			{
			
			var mdlhtml="<select name='iDepartment' id='iDepartment' style='width:205px;' class='sel_content2' onchange='getDoctforUser(this.value);' >"+$.trim(data)+"</select>";
			
			$('#depart').html(mdlhtml);
		
			}
		},"html");
		
}

function GetTimeTable(doct)
{

	$('#timeTable').html('');
	$('#rdo').removeClass('required');
$('#rad').html('');


	var cdate	= $('#dDate').val();
	var iclinc	= $('#iClinicID').val();

	if(cdate=='')
	{
		alert('Please select Date');
		$('#iDoctorID').val(0);
		return false;
	}
	else
	{
	if(doct>0)
	{
$.post('admin/appointment/visittimeandday/ajaxfiles/ajaxactions.php',{ doct : doct, cdate : cdate, iclinc : iclinc , mode: 'GetTimeTable'},function(data)
		{
		
			if(data.length >0) 
			{
			$('#rad').html('<input type="hidden" id="rdo" class=""   name="rdo" value=""/>');
			
			$('#rdo').addClass('required');

			$('#timeTable').html(data);
			
		
			}
		},"html");
	}
	}
}


function getradiockd()
{
	$('#rdo').val(1);
}


