



function presetqol(num)
{
	for(var i=1;i<=num;i++)
	{
		for(var j=0;j<eval("document.qform.q"+i+".length");j++)
		{
			eval("document.qform.q"+i+"["+j+"].checked=true");
			break;
		}	  
	}
}

function rollover()
{
	if(!document.getElementById || !document.createTextNode){return;}
	var n=document.getElementById('nav');
	if(!n){return;}
	var lis=n.getElementsByTagName('li');
	for (var i=0;i<lis.length;i++)
	{
		lis[i].onmouseover=function()
		{
			this.className=this.className?'cur':'over';
		}
		lis[i].onmouseout=function()
		{
			this.className=this.className=='cur'?'cur':'';
		}
	}
}
window.onload=rollover;


function specialformat(str)
{
	return str.replace(/[^a-zA-Z 0-9~!()<>,.?;:{}'"]+/g,'');
}

function URLencode(sStr) {
    return escape(sStr).replace(/\+/g, '%2B').replace(/\"/g,'%22').replace(/\'/g, '%27');
  }


function OpenAdvancedFeatureInstructions()
{
 var windowprops = "toolbar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes,menubar=no, width=610, height=550,top=0,left=0";
 window.open("advancedinstructions.asp", "advancedinstructions", windowprops); 
}

function OpenVoteHelp()
{
 var scr_w = screen.availWidth/2-300;
 var scr_h = screen.availHeight/2-235;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=600, height=470,top="+scr_h+",left="+scr_w;
 window.open("votehelp.html", "votehelp", windowprops); 

}


function OpenFreeMyTherapyRegistration(nickname)
{
 var windowprops = "toolbar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes,menubar=no, width=610, height=550,top=0,left=0";
 window.open("http://www.mytherapy.com/member/communityaccount.asp?nickname="+nickname, "freeregistration", windowprops); 
}

function ChangeOrder(url, selector)
{
	if(selector.options[selector.selectedIndex].value == "ON")
		url = url + "&co=on";
	else
		url = url + "&co=off";
	location = url;	
}

function Answer(TopicID, ReplyID)
{
 var bValChecked = -1;
 for(var i=0;i<document.all("answer"+TopicID+"_"+ReplyID).length;i++) {
   if(document.all("answer"+TopicID+"_"+ReplyID)[i].checked) {
	bValChecked = document.all("answer"+TopicID+"_"+ReplyID)[i].value;
	break;
   }
 }
 if(bValChecked < 0) {
  alert("Please select an answer.");
  return;
 }
 

var scr_w = screen.availWidth/2-100;
var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("answer.asp?tid="+TopicID+"&rid="+ReplyID+"&v="+bValChecked, "answer"+TopicID+"_"+ReplyID, windowprops); 
 

}


function ResetVotes(TopicID, ReplyID)
{
 var scr_w = screen.availWidth/2 - 250;
 var scr_h = screen.availHeight/2 - 200;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=500, height=400,top="+scr_h+",left="+scr_w;
 window.open("resetanswers.asp?tid="+TopicID+"&rid="+ReplyID, "reset"+TopicID+"_"+ReplyID, windowprops); 
 

}



function SetupQuestion(TopicID, ReplyID)
{
var scr_w = screen.availWidth/2-100;
var scr_h = screen.availHeight/2-100;


 var explanation = URLencode(document.all("setupquestion_explanation"+TopicID+"_"+ReplyID).value);
 var correct_name = URLencode(document.all("correct_name"+TopicID+"_"+ReplyID).value);
 var correct_url = URLencode(document.all("correct_url"+TopicID+"_"+ReplyID).value);
 var incorrect_name = URLencode(document.all("incorrect_name"+TopicID+"_"+ReplyID).value);
 var incorrect_url = URLencode(document.all("incorrect_url"+TopicID+"_"+ReplyID).value);

 var yesnounsuredropdown = document.all("setupquestion_yesnounsure" + TopicID+"_"+ReplyID);
 var dropdown = document.all("setupquestion"+TopicID+"_"+ReplyID);
 var correctdropdown = document.all("setupquestion_correct"+TopicID+"_"+ReplyID);

 var num_answers = dropdown.options[dropdown.selectedIndex].value;
 var correct_answer = correctdropdown.options[correctdropdown.selectedIndex].value;
 var question_type = yesnounsuredropdown.options[yesnounsuredropdown.selectedIndex].value;
 
 if( question_type == "1")
 {
	if(correct_answer>3) correct_answer = 1;
	num_answers = 3;
 }



 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("setupquestion.asp?tid="+TopicID+"&rid="+ReplyID+"&qtype="+question_type+"&num="+num_answers+"&c="+correct_answer+"&e="+explanation+"&cn="+correct_name+"&cu="+correct_url+"&in="+incorrect_name+"&iu="+incorrect_url, "setupquestion"+TopicID+"_"+ReplyID, windowprops); 
}


function SetupQuestionSimple(TopicID, ReplyID)
{
var scr_w = screen.availWidth/2-100;
var scr_h = screen.availHeight/2-100;


 var explanation = "";
 var correct_name = "";
 var correct_url = "";
 var incorrect_name = "";
 var incorrect_url = "";

 var num_answers = 3;
 var correct_answer = 1;
 var question_type = 1;
 
 if( question_type == "1")
 {
	if(correct_answer>3) correct_answer = 1;
	num_answers = 3;
 }



 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("setupquestion.asp?tid="+TopicID+"&rid="+ReplyID+"&qtype="+question_type+"&num="+num_answers+"&c="+correct_answer+"&e="+explanation+"&cn="+correct_name+"&cu="+correct_url+"&in="+incorrect_name+"&iu="+incorrect_url, "setupquestion"+TopicID+"_"+ReplyID, windowprops); 
}

function RemoveQuestionSimple(TopicID, ReplyID)
{
var scr_w = screen.availWidth/2-100;
var scr_h = screen.availHeight/2-100;


 var explanation = "";
 var correct_name = "";
 var correct_url = "";
 var incorrect_name = "";
 var incorrect_url = "";

 var num_answers = 0;
 var correct_answer = 0;
 var question_type = 0;
 
 if( question_type == "1")
 {
	if(correct_answer>3) correct_answer = 1;
	num_answers = 3;
 }



 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("setupquestion.asp?tid="+TopicID+"&rid="+ReplyID+"&qtype="+question_type+"&num="+num_answers+"&c="+correct_answer+"&e="+explanation+"&cn="+correct_name+"&cu="+correct_url+"&in="+incorrect_name+"&iu="+incorrect_url, "setupquestion"+TopicID+"_"+ReplyID, windowprops); 
}


function SetupLink(TopicID, ReplyID, TYPE)
{
var scr_w = screen.availWidth/2-100;
var scr_h = screen.availHeight/2-100;

 var url = "";
 var mname = "";

 if(TYPE == "TOP")
 {
	 var url = URLencode(document.all("top_setuplink_url"+TopicID+"_"+ReplyID).value);
 	 var mname = URLencode(document.all("top_setuplink_name"+TopicID+"_"+ReplyID).value);
 }
 else if(TYPE == "BOTTOM")
 {
	 var url = URLencode(document.all("bottom_setuplink_url"+TopicID+"_"+ReplyID).value);
 	 var mname = URLencode(document.all("bottom_setuplink_name"+TopicID+"_"+ReplyID).value);
 }


 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("setuplink.asp?tid="+TopicID+"&rid="+ReplyID+"&type="+TYPE+"&n="+mname+"&u="+url, "setuplink"+TopicID+"_"+ReplyID, windowprops); 
}


function VotingStatusChange(TopicID, ReplyID)
{
 var scr_w = screen.availWidth/2-100;
 var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("disablevoting.asp?tid="+TopicID+"&rid="+ReplyID, "votingupdate"+TopicID+"_"+ReplyID, windowprops); 
}


function AudioUpload(vTopicID, vReplyID)
{
 var scr_w = screen.availWidth/2-300;
 var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=600, height=200,top="+scr_h+",left="+scr_w;
 window.open("uploadaudio.asp?tid="+vTopicID+"&rid="+vReplyID, "audio"+vTopicID+"_"+vReplyID, windowprops); 
}

function AudioUploadBlog(vTopicID, vReplyID)
{
 var scr_w = screen.availWidth/2-300;
 var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=600, height=200,top="+scr_h+",left="+scr_w;
 window.open("uploadaudioblog.asp?tid="+vTopicID+"&rid="+vReplyID, "audio"+vTopicID+"_"+vReplyID, windowprops); 
}


function VideoUpload(vTopicID, vReplyID)
{
 var scr_w = screen.availWidth/2-300;
 var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=600, height=200,top="+scr_h+",left="+scr_w;
 window.open("uploadvideo.asp?tid="+vTopicID+"&rid="+vReplyID, "video"+vTopicID+"_"+vReplyID, windowprops); 
}

function VideoUploadBlog(vTopicID, vReplyID)
{
 var scr_w = screen.availWidth/2-300;
 var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=600, height=200,top="+scr_h+",left="+scr_w;
 window.open("uploadvideoblog.asp?tid="+vTopicID+"&rid="+vReplyID, "video"+vTopicID+"_"+vReplyID, windowprops); 
}


function Ban(ban, vTopicID, vReplyID)
{
 var scr_w = screen.availWidth/2-100;
 var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("ban.asp?ban="+ban+"&tid="+vTopicID+"&rid="+vReplyID, "ban"+vTopicID+"_"+vReplyID, windowprops); 
}

function ImageUpload(vTopicID, vReplyID)
{
 var scr_w = screen.availWidth/2-350;
 var scr_h = screen.availHeight/2-250;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=700, height=500,top="+scr_h+",left="+scr_w;
 window.open("uploadimage.asp?tid="+vTopicID+"&rid="+vReplyID, "image"+vTopicID+"_"+vReplyID, windowprops); 
}

function ImageUploadBlog(vTopicID, vReplyID)
{
 var scr_w = screen.availWidth/2-350;
 var scr_h = screen.availHeight/2-250;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=700, height=500,top="+scr_h+",left="+scr_w;
 window.open("uploadimageblog.asp?tid="+vTopicID+"&rid="+vReplyID, "image"+vTopicID+"_"+vReplyID, windowprops); 
}

function PPUpload(vTopicID, vReplyID)
{
 var scr_w = screen.availWidth/2-300;
 var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=600, height=200,top="+scr_h+",left="+scr_w;
 window.open("uploadpp.asp?tid="+vTopicID+"&rid="+vReplyID, "pp"+vTopicID+"_"+vReplyID, windowprops); 
}

function AdminEdit(method, vForumID, vTopicID, vReplyID)
{
 var scr_w = screen.availWidth/2-400;
 var scr_h = screen.availHeight/2-300;

// var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=800, height=600,top="+scr_h+",left="+scr_w;
 location = "post.asp?method="+method+"&REPLY_ID="+vReplyID+"&TOPIC_ID="+vTopicID+"&FORUM_ID="+vForumID, "ae"+vTopicID+"_"+vReplyID; 
}

/*
function Ban(vTopicID, vReplyID)
{
var scr_w = screen.availWidth/2-100;
var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("vote.asp?tid="+vTopicID+"&rid="+vReplyID+"&v=1", "vote"+vTopicID+"_"+vReplyID, windowprops); 

}
*/

function GenericVote(mode, vTopicID, vReplyID, vote)
{
var scr_w = screen.availWidth/2-80;
var scr_h = screen.availHeight/2-80;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("vote.asp?mode="+mode+"&tid="+vTopicID+"&rid="+vReplyID+"&v="+vote, "vote"+vTopicID+"_"+vReplyID, windowprops); 
}

function CareRecommend(vTopicID, vReplyID)
{
var scr_w = screen.availWidth/2-80;
var scr_h = screen.availHeight/2-80;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("care.asp?tid="+vTopicID+"&rid="+vReplyID+"&v=9", "vote"+vTopicID+"_"+vReplyID, windowprops); 
}

function Archive(vTopicID, vReplyID)
{
var scr_w = screen.availWidth/2-250;
var scr_h = screen.availHeight/2-100;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=500, height=200,top="+scr_h+",left="+scr_w;
 window.open("archive.asp?tid="+vTopicID+"&rid="+vReplyID, "vote"+vTopicID+"_"+vReplyID, windowprops); 
}

function NotifyAdmin(vTopicID, vReplyID)
{
var scr_w = screen.availWidth/2-80;
var scr_h = screen.availHeight/2-80;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("notifyadmin.asp?tid="+vTopicID+"&rid="+vReplyID+"&v=9", "vote"+vTopicID+"_"+vReplyID, windowprops); 
}

function Disagree(vTopicID, vReplyID)
{
var scr_w = screen.availWidth/2-80;
var scr_h = screen.availHeight/2-80;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("disagree.asp?tid="+vTopicID+"&rid="+vReplyID+"&v=9", "vote"+vTopicID+"_"+vReplyID, windowprops); 
}


function Vote(vTopicID, vReplyID)
{
 var bValChecked = -1;
 for(var i=0;i<document.all("rate"+vTopicID+"_"+vReplyID).length;i++) {
   if(document.all("rate"+vTopicID+"_"+vReplyID)[i].checked) {
	bValChecked = document.all("rate"+vTopicID+"_"+vReplyID)[i].value;
	break;
   }
 }
 if(bValChecked < 0) {
  alert("Please select how helpful this post is for our community.");
  return;
 }
 

var scr_w = screen.availWidth/2-80;
var scr_h = screen.availHeight/2-80;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=200, height=200,top="+scr_h+",left="+scr_w;
 window.open("vote.asp?tid="+vTopicID+"&rid="+vReplyID+"&v="+bValChecked, "vote"+vTopicID+"_"+vReplyID, windowprops); 
 

}


function OverrideVote(mode, vTopicID, vReplyID)
{
var scr_w = screen.availWidth/2-150;
var scr_h = screen.availHeight/2-200;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=300, height=400,top="+scr_h+",left="+scr_w;
 window.open("overridevote.asp?mode="+mode+"&tid="+vTopicID+"&rid="+vReplyID+"&v=0&override=1", "vote"+vTopicID+"_"+vReplyID, windowprops); 

}


function voteReloadParent(rid)
{
	var new_location = "" + self.opener.location;
	if(new_location.indexOf("&#") > 0) new_location = new_location.substring(0, new_location.indexOf("&#"));
	else if(new_location.indexOf("#") > 0) new_location = new_location.substring(0, new_location.indexOf("#"));
	if(rid!=0) new_location += "#"+rid;
      else new_location += "#top";
	self.opener.location.reload();
	self.opener.location = new_location;
}

function voteReloadParent(zoomto)
{
	var new_location = "" + self.opener.location;
	if(new_location.indexOf("&#") > 0) new_location = new_location.substring(0, new_location.indexOf("&#"));
	else if(new_location.indexOf("#") > 0) new_location = new_location.substring(0, new_location.indexOf("#"));
	new_location += "#"+zoomto;
     	self.opener.location.reload();
	self.opener.location = new_location;
}


function IgnoreUser(pestid)
{
		var scr_w = screen.availWidth/2-250;
		var scr_h = screen.availHeight/2-250;

		 var windowprops = "toolbar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=no,menubar=no, width=500, height=500,top="+scr_h+",left="+scr_w;
		 window.open("addpest.asp?pestid="+pestid, "pest"+pestid, windowprops); 
}


function fullScreen(theURL) {
window.open(theURL, '', 'fullscreen=yes, scrollbars=auto');
}

function SelectMood(mood_year, mood_month, mood_day)
{
 var scr_w = screen.availWidth/2-350;
 var scr_h = screen.availHeight/2-250;

 var windowprops = "toolbar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,menubar=no, width=700, height=500,top="+scr_h+",left="+scr_w;
 window.open("selectmood.asp?year="+mood_year+"&month="+mood_month+"&day="+mood_day, "moodselector", windowprops); 
}


function confirmDeletePost(loc)
{
	if(confirm("This operation is permanent.\nAre you sure you want to delete this post?"))
	{
		location = loc;
	}
}

function confirmDeleteTopic(loc)
{
	if(confirm("This operation is permanent.\nAre you sure you want to delete this topic?"))
	{
		location = loc;
	}
}


function confirmdelete(url)
{
	if(confirm("You are about to delete this record.\nAre you sure you want to continue?")) location=url;
}


function insertsmilie2(text) 
{
	var tarea = document.all("Message");
	if (typeof tarea.selectionStart != 'undefined'){ // if it supports DOM2
		start = tarea.selectionStart;
		end = tarea.selectionEnd;
		tarea.value = tarea.value.substr(0,tarea.selectionStart)
			+ text + tarea.value.substr(tarea.selectionEnd);
		tarea.focus();
		tarea.selectionStart = ((start - end) == 0) ? start + text.length : start;
		tarea.selectionEnd = start + text.length;
	} else {
		if (tarea.createTextRange && tarea.caretPos) {
			var caretPos = tarea.caretPos;
			caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?   text + ' ' : text;
		}
		else {
			tarea.value += text;
		}
		tarea.focus(caretPos);
	}
}


function storeCaret2(ftext) {
	if (ftext.createTextRange) {
		ftext.caretPos = document.selection.createRange().duplicate();
	}
}

function disable_all_submit(formname)
{
	for(i=0;i<document.forms.length;i++)
	{
		for(j=0;j<document.forms[i].elements.length;j++)
		{
			if(document.forms[i].elements[j].type=="button") document.forms[i].elements[j].disabled=true;
			if(document.forms[i].elements[j].type=="submit") document.forms[i].elements[j].disabled=true;
		}
	}
	
	eval("document."+formname+".submit()");
}

function open_spell2(formname, objname)
{
 var windowprops = "toolbar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no, width=500, height=400,top=0,left=0";
 window.open("\\discussion\\spell\\prespell.asp?frm="+formname+"&obj="+objname, "spellcheck", windowprops); 
}

function newqol_evalinput(qnum)
{
	var errormes="You must answer questions ";
	var first=true;
	var errors=false;
	for(var i=1;i<=qnum;i++)
	{
	 for(var j=0;j<eval("document.qform.q"+i+".length");j++)
	 {
	  if(eval("document.qform.q"+i+"["+j+"].checked")) break;
	  if(j==eval("document.qform.q"+i+".length")-1) 
	  {
	   errors=true;
	   if(first){errormes+=i;first=false;} else {errormes+=","+i;}
	  }
	 }
	}

  if(errors) {alert(errormes);return false;}
  else disable_all_submit("qform");
}


function newdiary_evalinput()
{
	 for(var j=0;j<eval("document.diaryform.progressval.length");j++)
	 {
	  if(eval("document.diaryform.progressval["+j+"].checked")) break;
	  if(j==eval("document.diaryform.progressval.length")-1) 
	  {
	  	alert("Please check the radio button that corresponds to the status of your current progress.")
		return;
	  }
	 }
	 
	 for(var j=0;j<eval("document.diaryform.psychologicalval.length");j++)
	 {
	  if(eval("document.diaryform.psychologicalval["+j+"].checked")) break;
	  if(j==eval("document.diaryform.psychologicalval.length")-1) 
	  {
	  	alert("Please check the radio button that corresponds to the severity of your psychological problems.")
		return;
	  }
	 }	 
	 
	 for(var j=0;j<eval("document.diaryform.medicalval.length");j++)
	 {
	  if(eval("document.diaryform.medicalval["+j+"].checked")) break;
	  if(j==eval("document.diaryform.medicalval.length")-1) 
	  {
	  	alert("Please check the radio button that corresponds to the severity of your medical problems.")
		return;
	  }
	 }	 
	 
	 for(var j=0;j<eval("document.diaryform.vocationalval.length");j++)
	 {
	  if(eval("document.diaryform.vocationalval["+j+"].checked")) break;
	  if(j==eval("document.diaryform.vocationalval.length")-1) 
	  {
	  	alert("Please check the radio button that corresponds to the severity of your vocational problems.")
		return;
	  }
	 }	 
	 
	 for(var j=0;j<eval("document.diaryform.socialval.length");j++)
	 {
	  if(eval("document.diaryform.socialval["+j+"].checked")) break;
	  if(j==eval("document.diaryform.socialval.length")-1) 
	  {
	  	alert("Please check the radio button that corresponds to the severity of your social problems.")
		return;
	  }
	 }	 	 	 	 
	
	document.diaryform.formop.value="submit";
	disable_all_submit("diaryform");
}

function diary_addpharm()
{
	document.diaryform.formop.value="addpharm";
	document.diaryform.action+="#pharm";
	document.diaryform.submit();
}

function diary_addnonpharm()
{
	document.diaryform.formop.value="addnonpharm";
	document.diaryform.action+="#nonpharm";
	document.diaryform.submit();
}

function diary_addlistedgoal(qolquestionid)
{
	document.diaryform.formop.value="addlistedgoal"+qolquestionid;
	document.diaryform.action+="#goals";
	document.diaryform.submit();
}

function diary_addunlistedgoal(qolquestionid)
{
	document.diaryform.formop.value="addunlistedgoal"+qolquestionid;
	document.diaryform.action+="#goals";
	document.diaryform.submit();
}

function updatedays(monthfieldID, daysfieldID, showblank)
{
	var month=document.getElementById(monthfieldID).value;
	var day=document.getElementById(daysfieldID).value;
	if(month=="") return;
	
	if(month=="1") document.getElementById(daysfieldID).length=31;
	if(month=="2") document.getElementById(daysfieldID).length=28;
	if(month=="3") document.getElementById(daysfieldID).length=31;
	if(month=="4") document.getElementById(daysfieldID).length=30;
	if(month=="5") document.getElementById(daysfieldID).length=31;
	if(month=="6") document.getElementById(daysfieldID).length=30;
	if(month=="7") document.getElementById(daysfieldID).length=31;
	if(month=="8") document.getElementById(daysfieldID).length=31;
	if(month=="9") document.getElementById(daysfieldID).length=30;
	if(month=="10") document.getElementById(daysfieldID).length=31;
	if(month=="11") document.getElementById(daysfieldID).length=30;
	if(month=="12") document.getElementById(daysfieldID).length=31;
	
	
	if(showblank)
	{
		document.getElementById(daysfieldID).length=document.getElementById(daysfieldID).length+1;
		document.getElementById(daysfieldID).options[0].value="";
		document.getElementById(daysfieldID).options[0].text="[Day]";
		
		for(i=1;i<document.getElementById(daysfieldID).length;i++)
		{
			document.getElementById(daysfieldID).options[i].value=""+i+"";
			document.getElementById(daysfieldID).options[i].text=""+i+"";
		}
	}
	else
	{
		for(i=0;i<document.getElementById(daysfieldID).length;i++)
		{
			document.getElementById(daysfieldID).options[i].value=""+(i+1)+"";
			document.getElementById(daysfieldID).options[i].text=""+(i+1)+"";
		}
	
	
	}
	
	
	
}


function viewprogressmatrix(pid, uid)
{
 	var windowprops = "toolbar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no,menubar=no, width=1020, height=675,top=0,left=0";
 	window.open("viewprogressmatrix.asp?id="+pid+"&uid="+uid, "viewmoodmatrix", windowprops); 
}


function openvideoupload(uid, did)
{
 var windowprops = "toolbar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes,menubar=no, width=610, height=550,top=0,left=0";
 window.open("videoupload.asp?uid="+uid+"&did="+did, "videoupload", windowprops); 
}

function opendownload(uid, did)
{
	 document.getElementById("download").src="getfiledocument.asp?uid="+uid+"&did="+did;
}
