
var DissolveSpacefill = "delay .2; spacefill 1.4; delay .2; spacefill 1.3; delay .2; spacefill 1.2; delay .2; spacefill 1.1; delay .2; spacefill 1.0; delay .2; spacefill 0.8; delay .2; spacefill 0.7; delay .2; spacefill 0.6; delay .2; spacefill 0.5; delay .2; spacefill 0.4; delay .2; spacefill 0.3; delay .2; spacefill 0.1; delay .2; spacefill 0;";

var fadeToGray = "delay .1; color atoms [x606060]; delay .1; color atoms [x505050]; delay .1; color atoms [x404040]; delay .1; color atoms [x303030];";
//var spacefillDissolve= "for (var i = 400; i <= 0; i = i - 25);if (i < 25);n=0;end if;spacefill @i; end for";



// ************* Study molecule scripts ---------------------
	// add to list in MnQJS some molecule abbreviations

var WholeIgGScp="load 1IGT.pdb; select all; spacefill 1.5; color atoms chain; select hetero; color atoms orange; moveto 0 { -689 694 209 118.79} 100.0 -0.22 -9.14  {-1.5750008 -16.597002 9.544001} 90.59715 {0.0 0.0 0.0} -10.172592 -6.119057 50.0;"
var WholeIgGMsg ="Whole IgG"
var IgGSettings="Atoms,0.375,Bonds,0.1,Trace,Dots,Protein,Backbone,Sidechain,Element,1o Structure,2o Structure,4o Structure";

var HCScp=WholeIgGScp+" select :B or :D; color atoms green" 
var HCMsg="IgG Heavy Chains"
var AbSettings="Atoms,1.5,Bonds,0.1,Ribbon,Trace,Dots,Protein,Carbohydrate,Green,4o Structure,Element,2o Structure,1o Structure";

var LCScp=WholeIgGScp+" select :A or :C; color atoms green"
var LCMsg="IgG Light Chains"


//var FabScp="WholeIgGScp + "select @{within("branch",{[ala]4.N}, {[ala]4.CA})};selectionHalos on"
//var FabScp=WholeIgGScp + "select @{within(BRANCH,{atomno=3182},{atomno=3188})};color atoms green"
//FabScp=WholeIgGScp + "select @{within(BRANCH,{[SER]113:B.CA},{[SER]112:B.C})};color atoms green"
var FabScp=WholeIgGScp + "select (:B and atomno < 4091) or (:D and atomno < 10557) or :C or :A; color atoms green"
var FabMsg="Fab"

var FcScp=WholeIgGScp+"select (:B and atomno > 4091) or (:D and atomno > 10557); color atoms green"
var FcMsg="Fc"

var CRScp=WholeIgGScp+"select (:B and atomno > 3188) or (:D and atomno > 9668) or (:A and atomno > 994) or (:C and atomno > 7474); color atoms green"
var CRMsg="CR"

var VRScp=WholeIgGScp+"select not ((:B and atomno > 3188) or (:D and atomno > 9668) or (:A and atomno > 994) or (:C and atomno > 7474)); color atoms green"
var VRMsg="Variable domains"

var AGbScp=WholeIgGScp+"; select WITHIN(15.0,atomno=2567 or atomno=843 or atomno=9000 or atomno=6737); color atoms green"
var AGbMsg="Antigen Binding sites"

var HRScp=WholeIgGScp+"; select (:B and (atomno > 4098 and atomno < 4225)) or (:D and (atomno > 10557 and atomno < 10706)); color atoms green"
var HRMsg="Hinge region"

var OlgScp=WholeIgGScp+"; select not protein; color atoms green"
var OlgMsg="Oligosaccharide"

var DSbScp=WholeIgGScp+"; select all; wireframe 0.05; trace 50; color trace chain; select sulfur; spacefill 0.7; color atoms CPK; delay 1; select not sulfur;"+DissolveSpacefill+" delay 2; moveto 4 {-521 777 354 107.98} 1304.31 -121.62 96.12 {-1.5750008 -16.597002 9.544001} 90.59715  {0.0 0.0 0.0} -251.72891 99.589424 50.0;"
var DSbMsg="Disulphide bonds"
var DSbSettings="Atoms,0.5,Bonds,0.05,Ribbon,Trace,Dots,Protein,Carbohydrate,4o Structure,Element,2o Structure,1o Structure";


var FabLysoScp="load 1FDL.pdb; color chain; select :H, :L; ribbons ON; select :Y; color orange; trace 1.0; select [GLY]53:H, [GLY]31:H, [ASP]54:H, [ASP]56:H, [TRP]52:H, [TYR]101:H, [ARG]99:H, [TYR]32:H, [ASP]100:H, [ARG]102:H, [TYR]49:L, [SER]93:L, [TYR]50:L, [TYR]32:L, [TRP]92:L; spacefill ON; moveto 3 { -111 336 935 126.53} /* zoom, translation */  185.94 -21.49 50.13  /* center, rotationRadius */ {5.4956923 28.007765 13.485015} 57.016903 /* navigation center, translation, depth */ {0.0 0.0 0.0} 14.87685 50.26424 50.0;"
var FabLysoMsg= "Fab - Lysozyme Complex"
FabLyso1Scp="select :y; spacefill 1.5; trace off; delay 0.4; for (var i = 0;i <= 2; i = i + 1); for (var j = 0;j <= 10; j = j + 1); delay 0.1; translateselected {0,0,1/30}; end for; for (var j = 0;j <= 10; j = j + 1); delay 0.1; translateselected {0,0,-1/30}; end for; end for";
var FabLysoSettings="Atoms,1.5,Bonds,0.1,Ribbon,1.75,Trace,1.0,Dots,|mol;Protein; not :P|,|mol;Antigen;:P|,4o Structure,Element,2o Structure,1o Structure";

var FabAngioScp="load 2ck0.pdb; moveto 0 { -588 -255 768 132.08} 119.0 0.0 0.12  {69.9725 16.848 3.744501} 46.297832 {0.0 0.0 0.0} 24.378458 84.87355 50.0;; color chain; select :H, :L, :P; ribbons ON; select :P; spacefill 150; color amino; trace ON; trace 1.0; select [ASN]54:H, [PHE]53:H, [ARG]52:H, [TYR]58:H, [ALA]100:H, [ASP]100:H, [ARG]50:H, [GLY]101:H, [TYR]92:L, [TYR]95:L, [LEU]94:L, [HIS]31:L, [THR]31^C:L, [ASN]93:L, [LYS]31^E:L; spacefill ON; select hetero; spacefill OFF";
var FabAngioMsg= "Linear epitope";
var FabAngioSettings="Atoms,1.5,Bonds,0.1,Ribbon,1.75,Trace,1.0,Dots,|mol;Protein;not :Y|,|mol;Antigen;:Y|,4o Structure,Element,2o Structure,1o Structure";

var IgAScp="load 2QTJ.pdb 1; spacefill 1.5; color atoms chain; trace 100; moveto 0 { 372 -926 -62 173.23} 115.39 1.97 -1.1  {-20.162176 -37.372555 -42.155106} 173.45811 {0.0 0.0 0.0} -12.907309 -6.86322 50.0;";
var IgAMsg="Dimeric IgA";
var IgASettings="Amino acids,1.5,Trace,100,Ribbon,Protein,4o Structure,1o Structure,2o Structure";

var IgMScp="load 2RCJ.pdb 1; spacefill 1.5; Trace 100; color atoms chain; wireframe 0.15; moveto 0 { 167 209 964 11.01} 88.41 -0.44 1.34   {-0.5744934 1.7455063 -12.564001} 192.33917  {0.0 0.0 0.0} -0.110348485 1.7274479 50.0;";
var IgMMsg="Pentameric IgM";
var IgMSettings="Amino acids,1.5,Trace,100,Protein,4o Structure,1o Structure,2o Structure";

var MHC2Scp="load 1f3j.pdb; moveto 0 { -68 -974 -217 141.52}  100.0 0.0 0.12  {11.660001 51.305 22.8735} 45.07999 {0.0 0.0 0.0} 9.998831 67.097946 50.0; select all; color chain; select :A or :B; spacefill off; wireframe off; ribbon ON; select :P; spacefill 1.0; wireframe 0.15";
var MHC2Msg="MHC-II";
var MHCSettings="Atoms,1.5,Bonds,0.1,Ribbon,300,Trace,1.0,Dots,|mol;Protein;:A or :B|,|mol;Antigen;:P|,4o Structure,Element,2o Structure,1o Structure";

var MHC1Scp="load 2VAA.pdb FILTER \"![HOH]\"; moveto 0 { 966 149 -211 40.12}  100.0 -0.88 7.95  {48.315 34.385 -1.4869995} 43.163605 {0.0 0.0 0.0} -59.820686 35.54533 50.0; select all; color chain; select :A or :B; spacefill off; wireframe off; ribbon ON; select :P; spacefill 1.0; wireframe 0.15";
var MHC1Msg="MHC-I";

var TCRHA1Scp="load 1J8H.pdb; moveto 0 -639 768 55 50.6 121; select all; wireframe OFF; spacefill OFF; ribbons ON; color chain; select :A, :B, :C; spacefill ON; select :C; color orange";
var TCRHA1Msg="TCR bound to MHC-II";
var TCRSettings="Atoms,1.5,Bonds,0.1,Ribbon,1.75,Trace,1.0,Dots,|mol;TCR;:E or :D|,|mol;MHC;:A or :B|,|mol;Antigen;:C|,4o Structure,Element,2o Structure,1o Structure";

var TCRMHCIScp="load 1LP9.pdb FILTER \"!:H,!:I,!:L,!:M,!:J\"; moveto 0 { -806 -419 418 174.92}  119.46 8.11 11.12 {19.458002 22.3545 8.644497} 79.15566  {0.0 0.0 0.0} -3.0251954 8.347266 50.0;select all; wireframe OFF; spacefill OFF; ribbons ON; color chain; select :A, :B, :C; spacefill ON; select :C; color orange";
var TCRMHCIMsg="TCR bound to MHC-I";
var TCRMHCISettings="Atoms,1.5,Bonds,0.1,Ribbon,1.75,Trace,1.0,Dots,|mol;TCR;:E or :F|,|mol;MHC;:A or :B|,|mol;Antigen;:C|,4o Structure,Element,2o Structure,1o Structure";

var CD1GM2Scp="load 2FIK.pdb FILTER \"![HOH],![NAG]\"; moveto 0 { 958 -144 -248 111.94}  100.0 0.0 0.12  {20.999498 37.5685 35.109} 41.509384 {0.0 0.0 0.0} -4.4241185 -63.898212 50.0;select protein; spacefill off; wireframe off; ribbon 250; color ribbon chain; select not protein; spacefill 0.7; color atoms CPK; select protein";
var CD1GM2Msg="CD1-antigen complex";
var CD1GM2Settings="Atoms,0.7,Bonds,0.1,Ribbon,250,Trace,Dots,Protein,|mol;Antigen;[GSL] or [PLM]|,4o Structure,Element,2o Structure,1o Structure";

var TLR3Scp="load 2A0Z.pdb FILTER \"![HOH]\"; select protein; spacefill 0.5; wireframe 0.15; trace 100; color trace gold";
var TLR3Msg="Human Toll-Like Receptor";
var TLR3Settings="Atoms,0.5,Bonds,0.15,Ribbon,Trace,100,Dots,Protein,4o Structure,Element,2o Structure,1o Structure";

var TLR3RNAScp="load 3CIY.pdb FILTER \"![HOH]\"; select protein; spacefill off; wireframe off; ribbon 100; color ribbon chain; select RNA; spacefill 1.0";
var TLR3RNAMsg="TLR3 - dsRNA complex";
var TLR3RNASettings="Atoms,1.0,Bonds,0.15,Ribbon,100,Trace,Dots,RNA,Protein,Element,4o Structure,2o Structure,1o Structure";



// Inquiry scripts
var IgQScp="load 1IGT.pdb; select all; spacefill 1.5; wireframe 0.15; color atoms white; moveto 0 { 505 209 838 134.84} 100.0 -2.41 -3.88  {-1.5750008 -16.597002 9.544001} 90.59715 {0.0 0.0 0.0} -11.078857 1.3724031 50.0;";
var IgQMsg ="Immunoglobin";
var IgQSettings="Atoms,1.5,Bonds,0.15,Ribbon,Trace,Dots,Protein,Carbohydrate,White,Element,1o Structure,2o Structure,4o Structure";
var DSbSettings="Atoms,1.5,Bonds,0.15,Ribbon,Trace,Dots,|mol;Cysteine;[Cys]|,Protein,Carbohydrate,White,Element,1o Structure,2o Structure,4o Structure";

var qCD1Ans = "False,True,False,False,False,False,False,False,True";
var qCD1Scp="load 2FIK.pdb; hide [HOH],[NAG]; select all; spacefill 1.5; wireframe 0.15; color atoms white; select protein";
var qCD1Msg="Model 1";
var qCD1Settings="Atoms,1.5,Bonds,0.15,Ribbon,Trace,Dots,Protein,|mol;Antigen;[GSL] or [PLM]|,White,4o Structure,Element,2o Structure,1o Structure";

var qTCRMHCAns = "False,False,False,False,True,False,True,False,False";
var qTCRMHCScp="load 1LP9.pdb; hide [HOH],:H,:I,:L,:M,:J; select all; wireframe 0.15; spacefill 1.5; color atoms white;select protein";
var qTCRMHCMsg="Model 2";
var qTCRMHCSettings="Atoms,1.5,Bonds,0.15,Ribbon,Trace,Dots,Protein,|mol;Antigen;:C|,White,4o Structure,Element,2o Structure,1o Structure";

var qFabAns = "True,False,False,False,False,False,False,True,False";
var qFabScp="load 1M7D.pdb FILTER \"![HOH]\"; select all; spacefill 1.5; wireframe 0.15; color atoms white; select protein";
var qFabMsg ="Model 3";
var qFabSettings="Atoms,1.5,Bonds,0.15,Ribbon,Trace,Dots,Protein,|mol;Antigen;not protein|,White,Element,1o Structure,2o Structure,4o Structure";
//1CE1
var qMHCIIAns = "False,False,False,True,False,False,True,False,False";
var qMHCIIScp="load 1f3j.pdb; select all; spacefill 1.5; wireframe 0.15; color atoms white";
var qMHCIIMsg="Model 4";
var qMHCSettings="Atoms,1.5,Bonds,0.1,Ribbon,Trace,Dots,Protein,|mol;Antigen;:P|,White,4o Structure,Element,2o Structure,1o Structure";

var qTLRAns = "False,False,False,False,False,True,False,False,False";
var qTLRScp="load 2A0Z.pdb FILTER \"![HOH]\"; moveto 0 {836 -433 336 104.26} 100.0 0.0 0.12  {-29.850998 -25.141502 19.901} 59.802757 {0.0 0.0 0.0} 0.4624046 -16.19932 50.0; select all; spacefill 1.5; wireframe 0.15; color atoms white; select protein";
var qTLRMsg="Model 5";
var qTLRSettings="Atoms,1.5,Bonds,0.15,Ribbon,Trace,Dots,Protein,White,4o Structure,Element,2o Structure,1o Structure";

var qMHCIAns = "False,False,True,False,False,False,True,False,False";
var qMHCIScp="load 2VAA.pdb FILTER \"![HOH]\"; select all; spacefill 1.5; wireframe 0.15; color atoms white; select protein";
var qMHCIMsg="Model 6";

var qepi1Ans = "True,False,False,False,False,False";
var qepi1Scp="load 1CFT.pdb FILTER \"![HOH]\"; select all; spacefill 1.5; wireframe 0.15; color atoms white";
var qepi1Msg ="Model 3";
var qepi1Settings="Atoms,1.5,Bonds,0.15,Trace,Dots,Ribbon,|mol;Protein;not:C|,|mol;Antigen;:C|,White,Element,1o Structure,2o Structure,4o Structure";

var qepi2Ans = "False,True,Fals,False,False,Falsee";
var qepi2Scp="load 1WEJ.pdb FILTER \"![HOH]\"; select all; spacefill 1.5; wireframe 0.15; color atoms white";
var qepi2Msg ="Model 2";
var qepi2Settings="Atoms,1.5,Bonds,0.15,Trace,Dots,Ribbon,|mol;Protein;not:F|,|mol;Antigen;:F|,White,Element,1o Structure,2o Structure,4o Structure";

var qepi3Ans = "False,False,True,False,True,False";
var qepi3Scp="load 1I8M.pdb  FILTER \"![HOH],!L,!H\"; moveto 0 { -903 312 296 164.88}  135.54 -12.88 -10.27   {66.549 88.521996 25.595} 101.824524 {0.0 0.0 0.0} 5.915693 -86.29791 50.0;;select all; select all; spacefill 1.5; wireframe 0.15; color atoms white; spacefill 1.0, wireframe 0.15; color atoms CPK";
var qepi3Msg ="Model 3";
var qepi3Settings="Atoms,1.5,Bonds,0.15,Trace,Dots,Ribbon,Protein,|mol;Antigen;:T|,White,Element,1o Structure,2o Structure,4o Structure";

var qepi4Ans = "True,False,False,False,False,False";
var qepi4Scp="load 1E6J.pdb; select all; spacefill 1.5; wireframe 0.15; color atoms white";
var qepi4Msg ="Model 4";
var qepi4Settings="Atoms,1.5,Bonds,0.15,Trace,Dots,Ribbon,|mol;Protein;:H or :L|,|mol;Antigen;:P|,White,Element,1o Structure,2o Structure,4o Structure";

var qepi5Ans = "False,False,True,True,False,False";
var qepi5Scp="load 1M7I.pdb FILTER \"![HOH]\"; select all; spacefill 1.5; wireframe 0.15; color atoms white";
var qepi5Msg ="Model 5";
var qepi5Settings="Atoms,1.5,Bonds,0.15,Trace,Dots,Ribbon,Protein,|mol;Antigen;not protein|,White,Element,1o Structure,2o Structure,4o Structure";

var qepi6Ans = "False,True,False,False,False,False";
var qepi6Scp="load 2J5L.pdb; select all; spacefill 1.5; wireframe 0.15; color atoms white";
var qepi6Msg ="Model 6";
var qepi6Settings="Atoms,1.5,Bonds,0.15,Trace,Dots,Ribbon,|mol;Protein;not:A|,|mol;Antigen;:A|,White,Element,1o Structure,2o Structure,4o Structure";

// protein response functions

function IsPickCorrect (atomID){
	// examine atom selected and determine if it is correct	
document.getElementById(tallyGroup+"Attempts").value= Number(document.getElementById(tallyGroup+"Attempts").value)+1;	
		// get the custom typeIndx property of the atom
var typeIndx=jmolEvaluate("{atomno="+atmNm+"}.property_typeIndx");
if (quesGroup == 'Ig'){
		if (typeIndx+"" === "1"){
			document.getElementById(tallyGroup+"Correct").value = Number(document.getElementById(tallyGroup+"Correct").value)+1;
			return("Correct! This is "+toSelect+".");
			} 
		else{
			return("Oops! This is not "+toSelect+".|Try Again.");
			}
	}
if (quesGroup == 'DSb'){
		if (atomID == "6" || atomID == "7" || atomID == "8" || atomID == "238"){
			document.getElementById(tallyGroup+"Correct").value = Number(document.getElementById(tallyGroup+"Correct").value)+1;
			return("Correct! This is one of the disulphide bonds.");
			} 
		else{
			return("Oops! This is not one of the|target disulphide bonds. Try Again.");
			}
	}	
}



function setModanswers(model){
	// for amino acid models set sidechain type checkbox values
var aAnswers = window[model+'Ans'].split(",");
for (i=0;i<=aAnswers.length+1;i++){
	document.getElementById("modType"+(i+1)).value=aAnswers[i];
	}
}

function setepianswers(model){
	// for amino acid models set sidechain type checkbox values
var aAnswers = window[model+'Ans'].split(",");
for (i=0;i<=aAnswers.length+1;i++){
		document.getElementById("epiType"+(i+1)).value=aAnswers[i];		
	}
}
