
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>New Deal</title>
		
		
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8;"/>
		<meta content="JavaScript" name="vs_defaultClientScript"/>
		<meta http-equiv="Pragma" content="no-cache"/>
		<link href='/CSS/Italiano/Deals.css' type="text/css" rel="stylesheet"/>
        
	<script language="javascript" type="text/javascript">
		
		
		
	    function setTR(state)
	    {
			var trThreestep = document.getElementById("mainTbl").getElementsByTagName("tr")[4];
			var trGT = document.getElementById("mainTbl").getElementsByTagName("tr")[2];
			
			switch(state)
			{
				case "threeStep":
					
					
					document.getElementById("tdThreeS_dt").style.background = "url(/img/gen/3_step_deal_on.jpg) no-repeat";
					
					
					document.getElementById("tdThreestep").style.color = "#ffffff";
					
					
					document.getElementById("tdThreestep").className = "tsTitleOn";
					
					trThreestep.style.display = "inline";
					
					document.getElementById("tdGT").style.color = "#2F588F";
					
					document.getElementById("tdGT").className = "gtTitleOff";
					document.getElementById("divGT").style.display = "none";
					//gtTitle 3sTitle
					trGT.style.display = "none";
					document.getElementById("divGT").innerHTML = "";
					
					break;
					
				case "GT":
					//var lang = "Italiano";
					//var regUrl;
					//regUrl = escape("http://www.iforex.com/emerp/landing/masterLP/regLP.aspx?lang=" + lang + "&content=account_type_std&ct=1");
					
					
					
					document.getElementById("tdThreeS_dt").style.background = "url(/img/gen/gaided_tour_on.jpg) no-repeat";
					
					document.getElementById("tdGT").style.color = "#ffffff";
					
					document.getElementById("tdGT").className = "gtTitleOn";
					
					document.getElementById("divGT").style.display = "inline";
					trGT.style.display = "inline";
					//var so = new SWFObject("/IF-tut-TG.swf", "mymovie", "404", "282", "8", "#000000");
					//so.addVariable("clickTag", regUrl); 
					so.write("divGT");
					document.getElementById("tdThreestep").style.color = "#2F588F";
					trThreestep.style.display = "none";
					document.getElementById("tdThreestep").className = "tsTitleOff";
					//document.getElementById("mainTbl").bgColor = "#000000";
					
					break;
			}
	    }
	    
	    //var doc = document.all;
	    
	    var SLmode="SPOT"; //USD,SPOT,PCT
        var TPmode="SPOT"; //USD,SPOT,PCT
		var focusPct = false;
		
		function SetSLmode(obj,Mode)
        {
            if(obj.id.indexOf("PCT") > -1)
            {
                
                focusPct = true;
            }
            else
            {
                focusPct = false;
            }
                
            
            
	        if(optSet)
	        
	        {    
	         
	            
	            document.all.txtSLUSD.style.backgroundColor=(Mode=="USD")?"ivory":"white";
	         
	            document.all.txtSLPCT.style.backgroundColor=(Mode=="PCT")?"ivory":"white";
	            document.all.txtSL.style.backgroundColor=(Mode=="SPOT")?"ivory":"white";
	           
	            /*document.all.txtSLUSD.value="";
	            document.all.txtSLPCT.value="";
	            document.all.txtSL.value="";
	            document.all.txtUSD1.value="";*/
	            
	            obj.style.backgroundColor=(Mode=="SPOT")?"ivory":"white";
	            
	            
	            SLmode=Mode;
	            
	        }
	        
	        
        }
        
        var slInterval = 1000;
        var vSLFlash;
        var vTPFlash;
        function startFlash(fType)
        {
            switch(fType)
            {
                case "SL":
                    vSLFlash = setInterval(flashSL,slInterval);
                    break;  
                case "TP":
                    vTPFlash = setInterval(flashTP,slInterval);
                    break;  
            }
            
        }
        function flashSL()
        {
            var tmpBorder = getel("txtSL").style.border;
            getel("txtSL").style.border = (tmpBorder == "#829eb3 1px solid") ? "red 1px solid":"#829eb3 1px solid";
        }
        function flashTP()
        {
            var tmpBorder = getel("txtTP").style.border;
            getel("txtTP").style.border = (tmpBorder == "#829eb3 1px solid") ? "red 1px solid":"#829eb3 1px solid";
        }
        function stopFlash(fType)
        {
            switch(fType)
            {
                case "SL":
                    getel("txtSL").style.border = "#829eb3 1px solid";
                    clearInterval(vSLFlash);
                    break;
                case "TP":
                    getel("txtTP").style.border = "#829eb3 1px solid";
                    clearInterval(vTPFlash);
                    break;
            }
            
            
        }
        
        function SetTPmode(obj,Mode)
        {
            if(obj.id.indexOf("PCT") > -1)
            {
                
                focusPct = true;
            }
            else
            {
                focusPct = false;
            }
              
	        if(optSet)
	        {
	            document.all.txtTPUSD.style.backgroundColor=(Mode=="USD")?"ivory":"white";
	            document.all.txtTPPCT.style.backgroundColor=(Mode=="PCT")?"ivory":"white";
	            document.all.txtTP.style.backgroundColor=(Mode=="SPOT")?"ivory":"white";
	            /*document.all.txtTPUSD.value="";
	            document.all.txtTPPCT.value="";
	            document.all.txtTP.value="";	
	            
	            document.all.txtUSD2.value="";*/
	            obj.style.backgroundColor=(Mode=="SPOT")?"ivory":"white";
	            
	            TPmode=Mode;	
	        }
	        
	        
        }
	    
    </script>
    
	</head>
	<body dir='ltr' bottomMargin="0" leftMargin="0" topMargin="0" rightMargin="0">
		<form name="Form1" method="post" action="/scripts/fxnet/DailyDeal.aspx?ifr=1&amp;lang=Italiano&amp;tour=yes" id="Form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTg0MzM1ODc4NmRk" />

			<script language="javascript" src="/scripts/js/deal/libQuotes.js"></script>
			<script language="javascript" src="/scripts/js/deal/format.js"></script>
			<script type="text/javascript" src="/scripts/js/swfobject.js"></script>
			
			
			<table id="mainTbl" cellpadding="0" cellspacing="0" align="center">
				<tr>
					
					
					<td id="tdThreeS_dt" style="width:404px;height:31px;background:url(/img/gen/3_step_deal_on.jpg) no-repeat">
					
					<!--td style="width:404px;height:31px;background:url(/img/gen/gaided_tour_on.gif) no-repeat"-->
					
						<table style="height:100%;width:100%" cellpadding="0" cellspacing="0">
							<tr>
								<td class="tsTitleOn" id="tdThreestep" align="center" onclick="setTR('threeStep')">
									<span id="lbl3sTitle">Posizione in 3 Fasi</span>
								</td>
								<td class="gtTitleOff" id="tdGT" align="center" onclick="setTR('GT')">
									<span id="lblGTTitle">Tour guidato</span>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				
				
				
				<tr id="trGT" style="display:none">
				
					<td valign="top">
						<table cellpadding="0" cellspacing="0">
							<tr>
								<td></td>
								<td id="tdObj">
									<div id="divGT" style="display:none">
										
									</div>
								</td>
							</tr>
							
							
						</table>
						
					</td>
				</tr>
				
				
				
				
				<tr id="trThreeStep">
				
					<td valign="top">
					
						
						<table cellspacing="0" style="width:404px;height:282px;background:url(/img/gen/3_stepDealBG_ltr.jpg) no-repeat" align="center">
						
							<tr>
								<td id="td1" valign="top" style="width:210px;height:242px">
									<table cellSpacing="0" cellPadding="0" style="width:100%">
										<tr>
											<td valign="top">
												<table cellSpacing="0" cellPadding="0" style="width:100%">
													
													<tr>
														<td valign="top">
															<table cellSpacing="0" cellPadding="0">
																<tr>
																	<td colspan="3" style="height:5px"></td>
																</tr>
																<tr>
																	<!--td width="7px" class="tdWidth2"></td-->
																	<td>
																	
																		<img src="/img/gen/1_bulet.gif">
																	
																	</td>
																	<td width="2px"></td>
																	<td class="main paddingFour"><span id="lblCCY" class="txt">Valute</span></td>
																	
																	<td style="padding-bottom:4px" align='Right'>
																		<select name="cmbCCY" onchange="CcyChanged();" language="javascript" id="cmbCCY" class="select">
																			<option selected value="EUR/USD">EUR/USD</option>
																			<option value="GBP/USD">GBP/USD</option>
																			<option value="USD/JPY">USD/JPY</option>
																			<option value="USD/CHF">USD/CHF</option>
																			<option value="USD/CAD">USD/CAD</option>
																			<option value="AUD/USD">AUD/USD</option>
																			<option value="NZD/USD">NZD/USD</option>
																			
																			<option value="USD/NOK">USD/NOK</option>
																			<option value="USD/SEK">USD/SEK</option>
																			<option value="USD/ZAR">USD/ZAR</option>
																			<option value="EUR/JPY">EUR/JPY</option>
																			<option value="EUR/GBP">EUR/GBP</option>
																			<option value="EUR/CHF">EUR/CHF</option>
																			<option value="EUR/AUD">EUR/AUD</option>
																			<option value="EUR/CAD">EUR/CAD</option>
																			<option value="EUR/SEK">EUR/SEK</option>
																			<option value="EUR/NOK">EUR/NOK</option>
																			<option value="EUR/ZAR">EUR/ZAR</option>
																			<option value="GBP/JPY">GBP/JPY</option>
																			<option value="GBP/CHF">GBP/CHF</option>
																			<option value="GBP/AUD">GBP/AUD</option>
																			<option value="AUD/JPY">AUD/JPY</option>
																			<option value="AUD/NZD">AUD/NZD</option>
																			<option value="CHF/JPY">CHF/JPY</option>
																			<option value="ZAR/JPY">ZAR/JPY</option>
																			<option value="SEK/JPY">SEK/JPY</option>
																			<option value="NOK/JPY">NOK/JPY</option>
																			<option value="NOK/SEK">NOK/SEK</option>
																			<option value="NOK/DKK">NOK/DKK</option>
																			<option value="USD/DKK">USD/DKK</option>
																			<option value="XAG/USD">XAG/USD</option>
																			<option value="XAU/USD">XAU/USD</option>
																			
																		</select></td>
																</tr>
															</table>
														</td>
													</tr>
													
													<tr class="trHeightNoIE">
													
														<td></td>
													</tr>
													<tr>
														<td>
															<table height="100%" cellSpacing="0" cellPadding="0">
																<tr>
																	<!--td width="7px" class="tdWidth2"></td-->
																	<td>
																	
																		<img src="/img/gen/2_bulet.gif">
																	
																	</td>
																	<td width="2px"></td>
																	<td class="main paddingFour"><span id="lblAmount" class="txt">Importo in </span><span class="txt" id="dealSizeIn">EUR</span></td>
																	
																	<td class="paddingFour" align='Right'>
																		<select name="cmbAmount" id="cmbAmount" class="select" onchange="if(BuySell){SetDealSummary();}">
																			<option selected value="5,000">5,000</option>
																			<option value="10,000">10,000</option>
																			<option value="25,000">25,000</option>
																			<option value="50,000">50,000</option>
																			<option value="100,000">100,000</option>
																			<option value="150,000">150,000</option>
																			<option value="200,000">200,000</option>
																			<option value="250,000">250,000</option>
																			<option value="500,000">500,000</option>
																			<option value="750,000">750,000</option>
																			<option value="1,000,000">1,000,000</option>
																			<option value="2,000,000">2,000,000</option>
																			<option value="5,000,000">5,000,000</option>
																		</select></td>
																</tr>
															</table>
														</td>
													</tr>
													
													<tr class="trHeightNoIE">
													
													
													<tr>
														<td>
															<table cellSpacing="0" cellPadding="0">
																<tr>
																	<!--td width="7px" class="tdWidth2"></td-->
																	<td>
																	
																		<img src="/img/gen/3_bulet.gif">
																	
																	</td>
																	<td width="2px"></td>
																	<td class="paddingFour"><span id="lblChoose" class="txt">scegli "<b>Vendere</b>" o "<b>Acquistare</b>"</span></td>
																	
																	
																</tr>
															</table>
														</td>
													</tr>
													
													<tr height="7px" class="trHeightTenNoIE">
													
														<td></td>
													</tr>
													<tr>
														<td>
															<table dir="ltr" cellSpacing="0" cellPadding="0">
																<tr>
																	
																	<td style="width:9px"></td>
																	
																	
																	<td vAlign="top">
																		<table id="tblSell" cellSpacing="0" cellPadding="0">
																			
																			<tr>
																				<td>
																					<table cellSpacing="0" cellPadding="0">
																						<tr valign="top">
																							<td><IMG src="/img/gen/arrow_down.gif">
																							</td>
																							
																							<td align="center" id="tdSell" onmouseover="SetBuySellCSS(this,'on','Sell');"  onmouseout="SetBuySellCSS(this,'off','Sell');" onclick="SwitchBuySell('Sell',this);" style="height:52px;width:69px;background:url(/img/gen/SellBut_up.gif) no-repeat;cursor:hand">
																							
																							
																							
																								<table dir="ltr" cellSpacing="0" cellPadding="0">
																									<tr>
																										<td class="tdHeight"></td>
																									</tr>
																									<tr>
																										<!--td width="3"></td-->
																										<td valign="middle" class="lblBuySell paddingOne" id="lblSell" dir='ltr'><span id="lblSellTitle">Vendere@@</span>
																										</td>
																									</tr>
																									<tr>
																										<!--td width="3"></td-->
																										<td align="center" valign="top">
																											<table cellpadding="0" cellspacing="0">
																												<tr>
																													<td class="tdPaddingTop">
																														<table cellpadding="0" cellspacing="0">
																															<tr>
																																
																																<td class="tdHeightNineNoIE"></td>
																																
																															</tr>
																															<tr>
																																<td>
																																	
																																	<input name="txtBid" type="text" value="0.00" maxlength="6" readonly="readonly" id="txtBid" class="lbl_spot_small" />
																																	
																																</td>
																															</tr>
																														</table>
																														
																													</td>
																													<td class="tdPaddingBottom"><input name="txtBidPips" type="text" value="00" maxlength="2" readonly="readonly" id="txtBidPips" class="lbl_spot_big" /></td>
																												</tr>
																												
																											</table>
																										</td>
																										
																									</tr>
																									
																								</table>
																							</td>
																						</tr>
																					</table>
																				</td>
																			</tr>
																		</table>
																	</td>
																	<td style="width:10px"></td>
																	<td vAlign="top">
																		<table id="tblBuy" cellSpacing="0" cellPadding="0">
																			<tr>
																				<td>
																					<table cellSpacing="0" cellPadding="0">
																						<tr valign="top">
																							
																							<td id="tdBuy" onmouseover="SetBuySellCSS(this,'on','Buy');"  onmouseout="SetBuySellCSS(this,'off','Buy');" onclick="SwitchBuySell('Buy',this);" style="height:52px;width:69px;background:url(/img/gen/BuyBut_up.gif) no-repeat;cursor:hand">
																							
																								<table cellSpacing="0" cellPadding="0">
																									<tr>
																										<td class="tdHeight"></td>
																									</tr>
																									<tr>
																										
																										<td valign="middle" class="lblBuySell paddingTwo" id="lblBuy" dir='ltr'><span id="lblBuyTitle">Acquistare </span>
																										</td>
																									</tr>
																									<tr>
																										
																										<td align="center">
																											
																											<table cellpadding="0" cellspacing="0">
																											
																												<tr>	
																													<td style="width:6px"></td>
																													<td class="tdPaddingTop">
																														<table cellpadding="0" cellspacing="0">
																															<tr>
																																
																																<td class="tdHeightNineNoIE"></td>
																																
																															</tr>
																															<tr>
																																
																																<td>
																																	<input name="txtAsk" type="text" value="0.00" maxlength="6" readonly="readonly" id="txtAsk" class="lbl_spot_small" />
																																</td>
																															</tr>
																														</table>
																														
																													</td>
																													<td class="tdPaddingBottom"><input name="txtAskPips" type="text" value="00" maxlength="2" readonly="readonly" id="txtAskPips" class="lbl_spot_big" /></td>
																												</tr>
																											</table>
																										</td>
																									</tr>
																								</table>
																							</td>
																							<td><IMG src="/img/gen/arrow_up.gif">
																							</td>
																						</tr>
																					</table>
																				</td>
																			</tr>
																		</table>
																	</td>
																	
																</tr>
															</table>
														</td>
													</tr>
													
														<tr>
															
															<td style="padding-left:8px" valign="top">
															
																<table cellpadding="0" cellspacing="0">
																	
																	<tr>
																		
																		<td class="tdHeightSevenNoIE"></td>
																		
																		
																	</tr>
																	<tr>
																		<td valign="top" id="tdYTD" class="paddingThree">
																			<span id="lblTrd" class="lblTrd">Dettagli della transazione:</span>
																		</td>
																	</tr>
																	<tr>
																		
																		<td height="6px" class="tdHeightSixNoIE"></td>
																		
																	</tr>
																	<tr>
																		<td valign="top" id="tdYTDmain" style="background-image:url(/img/gen/trede_frame.jpg);width:202px;height:70px">
																			<table cellpadding="0" cellspacing="0" style="width:100%">
																				<tr>
																					<td style="height:6px"></td>
																				</tr>
																				<tr>
																					<td align="center" valign="top" id="lblDealSummary" class="txt" style="display:none;COLOR:black">
																						
																						<div align="center" class="divWidth">
																						 
																							<span id="lblDealSummaryH1">Voglio</span><span style="COLOR:black" class="txtDealSummary" id="lblDealSummary1"></span>
																							<span id="lblDealSummaryH2">e </span><span style="COLOR:black" class="txtDealSummary" id="lblDealSummary2"></span>
																							<span id="lblDealSummaryH3">a </span><span style="COLOR:black" class="txtDealSummary" id="lblDealSummary3"></span>
																						</div>
																						
																						 
																					</td>
																					<td valign="top" class="txt" style="DISPLAY:block;FONT-WEIGHT:bold;COLOR:black" id="lblDealSummaryInit" align="center">
																						
																					</td>
																				</tr>
																			</table>
																		</td>
																	</tr>
																	
																
																
															</table>
											</td>
										</tr>
										
										
										<tr>
											<td id="td4" class="main" width="100%">
												<table cellpadding="0" cellspacing="0">
													<TBODY>
														<tr>
															<td width="20"></td>
															<td>
																</td>
																
														</tr>
												
												</table>
															</td>
														</tr>
															
														</table>
													</td>
												</tr>
											</table>
											</TD>
											
											
												<!--table height="100%" cellSpacing="0" cellPadding="0" width="100%">
													<tr>
														<td style="BACKGROUND-IMAGE: url(/img/deal/lines/dotted_line.gif); BACKGROUND-REPEAT: repeat-y"><img src="/img/deal/lines/dotted_line.gif"></td>
													</tr>
												</table-->
											
											
											<td valign="top" id="td2" height="242px">
												<table cellSpacing="0" cellPadding="0">
													
													<tr>
														<td valign="top">
															<table cellSpacing="0" cellPadding="0">
																<tr>
																	<td class="txt" colspan="3" valign="top">
																		<table cellpadding="0" cellspacing="0">
																			
																			<tr>
																				<td style="width:10px"></td>
																				
																				<td>
																					
																					<img id="imgAr" src="/img/gen/3_step_deal_ar.gif">
																					
																				</td>
																				
																				<td align='Right'>
																					<span id="lblOptional" class="numBullet" style="color:#969696"> Facoltativo</span>
																				</td>
																				<td width="5px" class="tdwidth3"></td>
																				<td style="padding-top:2px"><input disabled type="checkbox" id="chkTPSLEnable" onclick="setEnable()"></td>
																				<td style="padding-top:4px"><span id="lblRelatedOrders" class="txtFour" style="color:#969696;">Ordini connessi</span></td>
																			</tr>
																			
																		</table>
																	</td>
																
															</table>
														</td>
													</tr>
													
													<tr>
														<td>
															<table cellSpacing="0" cellPadding="0" width="100%">
																<tr valign="top">
																	
																	<td class="tdWidth4 tdWidth2"></td>
																	<td class="txt"><input hideFocus style="DISPLAY: none" type="checkbox" name="chkSLEnable"><span id="lblRisk" class="txtRiskPro" style="color:#969696;">Importo a rischio</span>
																		<span id="lblSLEnable" style="color:#969696;font-size:9px;"></span></td>
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														
														<td height="1px" class="tdHeightFiveNoIE"></td>
														
													</tr>
													<tr>
														<td>
															<table cellSpacing="0" cellPadding="0">
																<tr style="color:#969696">
																	<td class="tdWidth2"></td>
																	<td class="txtThree"><span id="lblAmount1">Importo</span></td>
																	<td style="width:5px"></td>
																	<td><input name="txtSLUSD" type="text" maxlength="8" readonly="readonly" id="txtSLUSD" class="txtDeal" onkeydown="checkKeyPress()" onkeyup="SetLimitAmount(event)" onfocus="SetSLmode(this,'USD');" style="border: #CAC8BB 1px solid;" /></td>
																	<td style="width:5px"></td>
																	<td class="txtTwo"><span id="lblOtherCCY1">USD</span></td>
																	
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														
														<td class="tdHeightEightNoIE"></td>
														
													</tr>
													<tr>
														<td>
															<table id="tblVal1" cellSpacing="0" cellPadding="0" style="visibility:hidden">
																<tr style="color:#969696">
																	<td class="tdWidth2"></td>
																	<td class="txtThree"><span id="lblValue1">Valore</span></td>
																	<td style="width:5px"></td>
																	<td><input name="txtUSD1" type="text" readonly="readonly" id="txtUSD1" class="txtDeal" style="border: #CAC8BB 1px solid;background-color:eeeff1" /></td>
																	<td style="width:5px"></td>
																	<td class="txtTwo"><span id="lblIn1">in </span><span id="spnUSD1">USD</span></td>
																	
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														
														<td class="tdHeightEightNoIE"></td>
														
													</tr>
													<tr>
														<td>
															<table id="tblOrAt1" cellSpacing="0" cellPadding="0" style="visibility:hidden">
																<tr style="color:#969696">
																	<td class="tdWidth2"></td>
																	<td class="txtThree"><span id="lblOrAt">O al livello</span></td>
																	<td style="width:5px"></td>
																	<td><input name="txtSL" type="text" maxlength="6" id="txtSL" class="txtDeal" onfocus="SetSLmode(this,'SPOT');" onkeydown="checkKeyPress()" onkeyup="SetLimitAmount(event)" style="border: #CAC8BB 1px solid" /></td>
																	<td style="width:5px"></td>
																	<td class="txtTwo"><span id="bigSmallSL"></span><span id="lblLevel">level</span></td>
																	
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														
														<td class="tdHeightEightNoIE"></td>
														
													</tr>
													<tr>
														<td>
															<table id="tblOr1" cellSpacing="0" cellPadding="0" dir='ltr' style="visibility:hidden">
																<tr style="color:#969696">
																	<td class="tdWidth2"></td>
																	<td class="txtThree"><span id="lblOr">O</span></td>
																	<td style="width:5px"></td>
																	<td><input name="txtSLPCT" type="text" maxlength="8" id="txtSLPCT" class="txtDeal" onkeydown="pctKeyPress(this)" onfocus="SetSLmode(this,'PCT');" onkeyup="SetLimitAmount(event)" style="border: #CAC8BB 1px solid" /></td>
																	<td style="width:5px"></td>
																	<td class="txtTwo"><span id="lblPer">%</span></td>
																	
																</tr>
															</table>
														</td>
													</tr>
													
													<tr>
														<td height="2px" class="trHeightThree"></td>
													</tr>
													<tr id="trTP0">
														<td>
															<table cellSpacing="0" cellPadding="0" width="100%">
																<tr valign="top">
																	
																	<td class="tdWidth4 tdWidth2"></td>
																	<td class="txt"><input hideFocus style="DISPLAY: none" type="checkbox" name="chkTPEnable"><span id="lblWin" class="txtRiskPro" style="color:#969696;">Profitto desiderato</span>
																		<span id="lblTPEnable" style="color:#969696;font-size:9px;"></span></td>
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														<td height="2px" class="trHeightFour"></td>
													</tr>
													<tr id="trTP1">
														<td>
															<table cellSpacing="0" cellPadding="0" dir='ltr'>
																<tr style="color:#969696">
																	<td class="tdWidth2"></td>
																	<td class="txtThree"><span id="lblAmount2">Importo</span></td>
																	<td style="width:5px"></td>
																	<td><input name="txtTPUSD" type="text" maxlength="8" readonly="readonly" id="txtTPUSD" class="txtDeal" onfocus="SetTPmode(this,'USD');" onkeydown="checkKeyPress()" onkeyup="SetLimitAmount(event)" style="border: #CAC8BB 1px solid;" /></td>
																	<td style="width:5px"></td>
																	<td class="txtTwo"><span id="lblOtherCCY2">USD</span></td>
																	
																</tr>
															</table>
															
														</td>
													</tr>
													
													<tr>
														
														<td class="tdHeightEightNoIE"></td>
														
													</tr>
													<tr>
														<td>
															<table id="tblVal2" cellSpacing="0" cellPadding="0" dir='ltr' style="visibility:hidden">
																<tr style="color:#969696">
																	<td class="tdWidth2"></td>
																	<td class="txtThree"><span id="lblValue2">Valore</span></td>
																	<td style="width:5px"></td>
																	<td><input name="txtUSD2" type="text" readonly="readonly" id="txtUSD2" class="txtDeal" style="border: #CAC8BB 1px solid;background-color:e9eaec" /></td>
																	<td style="width:5px"></td>
																	<td class="txtTwo"><span id="lblIn2">in </span><span id="spnUSD2">USD</span></td>
																	
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														
														<td class="tdHeightEightNoIE"></td>
														
													</tr>
													<tr>
														<td>
															<table id="tblOrAt2" cellSpacing="0" cellPadding="0" dir='ltr' style="visibility:hidden">
																<tr style="color:#969696">
																	<td class="tdWidth2"></td>
																	<td class="txtThree"><span id="lblOrAt3">O al livello</span></td>
																	<td style="width:5px"></td>
																	<td><input name="txtTP" type="text" maxlength="6" id="txtTP" class="txtDeal" onfocus="SetTPmode(this,'SPOT');" onkeydown="checkKeyPress()" onkeyup="SetLimitAmount(event)" style="border: #CAC8BB 1px solid" /></td>
																	<td style="width:5px"></td>
																	<td class="txtTwo"><span id="bigSmallTP"></span><span id="lblLevel2">level</span></td>
																	
																</tr>
															</table>
														</td>
													</tr>
													<tr>
														
														<td class="tdHeightEightNoIE"></td>
														
													</tr>
													<tr>
														<td>
															<table id="tblOr2" cellSpacing="0" cellPadding="0" dir='ltr' style="visibility:hidden">
																<tr style="color:#969696">
																	<td class="tdWidth2"></td>
																	<td class="txtThree"><span id="lblOr3">O</span></td>
																	<td style="width:5px"></td>
																	<td><input name="txtTPPCT" type="text" maxlength="8" id="txtTPPCT" class="txtDeal" onfocus="SetTPmode(this,'PCT');" onkeydown="pctKeyPress(this)" onkeyup="SetLimitAmount(event)" style="border: #CAC8BB 1px solid" /></td>
																	<td style="width:5px"></td>
																	<td class="txtTwo"><span id="lblPer2">%</span></td>
																	
																</tr>
															</table>
														</td>
													</tr>
												</table>
											</td>
											<tr>
				<td colspan="2" id="td3" style="height:40px;padding-top:2px" align="center" valign="top"><input type="submit" name="btnOK" value="Esegui" onclick="runRegister(this);return false;" language="javascript" id="btnOK" class="btnOK" onmouseover="btnCImg(this,'on')" onmouseout="btnCImg(this,'off')" style="background:url(/img/gen/tnBut_up.gif);" /></td>
			</tr>
			</TR>
			
			</TBODY></TABLE></TD></TR>
			
			</TBODY></TABLE>
			
			<div style="DISPLAY: none; VISIBILITY: hidden"><span id="lblDescCCY1">EUR</span><span id="lblDescCCY2">USD</span></div>
			<INPUT id="rbBuySell" type="hidden" name="rbBuySell">
		
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWDgK2mJeDCwL/+tK0AQL7lcqvDgKZ+5KQCgKVncr0DgKHnfSqAgLy46KVBwKk+46NBAK3sJ0xApud4NYHAqGoydUIArj7+rELAsuwid0FAt2SmY8B" /></form>
		<script>
//GUI Control		
function getel(id){return document.getElementById(id);}
var globBuySell="none";
var str11=getel("lblSellTitle").innerHTML;

//var doc=document.Form1.all;


var bt=XReplace(getel("lblBuyTitle").innerHTML," ","");
var st=XReplace(getel("lblSellTitle").innerHTML," ","");
var ccy=getel("cmbCCY").options[getel("cmbCCY").selectedIndex].value;

var ccypair=ccy.split("/");
var BuySell;
var sellButIsPushed = false;
var buyButIsPushed = false;


getel("lblSellTitle").innerHTML=getel("lblSellTitle").innerHTML.replace("@@","<BR>")+ccypair[0];

getel("lblBuyTitle").innerHTML=getel("lblBuyTitle").innerHTML.replace("@@","<BR>")+ ccypair[0];


try{
	//window.parent.qImport.src=window.parent.qURL+"?type="+window.parent.qType+"&ccy="+ccy;
	window.parent.callJS();
}catch(e){
}



function SwitchBuySell(pBuySell,obj)
{
	//getel("tdYTD").style.display = "inline";
	
	switch(pBuySell)
	{
		
		case 'Buy':
			globBuySell="buy";
			
			obj.style.background = "url(" + imgBuyBut_down.src + ") no-repeat";			
			document.getElementById("tdSell").style.background = "url(/img/gen/SellBut_up.gif) no-repeat";
			
			
			sellButIsPushed = false;
			buyButIsPushed = true; 
			setInnerText(getel("bigSmallSL"),"<");
			setInnerText(getel("lblLevel"),getel("txtBid").value + getel("txtBidPips").value);
			setInnerText(getel("bigSmallTP"),">");
			setInnerText(getel("lblLevel2"),getel("txtAsk").value + getel("txtAskPips").value);
		break;
		case 'Sell':
			globBuySell="sell";
			
			obj.style.background = "url(" + imgSellBut_down.src + ") no-repeat";
			document.getElementById("tdBuy").style.background = "url(/img/gen/BuyBut_up.gif) no-repeat";			
			
			
			sellButIsPushed = true;
			buyButIsPushed = false; 
			
			setInnerText(getel("bigSmallSL"),">");
			setInnerText(getel("lblLevel"),getel("txtAsk").value + getel("txtAskPips").value);
			setInnerText(getel("bigSmallTP"),"<");
			setInnerText(getel("lblLevel2"),getel("txtBid").value + getel("txtBidPips").value);
		break;
		default:
			globBuySell="";
			
		break;			
	}
		
	getel("rbBuySell").value=pBuySell;		
	BuySell=pBuySell;	
	
	if(BuySell)
	{		
		SetDealSummary();
	}
	setOptionalSide();
	if(getel("txtSLUSD").value != "" || getel("txtTPUSD").value != "")
    {
        
        SetLimitAmount(event);
    }	
}
var optSet = false;	

function clearTxt()
{
    getel("txtSLUSD").value = "";
    getel("txtUSD1").value = "";
    getel("txtUSD2").value = "";
    getel("txtSL").value = "";
    getel("txtSLPCT").value = "";
    getel("txtTPUSD").value = "";
    getel("txtTP").value = "";
    getel("txtTPPCT").value = "";
    getel("txtUSD1").value = "";
    getel("txtUSD2").value = "";
}
	
function setOptionalSide()
{
    optSet = true;
    getel("txtSLUSD").readOnly = "";
    getel("txtSL").readOnly = "";
    getel("txtSLPCT").readOnly = "";
    getel("txtTPUSD").readOnly = "";
    getel("txtTP").readOnly = "";
    getel("txtTPPCT").readOnly = "";
    getel("lblOptional").style.color = "#436ba0";
    getel("lblRelatedOrders").style.color = "Black";
    getel("lblRisk").style.color = "#538ba7";
    getel("lblSLEnable").style.color = "#538ba7";
    getel("lblWin").style.color = "#538ba7";
    getel("lblTPEnable").style.color = "#538ba7";
    getel("lblAmount1").style.color = "Black";
    getel("lblAmount2").style.color = "Black";
    getel("lblValue1").style.color = "Black";
    getel("lblValue2").style.color = "Black";
    getel("lblOrAt").style.color = "Black";
    getel("lblOrAt3").style.color = "Black";
    getel("lblOr").style.color = "Black";
    getel("lblOr3").style.color = "Black";
    getel("lblOtherCCY1").style.color = "Black";
    getel("lblOtherCCY2").style.color = "Black";
    getel("lblIn1").style.color = "Black";
    getel("lblIn2").style.color = "Black";
    getel("bigSmallSL").style.color = "Black";
    getel("bigSmallTP").style.color = "Black";
    getel("lblLevel").style.color = "Black";
    
    getel("lblLevel2").style.color = "Black";
    getel("lblPer").style.color = "Black";
    getel("lblPer2").style.color = "Black";
    getel("spnUSD1").style.color = "Black";
    getel("spnUSD2").style.color = "Black";
   
    getel("txtSLUSD").style.borderColor = "#829EB3";
    getel("txtUSD1").style.borderColor = "#829EB3";
    getel("txtUSD2").style.borderColor = "#829EB3";
    getel("txtSL").style.borderColor = "#829EB3";
    getel("txtSLPCT").style.borderColor = "#829EB3";
    getel("txtTPUSD").style.borderColor = "#829EB3";
    getel("txtTP").style.borderColor = "#829EB3";
    getel("txtTPPCT").style.borderColor = "#829EB3";
    getel("chkTPSLEnable").disabled = "";
    
        getel("imgAr").src = "/img/gen/3_step_deal_ar_blue.gif";
    
           
}
function resetOptional()
{
    getel("tblVal1").style.visibility = "hidden";
    getel("tblOrAt1").style.visibility = "hidden";
    getel("tblOr1").style.visibility = "hidden";
    getel("tblVal2").style.visibility = "hidden";
    getel("tblOrAt2").style.visibility = "hidden";
    getel("tblOr2").style.visibility = "hidden";
    getel("chkTPSLEnable").checked = false;
    getel("lblOptional").style.color = "#969696";
    getel("lblRelatedOrders").style.color = "#969696";
    getel("lblRisk").style.color = "#969696";
    getel("lblSLEnable").style.color = "#969696";
    getel("lblAmount1").style.color = "#969696";
    getel("lblOtherCCY1").style.color = "#969696";
    getel("lblWin").style.color = "#969696";
    getel("lblTPEnable").style.color = "#969696";
    getel("lblAmount2").style.color = "#969696";
    getel("lblOtherCCY2").style.color = "#969696";
    getel("txtSLUSD").readOnly = true;
    getel("txtTPUSD").readOnly = true;
    
        getel("imgAr").src = "/img/gen/3_step_deal_ar.gif";
    
    getel("txtSLUSD").style.border = "#cac8bb 1px solid";
    getel("txtTPUSD").style.border = "#cac8bb 1px solid";
    getel("chkTPSLEnable").disabled = "disabled";
}
function setEnable()
{
    if(getel("chkTPSLEnable").checked)
    {
        getel("tblVal1").style.visibility = "visible";
        getel("tblOrAt1").style.visibility = "visible";
        getel("tblOr1").style.visibility = "visible";
        getel("tblVal2").style.visibility = "visible";
        getel("tblOrAt2").style.visibility = "visible";
        getel("tblOr2").style.visibility = "visible";
         
    }
    else
    {
        getel("tblVal1").style.visibility = "hidden";
        getel("tblOrAt1").style.visibility = "hidden";
        getel("tblOr1").style.visibility = "hidden";
        getel("tblVal2").style.visibility = "hidden";
        getel("tblOrAt2").style.visibility = "hidden";
        getel("tblOr2").style.visibility = "hidden";
    }
}


function setInnerText(obj,txt)
{
	if(navigator.appName == "Netscape")
	{
		obj.textContent = txt;
	}
	else
	{
		obj.innerText = txt;
	}
}


function SetBuySellCSS(ctlpips,dir,state)
{
	
	
	if(state == "Sell")
	{
		if(!sellButIsPushed)
		{
			switch(dir){
				case "off":
					 
					 ctlpips.style.background = "url(" + imgSellBut_up.src + ") no-repeat";break;
					 
					 //ctlpips.style.background = "url(" + imgBuyBut_over.src + ") no-repeat";break;
					 
				case "on": 
					
					ctlpips.style.background = "url(" + imgSellBut_over.src + ") no-repeat";break;
					
					//ctlpips.style.background = "url(" + imgBuyBut_over.src + ") no-repeat";break;
					
				
			}
			
		}
	}
	else
	{
		if(!buyButIsPushed)
		{
			switch(dir){
				case "off":
					
					ctlpips.style.background = "url(/img/gen/BuyBut_up.gif) no-repeat";break;
					
					//ctlpips.style.background = "url(/img/gen/SellBut_up.gif) no-repeat";break;
					
				case "on":
					
					ctlpips.style.background = "url(/img/gen/BuyBut_over.gif) no-repeat";break;
					
					//ctlpips.style.background = "url(/img/gen/SellBut_over.gif) no-repeat";break;
					
			}
			
		}
	}
	
}
var QL=new clsQuoteList();
var interval=2000;

document.body.onload = function(){
	try{
		if(setbuysell)SwitchBuySell(setbuysell);
		var root=location.protocol+"//"+location.host;
		//ws.useService(root+"/scripts/fxnet/deal_quotes.asmx?WSDL","WSQ");
		GetQuotes();
		getel("lblSell").innerHTML += " " + ccypair[0];
		getel("lblBuy").innerHTML += " " + ccypair[0];
		
		//window.parent.dailyCCY=ccy;	
	}catch(ex){
		return(0);
	}
//var dInt=setInterval("GetQuotes()",interval);	
}
function GetQuotes(){
	
	
	try{
		var dres=window.parent.dailyRes;	
			
		if(typeof(dres)!="undefined"){
			if(dres!=""){UpdateQuotes(dres);}
		}else{
		}
		if(BuySell)
		{
		
		}
	}catch(ex){	
		return(0);
	}
}

function validKey(key)
{
    
    
    var none = (key == 0);
	var isDelete = (key==46);
	var isArrowBack=(key==37);
	var isArrowFW=(key==39);
	var isKeyBackspace = (key == 8); 
	var isTab=(key==9);
	var isNum= ((key>=48 && key<=57)||(key>=96 && key<=105));
	var isSpace = (key == 32);
	var isDot = ((key == 190)||(key == 110));
	
	var res = (none || isDelete || isArrowBack || isArrowFW || isKeyBackspace || isTab || isNum || isSpace || isDot);
	return(res);
}

function pctKeyPress(obj){
    
    var iKeyCode = event.keyCode; 
	var bDelete = (iKeyCode==46);
	var bArrowBack=(iKeyCode==37);
	var bArrowFW=(iKeyCode==39);
	var bKeyBackspace = (iKeyCode == 8); 
	var bTab=(iKeyCode==9);
	var bIsLetter= (iKeyCode>=65 && iKeyCode<=90);
	var space = (iKeyCode == 32); 
    var splitVal = obj.value.split('.');
   
    if(!validKey(iKeyCode))
    {
        event.cancelBubble = true;
        event.returnValue = false;
        return false;
    }
    
    else
    {
        
        if(!focusPct)
        {
            if(splitVal.length == 2)
            {
               if((splitVal[1].length == 2) && !(bKeyBackspace||bDelete||bArrowBack||bArrowFW||bTab))
                {
                    
                    event.cancelBubble = true;
	                event.returnValue = false;
	                return false;
                } 
                
                   
            }
        
        }
        focusPct = false;
    }
					
}

function checkKeyPress()
{
    if(!validKey(event.keyCode))
    {
        event.cancelBubble = true;
        event.returnValue = false;
        return false;
    }
}

var gBid;
var gAsk;
function SetLimitAmount(event)
{
    
    

   
    if(validKey(event.keyCode) && event.keyCode != 9 && event.keyCode != 37 && event.keyCode != 39)
    { 
        if(BuySell)
        {
            var SL=0;
            var TP=0;
            var pctsl=0;
            var pcttp=0;
            var amntsl=0;
            var amnttp=0;
           
            
           
          

            gAsk = document.getElementById("txtAsk").value + document.getElementById("txtAskPips").value;
         
            gBid = document.getElementById("txtBid").value + document.getElementById("txtBidPips").value;
           
            var rate=(BuySell=="Sell")?gBid:gAsk;
            if(rate==0)rate=1;
            var amount=document.getElementById("cmbAmount").options[document.getElementById("cmbAmount").selectedIndex].value;
            amount=XReplace(amount,",","");
          
	        switch(TPmode)
	        { 
		        case "USD":
		        
			        if(IsNumeric(document.getElementById("txtTPUSD").value))
				        {SetTPSLValues_USD(document.getElementById("txtTP"),document.getElementById("txtTPPCT"),document.getElementById("txtTPUSD"),rate,amount,"TP",document.getElementById("txtUSD2"));}
			        else
				        {
				            document.getElementById("txtTPPCT").value="";
				            document.getElementById("txtTP").value="";
				            document.getElementById("txtUSD2").value="";
				            stopFlash("TP");
				        
				        }
		        break;
		        case "SPOT":
		         		
			        if(IsNumeric(document.getElementById("txtTP").value))
				        {
				        SetTPSLValues_SPOT(document.getElementById("txtTP"),document.getElementById("txtTPPCT"),document.getElementById("txtTPUSD"),rate,amount,"TP",document.getElementById("txtUSD2"));}
			        else
				       
				        
				            document.getElementById("txtTPPCT").value="";
				            document.getElementById("txtTPUSD").value="";
				            document.getElementById("txtUSD2").value="";
				            stopFlash("TP");
				             {
				 
				        		
				        	 }	
		        break;	
		        case "PCT":
			        if(IsNumeric(document.getElementById("txtTPPCT").value))
				        {SetTPSLValues_PCT(document.getElementById("txtTP"),document.getElementById("txtTPPCT"),document.getElementById("txtTPUSD"),rate,amount,"TP",document.getElementById("txtUSD2"));
				        
				        }
			        else
				        {
				      
				            document.getElementById("txtTP").value="";
				            document.getElementById("txtTPUSD").value="";
				            document.getElementById("txtUSD2").value="";
				            stopFlash("TP");
				        	
				        	}
				            
		        break;
	        }	
	        //
	       
	        switch(SLmode)
	        {
		        case "USD":
		      
		        
		        //alert(isNaN(document.getElementById("txtSLUSD").value))
			        if(IsNumeric(document.getElementById("txtSLUSD").value))
				        {
				        SetTPSLValues_USD(document.getElementById("txtSL"),document.getElementById("txtSLPCT"),document.getElementById("txtSLUSD"),rate,amount,"SL",document.getElementById("txtUSD1"));}
			        else
				        {
				            document.getElementById("txtSLPCT").value="";
				            document.getElementById("txtSL").value="";
				            document.getElementById("txtUSD1").value="";
				            stopFlash("SL");
				        
				         }
		        break;
		        case "SPOT":	
		       	
			        if(IsNumeric(document.getElementById("txtSL").value))
				        {
				        SetTPSLValues_SPOT(document.getElementById("txtSL"),document.getElementById("txtSLPCT"),document.getElementById("txtSLUSD"),rate,amount,"SL",document.getElementById("txtUSD1"));}
			        else
				        {
				            document.getElementById("txtSLPCT").value="";
				            document.getElementById("txtSLUSD").value="";
				            document.getElementById("txtUSD1").value="";
				            stopFlash("SL");
				        
				         }
		        break;			
		        case "PCT":
		       
			        if(IsNumeric(document.getElementById("txtSLPCT").value))
				        {
				        SetTPSLValues_PCT(document.getElementById("txtSL"),document.getElementById("txtSLPCT"),document.getElementById("txtSLUSD"),rate,amount,"SL",document.getElementById("txtUSD1"));}
			        else
				        {
				            document.getElementById("txtSL").value="";
				            document.getElementById("txtSLUSD").value="";
				            document.getElementById("txtUSD1").value="";
				            stopFlash("SL");
				         
				          }
		        break;
	        }
    	    
    	    
	        if(getel("txtSLUSD").value != "")
	        { 
	            getel("txtUSD1").value = FormatRate(getVal(getCCYType(),getel("txtSLUSD").value),4);
	        }
	        if(getel("txtTPUSD").value != "")
	        {
	            getel("txtUSD2").value = FormatRate(getVal(getCCYType(),getel("txtTPUSD").value),4);
	        }
        }
    }
   
    //currentObj.focus()
    	
}



function SetTPSLValues_SPOT(ctlspot,ctlpct,ctlamount,rate,amount,sltp,ctltousd)
{
if(ctlspot.value)
	{
	var SPOT,PCT,amnt,usdamount;
	SPOT=ctlspot.value;
	
	if(SPOT!=rate)
		PCT=100/rate*Math.abs(rate-SPOT);
	else
		PCT=0;	
	
	PCT=PCT.toFixed(2);
	amnt=Math.abs(rate-SPOT)*amount;
	//CountApproxUSD(amnt,qu,ctltousd,rate);
	ctlamount.value=FormatAmount(amnt,false);
	
	//ctlspot.value=Math.round(SPOT*100)/100 ;
	ctlspot.value=SPOT ;
	if(ctlspot.id == "txtSL")
	{
	    setFlashMode(SPOT,getel("bigSmallSL").innerText,"SL",getel("lblLevel").innerText);
	}
	else
	{
	    setFlashMode(SPOT,getel("bigSmallTP").innerText,"TP",getel("lblLevel2").innerText);
	}
	
	ctlpct.value=FormatPCT(PCT);
			
	}
}

function setFlashMode(SPOT,sign,type,PCT)
{
    switch(sign)
    {
        case "<":
            if(SPOT > PCT)
            {
                stopFlash(type);
                startFlash(type);
            }
            else
            {
                stopFlash(type);
            }
            break;
        case ">":
            if(SPOT < PCT)
            {
                stopFlash(type);
                startFlash(type);
            }
            else
            {
                stopFlash(type);
            }
            break;
    }
    
    
}
function SetTPSLValues_USD(ctlspot,ctlpct,ctlamount,rate,amount,sltp,ctltousd)
{

//alert("ctlamount.value: "+ctlamount.value)
    if(ctlamount.value)
	{
	    var SPOT,PCT,amnt,usdamount;
	    amnt=ctlamount.value;
	    amnt=XReplace(amnt,",","");

	    if(amnt<=0||amount<=0)
	    {
		    ctlamount.value="";
		    ctlamount.focus();
	    }
    	
	    if((sltp=="TP"&&BuySell=="Buy")||(sltp=="SL"&&BuySell=="Sell"))
	    {
		    SPOT=ToFloatRate(parseFloat(rate)+parseFloat(amnt/amount));
		    if(ctlamount.id == "txtSLUSD")
		    {
                setFlashMode(SPOT,getel("bigSmallSL").innerText,"SL",getel("lblLevel").innerText);
    		    
		    }
		    else
		    {
		        setFlashMode(SPOT,getel("bigSmallTP").innerText,"TP",getel("lblLevel2").innerText);
    		   
		    }
	    }
	    if((sltp=="SL"&&BuySell=="Buy")||(sltp=="TP"&&BuySell=="Sell"))
	    { 
		    SPOT=ToFloatRate(parseFloat(rate)-parseFloat(amnt/amount));	
		    if(ctlamount.id == "txtSLUSD")
		    {
		        setFlashMode(SPOT,getel("bigSmallSL").innerText,"SL",getel("lblLevel").innerText);
    		   
		    }
		    else
		    {
		        setFlashMode(SPOT,getel("bigSmallTP").innerText,"TP",getel("lblLevel2").innerText);
    		    
		    }
	    }
    	
	    //CountApproxUSD(amnt,qu,ctltousd,rate);
    	
	    PCT=Math.abs(SPOT/rate-1)*100;
    
	    PCT = Math.round(PCT*100)/100;
    	
	    //ctlspot.value=Math.round(FormatRate(SPOT,4)*100)/100 ;
	    ctlspot.value=FormatRate(SPOT,4);
    	
    	
	    ctlpct.value=FormatPCT(PCT);
	
	}
	
	
	
}

function getVal(typeVal,sum)
{
    var res;
    switch(typeVal)
    {
        case "1":
            var dRes = window.parent.dailyRes.split("#");
            if(BuySell == "Buy")
            {
                res = sum/parseFloat(dRes[1]);
            }
            else
            {
                res = sum/parseFloat(dRes[0]);
            }
           break;
        
        case "2":
            res = sum;
            break;
        
        case "3":
            var dRes = window.parent.dailyResCCY.split("#");
            if(BuySell == "Buy")
            {
                res = sum*parseFloat(dRes[1]);
            }
            else
            {
                res = sum*parseFloat(dRes[0]);
            }
            break;
            
        case "4":
            
            var dRes = window.parent.dailyResCCY.split("#");
            if(BuySell == "Buy")
            {
                res = sum/parseFloat(dRes[1]);
            }
            else
            {
                res = sum/parseFloat(dRes[0]);
            }
            break;
            
        
             
    }
    
    return(res);
    

}

function getCCYType()
{
    
    var strCCY = (getel("cmbCCY").value).split("/");
    if(strCCY[0] == "USD") // USD/CCY2
    {
        return("1");
        
    }
    if(strCCY[1] == "USD") // CCY1/USD
    {
        return("2");
    }
    if(isCCY1(strCCY[0]) && isCCY1(strCCY[1])) //CCY1/CCY1
    {
        
        return("3");
    }
    
    return("4"); //CCY1/CCY2 - CCY2/CCY2
    
}

var arrCCY = new Array(6);
arrCCY[0] = "EUR";
arrCCY[1] = "GBP";
arrCCY[2] = "AUD";
arrCCY[3] = "NZD";
arrCCY[4] = "XAG";
arrCCY[5] = "XAU";

function isCCY1(strCCY)
{
    var res = false;
    for(var i=0;i<arrCCY.length;i++)
    {
        if(arrCCY[i] == strCCY)
        {
            res = true;
            break;
        }
    }
    return(res);
    
}

function CountApproxUSD(amnt,qu,ctltousd,rate)
{
    var usdamount;
    var ccy=document.getElementById("cmbCCY").options[document.getElementById("cmbCCY").selectedIndex].value;
    ccy=document.getElementById("cmbCCY").options[document.getElementById("cmbCCY").selectedIndex].value;
 
    ccypair=ccy.split("/"); 

	if(ccypair[0]!="USD"&&ccypair[1]!="USD")
		{
			usdamount=(qu.CCY1!="USD")?(amnt*qu.Bid):(amnt/qu.Ask);
			ctltousd.value=FormatAmount(usdamount,false);
		}
		else
		{
			if(ccypair[1]!="USD")
			{
				usdamount=amnt/rate;			
				ctltousd.value=FormatAmount(usdamount,false);
			}
		}	
}
function SetTPSLValues_PCT(ctlspot,ctlpct,ctlamount,rate,amount,sltp,ctltousd)
{
	if(ctlpct.value)
	{
		var SPOT,PCT,amnt,usdamount;
		PCT=ctlpct.value;
        	
		if(sltp=="TP")
		{
			if(getel("bigSmallTP").innerText == "<")
			{
			    SPOT = rate*(1-0.01*PCT);
			    setFlashMode(SPOT,"<","TP",getel("lblLevel2").innerText);
			    
			}
			else
			{
			    SPOT = rate*(1+0.01*PCT);
			    setFlashMode(SPOT,">","TP",getel("lblLevel2").innerText);
			    
			}
			//SPOT=(getel("bigSmallTP").innerText=="<")?(rate*(1-0.01*PCT)):(rate*(1+0.01*PCT));
			
		}
		else
		{
		    if(getel("bigSmallSL").innerText == "<")
			{
			    SPOT = rate*(1-0.01*PCT);
			    setFlashMode(SPOT,"<","SL",getel("lblLevel").innerText);
			    
			}
			else
			{
			    SPOT = rate*(1+0.01*PCT);
			    setFlashMode(SPOT,">","SL",getel("lblLevel").innerText);
			    
			}
			//SPOT=(getel("bigSmallSL").innerText=="<")?(rate*(1-0.01*PCT)):(rate*(1+0.01*PCT));
		}
		
		SPOT=RoundRate(SPOT);
		
		amnt=RoundRate(Math.abs(rate-SPOT))*amount;
		//CountApproxUSD(amnt,qu,ctltousd,rate);
		
		ctlamount.value=FormatAmount(amnt,false);
		ctlspot.value=FormatRate(SPOT,4);
		
	    ctlpct.value=PCT;		
	}
}

function BidValue(val)
{
	if(val!="")
	{
		if(BidValue("")*1<val*1){getel("txtBid").style.color="#006600";getel("txtBidPips").style.color="#006600";}
		if(BidValue("")*1>val*1){getel("txtBid").style.color="#990000";getel("txtBidPips").style.color="#990000";}
		if(BidValue("")*1==val*1){getel("txtBid").style.color="#113260";getel("txtBidPips").style.color="113260";}
		var b=FormatRate(val,4);
		getel("txtBid").value=b.substr(0,4);	
		getel("txtBidPips").value=b.substr(4,2);
		if(buyButIsPushed || sellButIsPushed)
		{
			if(buyButIsPushed)
			{
				setInnerText(getel("lblLevel"),b);
			}
			else
			{
				setInnerText(getel("lblLevel2"),b);
			}
		}
	}
	return(getel("txtBid").value+""+getel("txtBidPips").value);
}

function AskValue(val)
{


	if(val!="")
	{
		if(AskValue("")*1<val*1){getel("txtAsk").style.color="#006600";getel("txtAskPips").style.color="#006600";}
		if(AskValue("")*1>val*1){getel("txtAsk").style.color="#990000";getel("txtAskPips").style.color="#990000";}
		if(AskValue("")*1==val*1){getel("txtAsk").style.color="#113260";getel("txtAskPips").style.color="113260";}
		var a=FormatRate(val,4);	
		getel("txtAsk").value=a.substr(0,4);
			
		getel("txtAskPips").value=a.substr(4,2);
	
	
		if(buyButIsPushed || sellButIsPushed)
		{
			if(buyButIsPushed)
			{
				setInnerText(getel("lblLevel2"),a);
			}
			else
			{
				setInnerText(getel("lblLevel"),a);
				
			}
		}	
	} 


	return(getel("txtAsk").value+""+getel("txtAskPips").value);
}

var flashint;
function FlashButton()
{try{
	FlashStop();
	flashint=window.setInterval("FlashStyle();",250);
	window.setTimeout("FlashStop();",5000);
	}catch(ex){}
}

function FlashStyle()
{try{
	var btn=getel("btnOK");
	if(btn.className=="btnDeal")
		btn.className="btnDeal_flash";
	else
		btn.className="btnDeal";
	}catch(ex){}
}
function FlashStop()    
{try{
	window.clearInterval(flashint);
	window.setTimeout("getel('btnOK').className='btnDeal';",200);
	}catch(ex){}
}

function UpdateQuotes(res){
try{
	var bidVal=res.split("#")[0];
	var askVal=res.split("#")[1];
	BidValue(bidVal);
	AskValue(askVal);
	
	//CountLimitAmounts();
	if(BuySell){
	    SetDealSummary();
	    SetLimitAmount(event);
	    //SetTPSLRange(GetLimitRange(BuySell));			
		//CountLimitAmounts();
		
	}
		
}catch(ex){return(0);}}

function SetDealSummary()
{try{
	var amount=getel("cmbAmount").options[getel("cmbAmount").selectedIndex].value;
	try{
		var oamount=XReplace(amount,",","");
	}catch(e){}
	var tBuySell=(BuySell=="Buy")?bt:st;
	var OppBuySell=(BuySell=="Buy")?st:bt;
	var rate=(BuySell=="Buy")?AskValue(""):BidValue("");
	oamount*=rate;
	oamount=CommaFormatted(FormatAmount(oamount,false));
	var ccy1=getel("lblDescCCY1").innerHTML;
	var ccy2=getel("lblDescCCY2").innerHTML;

var lang = "Italiano";
if(lang != "German")
	{
	getel("lblDealSummary1").innerHTML = "<b>" + tBuySell.replace("@@","")+" "+amount+"</b> "+ccy1+" ";
	getel("lblDealSummary2").innerHTML = "<b>" + OppBuySell.replace("@@","")+" "+oamount+"</b> "+ccy2;
	getel("lblDealSummary3").innerHTML = "<b>" + rate + "</b>";
	}
	else{
	amount = amount.replace(",",".");
	oamount = oamount.replace(",",".");
	rate = rate.replace(".",",");
	
		
	getel("lblDealSummary1").innerHTML = "<b>" + amount+" "+ccy1+" "+tBuySell.replace("@@","")+"</b>"+" ";
	getel("lblDealSummary2").innerHTML = "<b>" + oamount+" "+ccy2+" "+OppBuySell.replace("@@","")+"</b>";
	getel("lblDealSummary3").innerHTML = "<b>" + rate + "</b>";
	}
	// @@ instead of <BR>... long story.. dont ask why.. just play along
	
	
	getel("lblDealSummaryInit").style.display='none';
	getel("lblDealSummary").style.display='block';	
}catch(ex){getel("lblDealSummary").innerHTML="";}
}

function getinnerText(o)
{
    var children=o.childNodes;
	while(children.item(0).childNodes.length>0){
		children=children.item(0).childNodes;
	}
	return(children.item(0).nodeValue);
}
function CcyChanged()
{
    
	
	SwitchBuySell("");
	ccy=getel("cmbCCY").options[getel("cmbCCY").selectedIndex].value;
	
	ccypair=ccy.split("/");	
	setInnerText(getel("lblDescCCY1"),ccypair[0]);
	setInnerText(getel("lblDescCCY2"),ccypair[1]);
	setInnerText(getel("dealSizeIn"),ccypair[0]);
	setInnerText(getel("lblOtherCCY1"),ccypair[1]);
	setInnerText(getel("lblOtherCCY2"),ccypair[1]);
	getel("lblSell").innerHTML=st.replace("@@","<BR>")+ " " + ccypair[0];
	getel("lblBuy").innerHTML=bt.replace("@@","<BR>")+ " " + ccypair[0];
	SetDealSummary();
	getel("lblDealSummaryInit").style.display='block';
	getel("lblDealSummary").style.display='none';	
	window.parent.callJS();
	clearTxt();
	resetOptional();
	stopFlash("SL");
	stopFlash("TP");
}
function runRegister(obj){
	
	window.parent.GotoRegister();
}

var lang = "Italiano";
var regUrl;

if(lang != "Hebrew")
{
	regUrl = escape("http://" + document.location.host + "/emerp/landing/masterLP/regLP.aspx?lang=" + lang + "&content=account_type_std&ct=1");
}
else
{
	regUrl = escape("http://" + document.location.host + "/emerp/landing/masterLP/regLP.aspx?lang=" + lang + "&content=account_type_std&ct=17");
}
var so = new SWFObject("/TSDeal/IF-tut-TG_" + lang +".swf", "mymovie", "404", "300", "8", "#000000");
so.addVariable("clickTag", regUrl); 

var imgSellBut_up = new Image();
imgSellBut_up.src = "/img/gen/SellBut_up.gif";

var imgSellBut_over = new Image();
imgSellBut_over.src = "/img/gen/SellBut_over.gif";

var imgBuyBut_up = new Image();
imgBuyBut_up.src = "/img/gen/BuyBut_up.gif";

var imgBuyBut_over = new Image();
imgBuyBut_over.src = "/img/gen/BuyBut_over.gif";

var imgBuyBut_down = new Image();
imgBuyBut_down.src = "/img/gen/BuyBut_down.gif";

var imgSellBut_down = new Image();
imgSellBut_down.src = "/img/gen/SellBut_down.gif";

var imgtnBut_down = new Image();
imgtnBut_down.src = "/img/gen/tnBut_down.gif";

var imgtnBut_up = new Image();
imgtnBut_up.src = "/img/gen/tnBut_up.gif";

function btnCImg(obj,status){
	switch(status)
	{
		case 'on':obj.style.background = "url(" + imgtnBut_down.src + ")";break
		case 'off':obj.style.background = "url(" + imgtnBut_up.src + ")";break
	}
	
	
}

if(parent.document.URL.indexOf("gtour=1") > -1)
{
    setTR('GT');
}

		</script>
	</body>
</html>
