	function addToOneTouchSlip(link, type) {
				var slip = document.getElementById("slip");
				if (slipCount >= 1) {
					var oldEntry = getChildOfType(slip, "DIV", 1);
					slip.removeChild(oldEntry);
					slipCount = slipCount - 1;
				}
		//		alert(link);
		//		alert(link.parentNode);
		//		alert(link.parentNode.parentNode);
				var opp = link.parentNode.parentNode
				var oppId = getOppValue(opp, 12);


				slip.innerHTML = "";
//				}

				var oppName = getOppValue(opp, 9);
			//	alert("oppName" + oppName);
				var oppLevel = getOppValue(opp, 10);
	//			alert("oppLevel" + oppLevel);
				var oppOdds = getOppValue(opp, 5);
	//			alert("oppOdds" + oppOdds);
			//	var oppClose = getOppValue(opp, 11);
			//	alert("oppClose" + oppClose);
				var oppWin = getOppValue(opp, 14);
				var oppLose = getOppValue(opp, 15);
				var oppDesc = getOppValue(opp, 13);
				// copy the template
				// do it this way so we go around the "Unknown runtime error in IE when editing the innerHTML of a table"
				var newEntry = document.createElement("span");
				newEntry.innerHTML = document.getElementById("template").innerHTML;
				newEntry = newEntry.getElementsByTagName("DIV")[0];

				var tbls = newEntry.getElementsByTagName("TABLE");
				// fill the template
				setEntryValue(tbls[1], 1, oppId);
			//	setEntryLabel(tbls[1], 2, getEntryLabel(tbls[1], 2) + ' ' + (slipCount + 1));
				setEntryValue(tbls[2], 2, oppName);
				setEntryValue(tbls[2], 3, oppLevel);
				var tbody1 = getChildOfType(tbls[2], "TBODY", 1);
				var tr1 = getChildOfType(tbody1, "TR", 3);
				var td1 = getChildOfType(tr1, "TD", 3);
				var td2 = getChildOfType(opp, "TD", 4);
				td1.innerHTML = td1.innerHTML + td2.innerHTML;
//				setEntryData(tbls[1], 3, getOppValue(opp, 4), 4 , -1);
				setEntryValue(tbls[2], 9, (new Number(500)+(new Number(500) * new Number(oppWin))) + getILS());
				setEntryData(tbls[2], 10, oppDesc, 2, -1);
			//	copyLevelColorToSlip(link, tbls[1]);
			//	setEntryValue(tbls[1], 4, document.getElementById(type == 1 ? "template_slip_call" : "template_slip_put").innerHTML);
			//	setEntryValue(tbls[1], 5, oppClose);
				if (type == 2) {
//					swapUpDownCaptions(tbls[1]);
				}
				setEntryValue(tbls[2], 12, oppWin);
				setEntryValue(tbls[2], 13, oppLose);
				setEntryValue(tbls[2], 14, type);

			/*	if (slipCount == 0) {
					// add the all section
					var allSpan = document.getElementById("slipall");
					var allClone = document.createElement("SPAN");
					allClone.innerHTML = allSpan.innerHTML;
					slip.appendChild(getChildOfType(allClone, "DIV", 1));
				} */

				// add the new entry
//				var slipTotal = getChildOfType(slip, "DIV", slipCount + 1);
				var slipTotal = getChildOfType(slip, "DIV", 1);
				slipCount++;
//				slip.insertBefore(newEntry, slipTotal);
				slip.appendChild(newEntry);
//				updateSlipCaptions();
				scroll(0, 0);

//				addToServerSlip(oppId, type);
			}

			function updateUnitSelection(box) {
				var units = box.options[box.selectedIndex].value;
				var value = (new Number(500) * new Number(units));
				setEntryValue(box.parentNode.parentNode.parentNode.parentNode , 7 , value + getILS() , 7) ;
				var odds = getEntryValue(box.parentNode.parentNode.parentNode.parentNode , 12);
				//alert(odds);
				setEntryValue(box.parentNode.parentNode.parentNode.parentNode , 9 , (new Number(value) + (new Number(value) * new Number(odds))) + getILS() , 7) ;
			}

			function submitOneTouchFromSlip(button) {

				if (canSubmit) {
					canSubmit = false;

					errLogInDisplayed = false;
					var entry = button;
					for (var i = 0; i < 9; i++) { //was 9 with the divs
						entry = entry.parentNode;
					}

					var tbls = entry.getElementsByTagName("TABLE");
					var oppId = getEntryValue(tbls[0], 1);
				//	alert("oppId " + oppId);
					var oppLvl = getEntryValue(tbls[1], 3);
				//	alert("oppLvl " + oppLvl);
					var oppOddsWin = getEntryValue(tbls[1], 12);
				//	alert("oppOddsWin " + oppOddsWin);
					var oppOddsLose = getEntryValue(tbls[1], 13);
			//		alert("oppOddsLose " + oppOddsLose);
					var choice = getEntryValue(tbls[1], 14);
			//		alert("choice " + choice);
					var amount = getEntryValue(tbls[1],7);
				//	alert("amount " + amount);

					setEntryLabel(tbls[1], 1, ""); // clear error
					if (isRowOn(tbls[1], 1)) {
						toggleRow(tbls[1], 1);
					}

					setEntryData(tbls[0], 1, 1, 1); // mark as submitting

					entSubmitted = 1;
					submitOneTouchFromServerSlip(oppId, oppLvl, oppOddsWin, oppOddsLose, choice, 0, amount);
					entSubmitted = 1;
				}
			}

			function submitOneTouchFromServerSlip(id, lvl, oddWin, oddLose, choice, all, amount) {
				var subSS = new SubSS(id, lvl, oddWin, oddLose, choice, all, amount);
				function SubSS(id, lvl, oddWin, oddLose, choice, all, amount) {
					this.id = id;
					this.lvl = lvl;
					this.oddWin = oddWin;
					this.oddLose = oddLose;
					this.choice = choice;
					this.all = all;
					this.amount = amount;
					SubSS.ticker = function() {
						var xmlHttp = getXMLHttp();
						if (null == xmlHttp) {
							return false;
						}
						xmlHttp.onreadystatechange = function() {
							if (xmlHttp.readyState == 4) {
								canSubmit = true;
								if (xmlHttp.responseText.length > 2) {

									if (xmlHttp.responseText.substring(0, 2) == "OK") {

										successOneTouchFromSlip(subSS.id, subSS.choice, xmlHttp.responseText.substring(2));
									} else if (xmlHttp.responseText.substring(0, 1) == "1") {
										if (!errLogInDisplayed) {
											errLogInDisplayed = true;
									//		alert(xmlHttp.responseText.substring(1));
											errorInSlipNotLogin(subSS.id, subSS.choice);
											unfreezeOneTouchInSlip(subSS.id, subSS.choice);
											// refresh the header to see he is not logged in
											document.getElementById('header').contentWindow.location.reload();
										}
									} else {

										errorOneTouchInSlip(subSS.id, subSS.choice, xmlHttp.responseText);
										unfreezeOneTouchInSlip(subSS.id, subSS.choice);
									}
								} else {

									errorOneTouchInSlip(subSS.id, subSS.choice, xmlHttp.responseText);
									unfreezeOneTouchInSlip(subSS.id, subSS.choice);
								}
							}
						}
						xmlHttp.open("POST", "oneTouchAjax.jsf", true);
						xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
						xmlHttp.send("command=submit&slipEntryId=" + subSS.id +
									 "&slipEntryLevel=" + subSS.lvl +
									 "&slipEntryOddWin=" + subSS.oddWin +
									 "&slipEntryOddLose=" + subSS.oddLose +
									 "&choice=" + subSS.choice +
									 "&all=" + subSS.all +
									 "&amount=" + subSS.amount +
									 "&utcOffset=" + sessionUtcOffset);
					}
				}
				setTimeout(SubSS.ticker, entSubmitted * 1000);
				entSubmitted++;
			}

			function successOneTouchFromSlip(id, choice, invId) {
				if (successWorking) {
					setTimeout("successFromSlip('" + id + ", " + choice + ", " + invId + "');", 100);
					return;
				}
				successWorking = true;
				var slip = document.getElementById("slip");
				for (var i = 1; i <= slipCount; i++) {
					var crrEntry = getChildOfType(slip, "DIV", i);
					var crrTbls = crrEntry.getElementsByTagName("TABLE");
					if (getEntryLabel(crrTbls[1], 1) == 0) { // not success
						var entId = getEntryValue(crrTbls[1], 1);
						var entChoice = getEntryValue(crrTbls[2], 14);
						if (id == entId && choice == entChoice) {
							// copy the template
							// do it this way so we go around the "Unknown runtime error in IE when editing the innerHTML of a table"
							var newEntry = document.createElement("span");
							newEntry.innerHTML = document.getElementById("template_success").innerHTML;
							newEntry = newEntry.getElementsByTagName("DIV")[0];

							var newTbls = newEntry.getElementsByTagName("TABLE");
							setEntryValue(newTbls[1], 1, id);
							setSuccessInvId(newTbls[2], invId);
							setEntryValue(newTbls[3], 1, getEntryValue(crrTbls[2], 2));
							setEntryValue(newTbls[4], 1, getEntryValue(crrTbls[2], 3));
							copyLevelColor(crrTbls[2], newTbls[4]);
							setEntryValue(newTbls[5], 1, getEntryValue(crrTbls[2], 4));
							setEntryValue(newTbls[6], 1, getEntryValue(crrTbls[2], 7));
					//		setEntryValue(newTbls[6], 1, getEntryAmount(crrTbls[1]) + getILS());
							setEntryValue(newTbls[7], 1, getEntryValue(crrTbls[2], 9));
							setEntryData(newTbls[8], 1, getEntryData(crrTbls[2], 10, 2),1,-1);
							//alert("10: " + getEntryData(crrTbls[1], 10, 2));
					//		setEntryValue(newTbls[8], 1, getEntryValue(crrTbls[1], 9));

							if (getEntryValue(crrTbls[2], 13) == 2) { // if put swap labels
								var tmpl = getEntryData(newTbls[8], 1, 1);
								setEntryData(newTbls[8], 1, getEntryData(newTbls[9], 1, 1), 1);
								setEntryData(newTbls[9], 1, tmpl, 1);
							}

							slip.insertBefore(newEntry, crrEntry);
							slip.removeChild(crrEntry);

							// refresh totals section
						//	updateSlipTotals();
							break;
						}
					}
				}
				successWorking = false;

				// refresh balance
//				document.getElementById('header').src = document.getElementById('header').src;
				document.getElementById('header').contentWindow.location.reload();
				}

			function errorOneTouchInSlip(id, choice, msg) {
				var slip = document.getElementById("slip");
				for (var i = 1; i <= slipCount; i++) {
					var crrEntry = getChildOfType(slip, "DIV", i);
					var crrTbls = crrEntry.getElementsByTagName("TABLE");
					if (getEntryLabel(crrTbls[1], 1) == 0) {
						var entId = getEntryValue(crrTbls[1], 1);
						var entChoice = getEntryValue(crrTbls[2], 14);
						if (id == entId && choice == entChoice) {
							setEntryLabel(crrTbls[2], 1, msg);
							if (!isRowOn(crrTbls[2], 1)) {
								toggleRow(crrTbls[2], 1);
							}
							return;
						}
					}
				}
			}

			function unfreezeOneTouchInSlip(id, choice) {
				var slip = document.getElementById("slip");
				for (var i = 1; i <= slipCount; i++) {
					var crrEntry = getChildOfType(slip, "DIV", i);
					var crrTbls = crrEntry.getElementsByTagName("TABLE");
					if (getEntryLabel(crrTbls[1], 1) == 0) {
						var entId = getEntryValue(crrTbls[1], 1);
						var entChoice = getEntryValue(crrTbls[2], 14);
						if (id == entId && choice == entChoice) {
							setEntryData(crrTbls[1], 1, 0, 1); // not submitting

							var mTbl = document.getElementById("markets_table");
							var tbls = mTbl.getElementsByTagName("TABLE");
							var tbody = getChildOfType(tbls[1], "TBODY", 1);
							var i = 5;
							do {
								var row = getChildOfType(tbody, "TR", i);
								if (null != row) {
									var oppId = getOppValue(row, 6);
									if (oppId == id) {
										setEntryValue(crrTbls[2], 3, getOppLevel(row));
										var oppTr = getChildOfType(row, "TD", 2);
										var oppTrTable = getChildOfType(oppTr, "TABLE", 1);
										var oppTrTableBody = getChildOfType(oppTrTable, "TBODY", 1);
										var oppTrTableBodyTr = getChildOfType(oppTrTableBody, "TR", 1);
										var oppTrTableBodyTrTd = getChildOfType(oppTrTableBodyTr, "TD", 1);
										copyLevelColorToSlip(getChildOfType(oppTrTableBodyTrTd, "IMG", 1), crrTbls[2]);
										break;
									}
								} else {
									break;
								}
								i = i + 1;
							} while (true);

							return;
						}
					}
				}
			}

// *********************************************************
// function for homepage movie
// *********************************************************

	var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
	function etrader_fc_DoFSCommand(command, args) {
	var etraderMovieXXXObj = isInternetExplorer ? document.all.etrader_fc : document.etrader_fc;
		if(command=='closeFlash'){
		var objNew = document.getElementById('movie');
		objNew.style.display = 'none';
		if(document.getElementById('assetsTable') != null){
			document.getElementById('assetsTable').style.display=navigator.userAgent.toLowerCase().indexOf("msie") != -1 ? 'block' : 'table-cell';
			document.getElementById('assetsFooter').style.display=navigator.userAgent.toLowerCase().indexOf("msie") != -1 ? 'block' : 'table-cell';
		}else{
			if(document.getElementById('message_table')!= null){
				document.getElementById('message_table').style.display = 'inline';
				document.getElementById('message_table_footer').style.display = 'inline';
			}
		}
	}
}

	function checkMovieCookieOneTouch(){
		var showMovie = false;
		if((checkFirstTimeVisit != null) && (checkFirstTimeVisit != '')) {
				showMovie = true;
				checkFirstTimeVisit = false;
		}
		var movieCookie = document.cookie;
		if( !showMovie ) {
			if(document.getElementById('assetsTable') != null){
				document.getElementById('assetsTable').style.display=navigator.userAgent.toLowerCase().indexOf("msie") != -1 ? 'block' : 'table-cell';
				document.getElementById('assetsFooter').style.display=navigator.userAgent.toLowerCase().indexOf("msie") != -1 ? 'block' : 'table-cell';
			}
			cookieFound=true;
		} else {
			if(document.getElementById('message_table')!= null){
				document.getElementById('message_table').style.display = 'none';
				document.getElementById('message_table_footer').style.display = 'none';
				document.getElementById('movie').style.display='inline';
			}else{
				document.getElementById('movie').style.display='inline';
			}
		}
	}
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub etrader_fc_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call etrader_fc_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}
// ********************************************************
// END OF function needed for the homepage movie (Daniella)
// ********************************************************

	function errorInSlipNotLogin(id, choice) {
		var slip = document.getElementById("slip");
		for (var i = 1; i <= slipCount; i++) {
			var crrEntry = getChildOfType(slip, "DIV", i);
			var crrTbls = crrEntry.getElementsByTagName("TABLE");
			if (getEntryLabel(crrTbls[1], 1) == 0) {
				var entId = getEntryValue(crrTbls[1], 1);
				var entChoice = getEntryValue(crrTbls[2], 14);
				if (id == entId && choice == entChoice) {
					if (!isRowOn(crrTbls[2], 15)) {
						toggleRow(crrTbls[2], 15);
					}
					if (isRowOn(crrTbls[2], 11)) {
						toggleRow(crrTbls[2], 11);
					}
					return;
				}
			}
		}
	}