// JavaScript Document
function addFav(url)
{
	var r=confirm("Are you sure, do you want to add this case as favourite case");
	if(r==true){
		document.location.href=url;
	}
}


function favJS(){
	
	alert("This case has been added as your favourite case!");
}

function fav_exist(){
	alert("Already exist as favourite case!");
}

function gotoURL(usrId)
{
	document.location.href='view_doctor.php?did='+usrId;
}

function gotoStudentURL(usrId)
{
	document.location.href='view_student.php?u_id='+usrId;
}
function gotoInboxURL(msgId)
{
	document.location.href='view_message.php?msg_id='+msgId;
}
function gotoUsersURL(usrId)
{
	document.location.href='view_users.php?uid='+usrId;
}

var row,tot;
function add_row(){
	var cnt = document.getElementById("imgCount");
	var img = cnt.value; img = Number(img);
	
	var nd = document.createElement("div");
	nd.setAttribute("id", "opt_dd_"+img);
	if(img<9)
	{
		nd.innerHTML ='<table border="0" class="text" ><tr><td style="padding-left:9px;display:inline;">&nbsp;Image '+img+':&nbsp;<input type="file" name="opt_file[]" />&nbsp;</td><td align="left"><a href="javascript:remove_row('+img+');" >Remove</a></td></tr><tr ><td colspan="2" >Description&nbsp;:&nbsp;<textarea name="imgdes[]" cols="65" /></textarea></td></tr></table>';
		cnt.value = img + 1;
		var out = document.getElementById("opt_dd_more");
		out.appendChild(nd);
	}
	else
		alert('You have reached the maximum limit');
	
}
function remove_row(i){
		var outs = document.getElementById("opt_dd_"+i);
		var cnt = document.getElementById("imgCount");
		var parent = document.getElementById("opt_dd_more");
		var val = cnt.value; 
		cnt.value  = Number(val) -1;
		parent.removeChild(outs);	
}
function add_dcm(){
	var cnt = document.getElementById("dcmCount");
	var img = cnt.value; img = Number(img);
	var nd = document.createElement("div");
	nd.setAttribute("id", "opt_dcm_"+img);
	if(img<9)
	{
		nd.innerHTML ='<table class="text" ><tr><td style="padding-left:9px";>&nbsp;DCM Image '+img+':</td><td  width="150px"><input type="file" name="dyc_image[]" /></td><td>&nbsp;|&nbsp;<a href="javascript:remove_dcm('+img+');" >Remove</a></td><td></td><td></td></tr></table>';
		cnt.value = img + 1;
		var out = document.getElementById("opt_dcm_more");
		out.appendChild(nd);
	}
	else
		alert('You have reached the maximum limit');
	
}
function remove_dcm(i){
		var outs = document.getElementById("opt_dcm_"+i);
		var cnt = document.getElementById("dcmCount");
		var parent = document.getElementById("opt_dcm_more");
		var val = cnt.value; 
		cnt.value  = Number(val) -1;
		parent.removeChild(outs);	
}	

function checkPathology(val)
{
	var ptyp = document.getElementById('pother');
	if(val==18)
		ptyp.style.display='inline';
	else
		ptyp.style.display='none';
}

