/*
ver 1.20041111
make sure this file is sync'd up with the master
or use this as the master EXCEPT for custom jobs
*/
	var newWin;
	var submitting = 0;
	var thisDate = new Date();

// validates any selections, close this layer
	function mc_tu()  {
		ret = check_fp_tu();
		if (document.wq_form.type.value == "joint")
			ret = check_sp_tu();
		return ret;
	}

	function check_fp_tu()	{
		if (document.wq_form["First Client Tobacco Use"][0].checked)	{
			if (document.wq_form.fp_smoker_cigarette.selectedIndex == 0 &&
		      document.wq_form.fp_smoker_cigar.selectedIndex == 0 &&
		      document.wq_form.fp_smoker_cigarello.selectedIndex == 0 &&
		      document.wq_form.fp_smoker_pipe.selectedIndex == 0 &&
		      document.wq_form.fp_smoker_chew.selectedIndex == 0 &&
		      document.wq_form.fp_smoker_marijuana.selectedIndex == 0 &&
		      document.wq_form.fp_smoker_snuff.selectedIndex == 0 &&
		      document.wq_form.fp_smoker_prescribe.selectedIndex == 0)	{
				s = "You have answered Yes to using Tobacco Products. But you have not selected any products.\n\nPlease press 'Ok' to process this survey without Tobacco Use.\n Press Cancel to return and choose some Tobacco Products.";
				if (confirm(s) )	{
					document.wq_form["First Client Tobacco Use"][1].checked = true;
					tufilterClear();
					hide_layer("tuLayer");
					return true;
				}
			}
			else
				return true;
		}	else if (! document.wq_form["First Client Tobacco Use"][1].checked)	{
				s = "You have not indicated whether you have ever used or consumed tobacco.\n\nClick 'OK' to continue with the assumption of no such use, ever.\nClick 'Cancel' to return to indicate the tobacco type and last occasion of use.";
				if (confirm(s) )	{
					document.wq_form["First Client Tobacco Use"][1].checked = true;
					tufilterClear();
					hide_layer("tuLayer");
					return true;
				}
		}
		else
			return true;

		document.wq_form["First Client Tobacco Use"][0].checked = true;
		show_layer("tuLayer");
		return false;

	}

	function check_sp_tu()	{
		if (document.wq_form["Second Client Tobacco Use"][0].checked)	{
			if (document.wq_form.sp_smoker_cigarette.selectedIndex == 0 &&
		      document.wq_form.sp_smoker_cigar.selectedIndex == 0 &&
		      document.wq_form.sp_smoker_cigarello.selectedIndex == 0 &&
		      document.wq_form.sp_smoker_pipe.selectedIndex == 0 &&
		      document.wq_form.sp_smoker_chew.selectedIndex == 0 &&
		      document.wq_form.sp_smoker_marijuana.selectedIndex == 0 &&
		      document.wq_form.sp_smoker_snuff.selectedIndex == 0 &&
		      document.wq_form.sp_smoker_prescribe.selectedIndex == 0)	{
				s = "You have answered Yes to using Tobacco Products. But you have not selected any products.\n\nPlease press 'Ok' to process this survey without Tobacco Use.\n Press Cancel to return and choose some Tobacco Products.";
				if (confirm(s) )	{
					document.wq_form["Second Client Tobacco Use"][1].checked = true;
					tufilterClear2();
					hide_layer("tuLayer2");
					return true;
				}
			}
			else
				return true;
		}	else if (! document.wq_form["Second Client Tobacco Use"][1].checked)	{
				s = "You have not indicated whether you have ever used or consumed tobacco.\n\nClick 'OK' to continue with the assumption of no such use, ever.\nClick 'Cancel' to return to indicate the tobacco type and last occasion of use.";
				if (confirm(s) )	{
					document.wq_form["Second Client Tobacco Use"][1].checked = true;
					tufilterClear2();
					hide_layer("tuLayer2");
					return true;
				}
		}
		else
			return true;

		document.wq_form["Second Client Tobacco Use"][0].checked = true;
		show_layer("tuLayer2");
		return false;

	}

/*
resets values for tobacco use fields if client checks 'No'
*/
	function tufilterClear()  {
		document.wq_form.fp_smoker_cigarette.selectedIndex = 0;
		document.wq_form.fp_smoker_cigar.selectedIndex = 0;
		document.wq_form.fp_smoker_cigarello.selectedIndex = 0;
		document.wq_form.fp_smoker_pipe.selectedIndex = 0;
		document.wq_form.fp_smoker_chew.selectedIndex = 0;
		document.wq_form.fp_smoker_marijuana.selectedIndex = 0;
		document.wq_form.fp_smoker_snuff.selectedIndex = 0;
		document.wq_form.fp_smoker_prescribe.selectedIndex = 0;
	}

	function tufilterClear2()  {
		document.wq_form.sp_smoker_cigarette.selectedIndex = 0;
		document.wq_form.sp_smoker_cigar.selectedIndex = 0;
		document.wq_form.sp_smoker_cigarello.selectedIndex = 0;
		document.wq_form.sp_smoker_pipe.selectedIndex = 0;
		document.wq_form.sp_smoker_chew.selectedIndex = 0;
		document.wq_form.sp_smoker_marijuana.selectedIndex = 0;
		document.wq_form.sp_smoker_snuff.selectedIndex = 0;
		document.wq_form.sp_smoker_prescribe.selectedIndex = 0;
	}

	function mc_qafd(obj, layer, mode)  {
		return true;
	}
	function qafilterClear(obj)  {
	}
	function fmhfilterClear(obj)  {
	}
	function dhfilterClear(obj)  {
	}
	function pageSetup(obj)	{
		tufilterClear();
		if (DHTML)
			hide_layer("tuLayer");
		if (document.wq_form.type.value == "joint")	{
			tufilterClear2();
			if (DHTML)
				hide_layer("tuLayer2");
		}
	}
	function pageSetdown(obj)	{
		if (mc_tu())	{
			if (DHTML)
				displaySubmitLayer("proceedLine");
			return true;
		}
		return false;
	}
	function riskCheck(obj)	{
	}
	function displaySubmitLayer(lyr)	{
		window.location="#top";
		myBody = document.getElementById( ""+ lyr +"" );
		removeChildren(myBody);
		myDiv = document.createElement("DIV");
		myDiv.className = "optionButtonOver";
		myDiv.style.position = "relative";
		myDiv.style.height = 60 +"px";
		myDiv.style.border = "2px black solid";
		myDivText = document.createTextNode( "Surveying the market. Please Wait..." );
		myDiv.appendChild(myDivText);
		myBody.appendChild(myDiv);
	}
	function removeChildren  (myObj)  {
		objChild = myObj.firstChild;
		do  {
			if (objChild)
				myObj.removeChild(objChild);
			objChild = myObj.firstChild;
		} while (objChild)
	}

	function check_layer(obj_id)  {
		if (DHTML)	{
			layer_id = document.getElementById(obj_id);
			if (layer_id.style.display == "none")
				show_layer(obj_id);
			else
				hide_layer(obj_id);
		}
	}
	function show_layer(show_id)  {
		if (DHTML)	{
			s_id = document.getElementById(show_id);
			s_id.style.display = "";
		}
	}
	function hide_layer(hide_id)  {
		if (DHTML)	{
			h_id = document.getElementById(hide_id);
			h_id.style.display = "none";
		}
	}
	function check_radio(selectOBJ, radioOBJ)	{
		if (selectOBJ.selectedIndex > 0)
			radioOBJ[0].checked = true;
		else
			radioOBJ[1].checked = true;
	}
	function check_radioEX(selectOBJ1, selectOBJ2, selectOBJ3, selectOBJ4, radioOBJ)	{
		if (selectOBJ1.selectedIndex > 0 || selectOBJ2.selectedIndex > 0  ||
			selectOBJ3.selectedIndex > 0 || selectOBJ4.selectedIndex > 0)
			radioOBJ[0].checked = true;
		else
			radioOBJ[1].checked = true;
	}
	function check_select(selectOBJ, radioOBJ)	{
		if (radioOBJ[1].checked)	{
			selectOBJ.selectedIndex = 0;
		}
	}
	function check_selectEX(selectOBJ1, selectOBJ2, selectOBJ3, selectOBJ4, radioOBJ)	{
		if (radioOBJ[1].checked)	{
			selectOBJ1.selectedIndex = 0;
			selectOBJ2.selectedIndex = 0;
			selectOBJ3.selectedIndex = 0;
			selectOBJ4.selectedIndex = 0;
		}
	}

	function enableTU(obj)	{
	}
	function disableTU(obj)	{
	}
	function enableQA(obj)	{
	}
	function disableQA(obj)	{
	}
	function enableFMH(obj)  {
	}
	function disableFMH(obj)  {
	}
	function enableDH(obj)  {
	}
	function disableDH(obj)  {
	}


