function brdLink (t_asp,t_user,t_let,t_study,t_fda,t_grp)
{
	var t_label = document.forms[0].QLABEL.value;
	var str = "left=0,screenX=0,top=0,screenY=0";
	if (window.screen)
	{
		var ah = screen.availHeight - 30;
		var aw = screen.availWidth - 10;
		
		str += ",height=" + ah;
		str += ",innerHeight=" + ah;
		str += ",width=" + aw;
		str += ",innerWidth=" + aw;
		str += ",scrollbars=1";
	}
	else
	{
		str += ",resizable";
	}

	newWindow=window.open("", "new", str)
	newWindow.location.href="/start/strng/" + t_asp + ".asp?szHouseholdID=" + t_user + "&szOriginalImageFile=" + t_study + t_fda + t_let + "&szFileFormat=jpg&szJobNum=" + t_study + t_fda + "&szQlabel=" + t_label + "&szGroup=" + t_grp;
	
	return false;
}

image_1 = image_2 = image_3 = image_4 = image_5 = image_6 = image_7 = image_8 = image_9 = image_10 = image_11 = image_12 = false;

function checkImage(whichimage)
{
	switch (whichimage)
	{
		case 1: image_1 = true; break;
		case 2: image_2 = true; break;
		case 3: image_3 = true; break;
		case 4: image_4 = true; break;
		case 5: image_5 = true; break;
		case 6: image_6 = true; break;
		case 7: image_7 = true; break;
		case 8: image_8 = true; break;
		case 9: image_9 = true; break;
		case 10: image_10 = true; break;
		case 11: image_11 = true; break;
		case 12: image_12 = true; break;
	}
	if (image_1 && image_2 && image_3 && image_4 && image_5 && image_6 && image_7 && image_8 && image_9 && image_10 && image_11 && image_12) showImage();
}

function showImage()
{
	alert("all images are loaded and ready to display.\nclick 'ok' to begin the exercise");
	
	if (window.getCurrentTime) // check to see if CFIND.htm includes the new JavaScript timer before using it
		startTime = getCurrentTime();
    
	if (document.all)
	{
		document.all.wait.style.visibility="hidden";
		document.all.mypage.style.visibility="visible";
	}
	else
	{
		if (document.layers)
		{
			document.layers["wait"].visibility="hidden";
			document.layers["mypage"].visibility="visible";
		}
	}
}

function CheckMyKeys()
{
	var key = event.keyCode;
	if (event.keyCode==122)
	{
		event.cancelBubble=true;
		event.keyCode=0;
		return false;
	}
}
document.onkeydown = CheckMyKeys;

function hp_ne()
{
	return true;
}
onerror=hp_ne;

function hp_dn()
{
	return false;
}

function hp_cm()
{
//	alert("This function is unavailable during the survey.");
	return false;
}

function hp_de(e)
{
	return(e.target.tagName!=null && e.target.tagName.search('^(INPUT|TEXTAREA|BUTTON|SELECT)$')!=-1);
}

function hp_md(e)
{
	mac=navigator.userAgent.indexOf('Mac')!=-1;
	if(document.all)
	{
		if(event.button==2||(mac&&(event.ctrlKey||event.keyCode==91)))
		{
//			alert("This function is unavailable during the survey.");
			return(false);
		}
	}
	else
	{
		if(e.which==3||(mac&&(e.modifiers==2||e.ctrlKey)))
		{
//			alert("This function is unavailable during the survey.");
			return false;
		}
		else if(e.which==1)
		{
			window.captureEvents(Event.MOUSEMOVE);
			window.onmousemove=hp_dn;
		}
	}
}

function hp_mu(e)
{
	if(e.which==1)
	{
		window.releaseEvents(Event.MOUSEMOVE);
		window.onmousemove=null;
	}
}

if(navigator.appName.indexOf('Internet Explorer')!=-1 || (navigator.userAgent.indexOf('MSIE')!=-1 && document.all.length!=0))
{
	if(document.all)
	{
		mac=navigator.userAgent.indexOf('Mac')!=-1;
		version=parseFloat('0'+navigator.userAgent.substr(navigator.userAgent.indexOf('MSIE')+5),10);
		if(!mac && version>4)
		{
			document.oncontextmenu=hp_cm;
		}
		else
		{
			document.onmousedown=hp_md;
			document.onkeydown=hp_md;
		}
		document.onselectstart=hp_dn;
	}
	else if(document.layers)
	{
		window.captureEvents(Event.MOUSEDOWN|Event.modifiers|Event.KEYDOWN|Event.MOUSEUP);
		window.onmousedown=hp_md;
		window.onkeydown=hp_md;
		window.onmouseup=hp_mu;
	}
	else if(document.getElementById&&!document.all)
	{
		document.oncontextmenu=hp_cm;
		document.onmousedown=hp_de;
	}
}

function hp_dp1()
{
	for(i=0;i<document.all.length;i++)
	{
		if(document.all[i].style.visibility!="hidden")
		{
			document.all[i].style.visibility="hidden";
			document.all[i].id="hp_id";
		}
	}
}
window.onbeforeprint=hp_dp1;

function hp_dp2()
{
	for(i=0;i<document.all.length;i++)
	{
		if(document.all[i].id=="hp_id")
			document.all[i].style.visibility="";
	}
}
window.onafterprint=hp_dp2;

document.write('<style type="text/css" media="print"><!--body{display:none}--></style>');

function hp_ndd()
{
	return false;
}
document.ondragstart=hp_ndd;

// The flash objects are written by a seperate .js file to fix the annoyance
// that a Windows Security Update created -- it gives the message
// "Press SPACEBAR or ENTER to activate and use this control" over
// the Flash object if the user has that update applied
//
// Reference:
// Active Content Update Article: Preparing your website to handle the
//   Microsoft changes to Internet Explorer
// http://www.adobe.com/devnet/activecontent/articles/devletter.html

function InsertImageViewer(vnImageID, vsImageName, vnWidth, vnHeight, vsEncrypted, vsImageViewerVersion, vsLanguage)
{
	document.write('<div style="width:' + vnWidth + 'px; height:' + vnHeight + 'px;">');
	
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
			document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
			document.write('id="ImageViewer' + vnImageID + '" ');
			document.write('width="100%" height="100%" ');
			document.write('align="middle"> ');
		document.write('<param name="menu" value="false" /> ');
		document.write('<param name="allowScriptAccess" value="always" /> ');
		document.write('<param name="movie" value="ImageViewer_v' + vsImageViewerVersion + '.swf?varLanguage=' + vsLanguage + '&varImageName=' + vsImageName + '&varEncrypted=' + vsEncrypted + '&varFinalVariableSignal=AllSet" /> ');
		document.write('<param name="quality" value="best" /> ');
		document.write('<param name="scale" value="noscale" /> ');
		document.write('<param name="salign" value="lt" /> ');
		document.write('<param name="wmode" value="opaque" /> ');
		document.write('<param name="bgcolor" value="#ffffff" /> ');
		document.write('<embed src="ImageViewer_v' + vsImageViewerVersion + '.swf?varLanguage=' + vsLanguage + '&varImageName=' + vsImageName + '&varEncrypted=' + vsEncrypted + '&varFinalVariableSignal=AllSet" ');
			document.write('menu="false" ');
			document.write('quality="best" ');
			document.write('wmode="opaque" ');
			document.write('bgcolor="#ffffff" ');
			document.write('width="100%" height="100%" ');
			document.write('scale="noscale" salign="lt" ');
			document.write('name="ImageViewer' + vnImageID + '" ');
			document.write('align="middle" ');
			document.write('allowScriptAccess="always" ');
			document.write('type="application/x-shockwave-flash" ');
			document.write('pluginspage="http://www.macromedia.com/go/getflashplayer" /> ');
	document.write('</object>');
	
	document.write('</div>');
	
	if (document.getElementById('ImageViewer' + vnImageID).focus)
		document.getElementById('ImageViewer' + vnImageID).focus();
	
	scroll(0,0); // make sure the top of the page is showing
}

function InsertClearClipboard(vsClearClipboardVersion, vsLanguage)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
			document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
			document.write('id="ClearClipboard" ');
			document.write('width="1" height="1" ');
			document.write('align="middle"> ');
		document.write('<param name="menu" value="false" /> ');
		document.write('<param name="allowScriptAccess" value="always" /> ');
		document.write('<param name="movie" value="ClearClipboard_v' + vsClearClipboardVersion + '.swf?varLanguage=' + vsLanguage + '&varFinalVariableSignal=AllSet" /> ');
		document.write('<param name="quality" value="high" /> ');
		document.write('<param name="bgcolor" value="#ffffff" /> ');
		document.write('<embed src="ClearClipboard_v' + vsClearClipboardVersion + '.swf?varLanguage=' + vsLanguage + '&varFinalVariableSignal=AllSet" ');
			document.write('menu="false" ');
			document.write('quality="high" ');
			document.write('bgcolor="#ffffff" ');
			document.write('width="1" height="1" ');
			document.write('name="ClearClipboard" ');
			document.write('align="middle" ');
			document.write('allowScriptAccess="always" ');
			document.write('type="application/x-shockwave-flash" ');
			document.write('pluginspage="http://www.macromedia.com/go/getflashplayer" /> ');
	document.write('</object>');
}