﻿// JScript File
//Set the passes URL as src of the passed image
function SetImageSrc(img, url)
{
    img.src=url;
}
/*****************************************************************/
//Check if chech boxes of best report are selected atleast one 
function CheckIfCheckBoxesSelected(querystring)
{
var inputs =window.document.aspnetForm.getElementsByTagName("input");//window.document.aspnetForm.chkbox;
  
var checked=0;
var strChekedBoxesIndexes="";

for (var i=0;i<inputs.length;i++)
 {
  if(inputs[i].type=='checkbox' && inputs[i].id.indexOf('PDFchkbox')!=-1)
   { 
      if(inputs[i].checked)
      {
      checked++;
      if(strChekedBoxesIndexes=="")
        strChekedBoxesIndexes=""+inputs[i].value;
      else
        strChekedBoxesIndexes=strChekedBoxesIndexes+"_"+inputs[i].value;
      }
    }
 }

querystring=querystring+"&ClientTradeIds="+strChekedBoxesIndexes;

if(checked==0)
{
 alert("Must select at least one trade before trying for PDF report.");
}
 else
 {
 var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-800)/2 + ",left=" + (screen.width-700)/2 + ",width=920,height=800";
	openPDFReportWindow = window.open("ExportToFileProgressBar.aspx?"+querystring,'_PDFReportPopup',winstyle);
	if(openPDFReportWindow!=null)
	    openPDFReportWindow.focus();
 }

}
//****************************************************************/
// Change the mode of the BX on changing the selection of Drop downlist

function ChangeBXMode(dropdown)
{

var selectedValue=dropdown.value;
if(selectedValue!="")
{
 window.location="TradeDetails.aspx"+selectedValue;
}
}
//****************************************************************/
// Change the mode of the Order Book on changing the selection of Drop downlist

function ChangeOBMode(dropdown)
{

var selectedValue=dropdown.value;
if(selectedValue!="")
{
 window.location="TCAOBRAuthentication.aspx"+selectedValue;
}
}
//ChangeTCAMode
//****************************************************************/
// Change the mode of the Order Book on changing the selection of Drop downlist

function ChangeTCAMode(dropdown)
{

var selectedValue=dropdown.value;
if(selectedValue!="")
{
 window.location="TCAOBRAuthentication.aspx"+selectedValue;
}
}
/*****************************************************************/
//Check if check boxes of best report selected are not
//more than the limit
function CalculateCheckBoxes(currentchkbox,limit)
{

var inputs =window.document.aspnetForm.getElementsByTagName("input");//window.document.aspnetForm.chkbox;
var checked=0;
for (var i=0;i<inputs.length;i++)
 {
 if(inputs[i].type=='checkbox' && inputs[i].id.indexOf('PDFchkbox')!=-1)
    {
   
  var tableRow=inputs[i].parentElement.parentElement;
  if(inputs[i].checked)
  {
     tableRow.style.backgroundColor='yellowgreen';
     checked++;
     if(checked > limit)
     {
         currentchkbox.checked=false;
         ChangeBackgroundColor(i,tableRow);
         alert("You are not allowed to select more than "+limit +" trades for PDF report.");
     }
  }
  else
  {
    ChangeBackgroundColor(i,tableRow);
  }
  }
 }
}
//*************************************************************
function ChangeBackgroundColor(index,item)
{
  if(index%2==0) //means alternating item
     item.style.backgroundColor='#e1e1e1';
  else
     item.style.backgroundColor='#FFFFFF';
}
/////////////////////////////////////////////////////////

function SetBroker(selectedBroker)
{
if(selectedBroker!="")
	{
	    try
	    {
	        if(window.opener && !window.opener.closed)
	        {
	         var strtextBoxID=window.document.frmBrokerPicker.txtTextBoxID.value;
	            if(window.opener.document.getElementById(strtextBoxID)!=null)
		            window.opener.document.getElementById(strtextBoxID).value=selectedBroker;
		     }
	    }
	    catch(e)
	    {
	//  alert(e.message);
	    }
	}
	window.close();
}
//**************************************************************************************************
//open Broker search pop up

function OpenUserPopup(userInfo)
{
    //searchString=window.document.getElementById(txtBoxID).value;
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-50)/2 + ",width=480,height=200";
	openuserWindow = window.open("UserPopUp.aspx?txtUserInfo="+userInfo,'_OpenuserPopup',winstyle);
	if(openuserWindow!=null)
	    openuserWindow.focus();
	
}

function SetTCAParameterWindow(X,Y)
{
 var intervalValue=window.frmTCAReportParameter.ddlTCAAnalysisInterval.value;
 if(intervalValue!="Custom")
 {
      DisableTCAParameters(true);
  }
  ValidateTCAStartEndTime();
  ResizeWidnow(X,Y);
} 

function ResizeWidnow(X,Y)
{
    resizeTo(X,Y);
}
/////////////////////////////////////////////////////////
//**************************************************************************************************
function OpenOrderBookReplayWindow(querystring)
{
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-800)/2 + ",left=" + (screen.width-700)/2 + ",width=780,height=800";
	
	openOrderBookReplayWindow = window.open("TCAOBRAuthentication.aspx?"+querystring,'_OrderBookReplayPopup',winstyle);
	if(openOrderBookReplayWindow!=null)
	    openOrderBookReplayWindow.focus();
}

/////////////////////////////////////////////////////////
//***************************************************************************************************
function OpenInNewWindow(url)
{
    OpenInNewWindow(url, false, 0, 0);
}

function OpenInNewWindow(url, resizable, sizeWidth, sizeHeight)
{
    var winstyle="menubar=no,toolbar=no,scrollbars=yes";
    
    if (resizable)
        winstyle = winstyle + ",resizable=yes";
   
    if (sizeWidth != 0)
        winstyle = winstyle + ",width=" + sizeWidth;
        
    if (sizeHeight != 0)
        winstyle = winstyle + ",height=" + sizeHeight;
    
    openNewWindow = window.open(url,'Window1',winstyle);
    if(openNewWindow!=null)
        openNewWindow.focus();
}

//**************************************************************************************************
function OpenTCAIntermediateWindow(querystring)
{
var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-800)/2 + ",left=" + (screen.width-700)/2 + ",width=650,height=490";
	
	openTCAIntermediateWindow = window.open("TCAOBRAuthentication.aspx?"+querystring,'_TCAReportInt',winstyle);
	if(openTCAIntermediateWindow!=null)
	    openTCAIntermediateWindow.focus();
	    
	    }

/////////////////////////////////////////////////////////
//**************************************************************************************************
function OpenTCAChartIntermediateWindow(querystring)
{
    var winstyle = "scrollbars=yes,status=no,location=no,titlebar=no,menubar=no,top=" + (screen.height - 800) / 2 + ",left=" + (screen.width - 700) / 2 + ",width=700,height=550";
	
	//openTCAIntermediateWindow = window.open("TCATradeChart.aspx?"+querystring,'_TCATradeChart',winstyle);
	openTCAIntermediateWindow = window.open("TCAOBRAuthentication.aspx?"+querystring,'_TCATradeChart',winstyle);
	if(openTCAIntermediateWindow!=null)
	    openTCAIntermediateWindow.focus();
	    
	    }

/////////////////////////////////////////////////////////
//**************************************************************************************************

//open pop up to print report

function OpenAdhocReportToPrint(querystring, txtBoxID)
{
    var tradeOptions="&TO="+window.document.getElementById(txtBoxID).value;
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-800)/2 + ",left=" + (screen.width-700)/2 + ",width=850,height=800";
	openAdhocReportWindow = window.open("TradeDetailsPrint.aspx?"+querystring+tradeOptions,'_AdhocReportPopup',winstyle);
	if(openAdhocReportWindow!=null)
	    openAdhocReportWindow.focus();
}

/////////////////////////////////////////////////////////
//**************************************************************************************************

//open pop to print report

function OpenReportToPrint(tradeID,txtBoxID)
{
    var tradeOptions="&TO="+window.document.getElementById(txtBoxID).value;
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-800)/2 + ",left=" + (screen.width-700)/2 + ",width=850,height=800";
	openReportWindow = window.open("TradeDetailsPrint.aspx?OrderID="+tradeID+tradeOptions,'_ReportPopup',winstyle);
	if(openReportWindow!=null)
	    openReportWindow.focus();
}

/////////////////////////////////////////////////////////

//open Broker search pop up

function OpenBrokerPopup(txtBoxID, searchString)
{
    searchString="";
    searchString=window.document.getElementById(txtBoxID).value;
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-50)/2 + ",width=480,height=400";
	openBrokerWindow = window.open("BrokerSearchPopUp.aspx?txtTextBoxID="+txtBoxID+"&searchString="+searchString,'_OpenBrokerPopup',winstyle);
	if(openBrokerWindow!=null)
	    openBrokerWindow.focus();
	
}

/////////////////////////////////////////////////////////
//open RSP search pop up

function OpenRSPPopup(txtBoxID, searchString)
{
    searchString="";
    searchString=window.document.getElementById(txtBoxID).value;
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-50)/2 + ",width=480,height=400";
	openBrokerWindow = window.open("RSPSearchPopUp.aspx?txtTextBoxID="+txtBoxID+"&searchString="+searchString,'_OpenRSPPopup',winstyle);
	if(openBrokerWindow!=null)
	    openBrokerWindow.focus();
	
}

/////////////////////////////////////////////////////////
//**************************************************************************************************
//open User pop up for editing

function OpenUserBrokers(UserID,rowCell)
{
   
    SelectRow(rowCell,0); 
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-50)/2 + ",width=480,height=250";
	openUserBrokersWindow = window.open("UserBrokersPopUp.aspx?UserID="+UserID,'_OpenUserBrokers',winstyle);
	if(openUserBrokersWindow!=null)
	    openUserBrokersWindow.focus();
	return false;
	
}

/////////////////////////////////////////////////////////
//**************************************************************************************************
function OpenUploadClientOrders()
{
  
    var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-350)/2 + ",width=650,height=350";
	
	openUploadClientOrderWindow = window.open("UploadClientOrders.aspx",'_OpenUploadClientOrders',winstyle);
	if(openUploadClientOrderWindow!=null)
	openUploadClientOrderWindow.focus();
	
}

function OpenUploadClientFile()
{
  
    var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-350)/2 + ",width=650,height=420";
	
	openUploadClientFileWindow = window.open("UploadClientFile.aspx",'_OpenUploadClientFile',winstyle);
	if(openUploadClientFileWindow!=null)
	openUploadClientFileWindow.focus();
	
}
/////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////
//**************************************************************************************************
//open EditUser search pop up

function OpenEditUser(UserID,rowCell)
{
   
    SelectRow(rowCell,0);
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-350)/2 + ",width=650,height=610";
	
	openEditUserWindow = window.open("EditUser.aspx?UserID="+UserID,'_OpenEditUser',winstyle);
	if(openEditUserWindow!=null)
	openEditUserWindow.focus();
	 return false;
	
	
}
/////////////////////////////////////////////////////////

function SetISIN(selectedISIN)
{
if(selectedISIN!="")
	{
	var symbol=selectedISIN.split("#~#");
	    try
	    {
	        if(window.opener && !window.opener.closed)
	        {
	             var strISINtextBoxID=window.document.frmISINPicker.txtISINTextBoxID.value;
	                if(window.opener.document.getElementById(strISINtextBoxID)!=null)
		                window.opener.document.getElementById(strISINtextBoxID).value=symbol[0];
                var strHISINtextBoxID=window.document.frmISINPicker.txtHISINTextBoxID.value;
                    if(window.opener.document.getElementById(strHISINtextBoxID)!=null)
                        window.opener.document.getElementById(strHISINtextBoxID).value=symbol[0];
		        var strTIDMtextBoxID=window.document.frmISINPicker.txtTIDMTextBoxID.value;
	                if(window.opener.document.getElementById(strTIDMtextBoxID)!=null)
		                window.opener.document.getElementById(strTIDMtextBoxID).value=symbol[1];
		        try
	            {
		            var strVenueIDtextBoxID=window.document.frmISINPicker.txtHVenueIDTextBoxID.value;
	                    if(window.opener.document.getElementById(strVenueIDtextBoxID)!=null)
		                    window.opener.document.getElementById(strVenueIDtextBoxID).value=symbol[2];
		        }
		        catch(e) {}
    		    
		        try
	            {
	                var strCompanyNametextBoxID=window.document.frmISINPicker.txtHCompanyNameTextBoxID.value;
	                    if(window.opener.document.getElementById(strCompanyNametextBoxID)!=null)
		                    window.opener.document.getElementById(strCompanyNametextBoxID).value=symbol[3];		           
		        }
		        catch(e) {}
		    }
	    }
	    catch(e)
	    {
	//  alert(e.message);
	    }
	}
	window.close();
}
//**************************************************************************************************
//set the date in the opener window
function SetDate(txtBoxID, selectedDate)
{
	if(selectedDate!="")
	{
	    try
	    {
	        if(window.opener && !window.opener.closed)
	            if(window.opener.document.getElementById(txtBoxID)!=null)
	            {
		            window.opener.document.getElementById(txtBoxID).value=selectedDate;
		            window.opener.document.getElementById(txtBoxID).focus();
		        }
	    }
	    catch(e)
	    {
	  
	    }
	}
	window.close();
}

//**************************************************************************************************
//open ISIN search pop up

function OpenISINPopupForAdhoc(txtISINBoxID,txtHISINBoxID,txtTIDMBoxID,txtHVenueIDBoxID, searchString)
{

    searchString=window.document.getElementById(txtISINBoxID).value;
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-50)/2 + ",width=480,height=450";
	openISINWindow = window.open("ISINSearchPopUp.aspx?txtISINTextBoxID="+txtISINBoxID+"&txtHISINBoxID="+txtHISINBoxID+"&txtTIDMTextBoxID="+txtTIDMBoxID+
	"&txtHVenueIDBoxID="+txtHVenueIDBoxID+"&searchString="+searchString,'_OpenISINPopup',winstyle);
	if(openISINWindow!=null)
	    openISINWindow.focus();
}

function OpenISINPopup(txtISINBoxID,txtHISINBoxID,txtTIDMBoxID, searchString)
{
    searchString=window.document.getElementById(txtISINBoxID).value;
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-50)/2 + ",width=480,height=450";
	openISINWindow = window.open("ISINSearchPopUp.aspx?txtISINTextBoxID="+txtISINBoxID+"&txtHISINBoxID="+txtHISINBoxID+"&txtTIDMTextBoxID="+txtTIDMBoxID+"&searchString="+searchString,'_OpenISINPopup',winstyle);
	if(openISINWindow!=null)
	    openISINWindow.focus();
	
}

function OpenISINPopupWithCompany(txtISINBoxID,txtHISINBoxID,txtTIDMBoxID,txtHCompanyNameBoxID,searchString)
{
    searchString=window.document.getElementById(txtISINBoxID).value;
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-600)/2 + ",left=" + (screen.width-50)/2 + ",width=480,height=450";
	openISINWindow = window.open("ISINSearchPopUp.aspx?txtISINTextBoxID="+txtISINBoxID+"&txtHISINBoxID="+txtHISINBoxID+"&txtTIDMTextBoxID="+txtTIDMBoxID+"&txtHCompanyNameBoxID="+txtHCompanyNameBoxID+"&searchString="+searchString,'_OpenISINPopup',winstyle);
	if(openISINWindow!=null)
	    openISINWindow.focus();
	
}
//**************************************************************************************************

function ResetPage()
{
        window.name="_MessageWindow";
	    window.resizeBy(-150,-470);
		setTimeout('self.close()',15000);
	try
	{
        window.opener.formSearchUser.txtHDoneEditing.value="YES";
		window.opener.formSearchUser.submit();
		window.opener.formSearchUser.txtHDoneEditing.value="NO";
	}
	catch(e)
	{
 	//alert(e.message);
	}

}
//**************************************************************************************************
//open calender in pop up window

function OpenCalender(txtBoxID)
{

	selectedDate="";
	selectedDate=document.getElementById(txtBoxID).value;
	var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-500)/2 + ",left=" + (screen.width+200)/2 + ",width=220,height=160";
	openDateWindow = window.open("DatePicker.aspx?txtBoxID="+txtBoxID+"&selectedDate="+selectedDate,'_OpenCalander',winstyle);
	if(openDateWindow!=null)
	    openDateWindow.focus();
	
}
//**************************************************************************************************
//open pop up window to generate CSV file

function  ExportToFile(typeofReport,queryString)
{
ExportToFile(typeofReport,queryString,null);
}
function  ExportToFile(typeofReport,queryString,txtBoxID)
{

   var page="ExportToFile.aspx?";
   if(typeofReport=="TCAPDF")
     page="ExportToFileProgressBar.aspx?";
  queryString+="&typeofReport="+typeofReport;
  if(txtBoxID!=null)
  {
      var tradeOptions="&TO="+window.document.getElementById(txtBoxID).value;
      queryString+=tradeOptions;
  }
  
  var winstyle = "scrollbars=yes,staus=no,top="+(screen.height-800)/2 + ",left=" + (screen.width-700)/2 + ",width=920,height=800";
  openFileWindow = window.open(page+queryString,'_OpenExportToFile',winstyle);
  if(openFileWindow!=null)
	 openFileWindow.focus();

	
}
//**************************************************************************************************
//if Date is entered into the text box then enable tradetime textboxes

function EnableTradeTime(txtBox, timeTextBoxID)
{

// @"^(((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))$";
	var RegularExpression  =/^(((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))$/;
	if(txtBox.value.match(RegularExpression))
	{
	    document.getElementById(timeTextBoxID).disabled=false;
	    
	}
	else
		document.getElementById(timeTextBoxID).disabled=true;	
	
}
//****************************************************************
//Alert user an error if start and end date spans more than five days.
function ValidateTCAStartEndTime()
{
var dendDate=new Date();
var dstartDate=new Date();
var RegularExpression  =/^(((0?[1-9]|[12]\d|3[01])[\.\-\/](0?[13578]|1[02])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|[12]\d|30)[\.\-\/](0?[13456789]|1[012])[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|((0?[1-9]|1\d|2[0-8])[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?\d{2}))|(29[\.\-\/]0?2[\.\-\/]((1[6-9]|[2-9]\d)?(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00)|00)))$/;
if(window.frmTCAReportParameter.txtStartDate.value.match(RegularExpression) 
&& window.frmTCAReportParameter.txtEndDate.value.match(RegularExpression) 
)
{
		
 var vStartDate=window.frmTCAReportParameter.txtStartDate.value;
 vStartDate=vStartDate.split("/");
 if(vStartDate[2]<2000)
  vStartDate[2]=parseInt(vStartDate[2])+2000;
 dstartDate.setFullYear(vStartDate[2],vStartDate[1],vStartDate[0]);
  
 var vEndDate=window.frmTCAReportParameter.txtEndDate.value;
 vEndDate=vEndDate.split("/");
 if(vEndDate[2]<2000)
  vEndDate[2]=parseInt(vEndDate[2])+2000;
 dendDate.setFullYear(vEndDate[2],vEndDate[1],vEndDate[0]);
 
var ddlbenchmark=window.frmTCAReportParameter.ddlBenchmark;

//if not same day/date then remove "OrderBookOptimal"
if(dstartDate.toLocaleDateString()!=dendDate.toLocaleDateString())
{
 for(i=0 ; i < ddlbenchmark.length; i++)
  {
    if(ddlbenchmark.options[i].value=="OrderBookOptimal")
        ddlbenchmark.remove(i);               
   }
}
else
 {
 var found=false;
 for(i=0 ; i < ddlbenchmark.length; i++)
  {
    if(ddlbenchmark.options[i].value=="OrderBookOptimal")
        found=true;
  }
   if(!found)
    ddlbenchmark.options[ddlbenchmark.length] =new Option("OrderBookOptimal","OrderBookOptimal");
 }
 
 }
}
//**************************************************************************************************
function DisableTCAParameters(value)
{
    window.frmTCAReportParameter.txtStartTime.disabled=value;
    window.frmTCAReportParameter.txtEndTime.disabled=value;
    window.frmTCAReportParameter.imgStartDate.disabled=value;
    window.frmTCAReportParameter.txtStartDate.disabled=value;
    window.frmTCAReportParameter.imgEndDate.disabled=value;
    window.frmTCAReportParameter.txtEndDate.disabled=value;
 
}
//**************************************************************************************************
//Calculate time for the TCA intermediate parameter window

function CalcualteTime(tradetime,tradedate)
{
 
var timeValues=tradetime.split(":");

 var intervalValue=window.frmTCAReportParameter.ddlTCAAnalysisInterval.value;
 if(intervalValue=="Custom")
 {
  DisableTCAParameters(false)
  
 }
  else
  {
    var dt=new Date();
    dt.setHours(timeValues[0],timeValues[1],timeValues[2]);
    var interval=intervalValue.split(",");
    var minutes=dt.getMinutes();
    dt.setMinutes(minutes+parseInt(interval[0]));
    
    window.frmTCAReportParameter.txtStartTime.value=dt.toLocaleTimeString();//dt.getHours()+":"+dt.getMinutes()+":"+dt.getSeconds();
    dt.setMinutes(minutes);
    dt.setMinutes(dt.getMinutes()+parseInt(interval[1]));
    window.frmTCAReportParameter.txtEndTime.value=dt.toLocaleTimeString();// dt.getHours()+":"+dt.getMinutes()+":"+dt.getSeconds();
    window.frmTCAReportParameter.txtStartDate.value=tradedate;
    window.frmTCAReportParameter.txtEndDate.value=tradedate;
    DisableTCAParameters(true)
  
  }
	
}
//**************************************************************************************************
function DeleteOrders(rowCell)
{
        SelectTradesGridRow(rowCell,0)
		if (confirm("Are you sure you want to delete this order?")==true)
		{
			document.body.style.cursor = 'wait';
			return true;
		}
		else
		{  
			return false;
		}
	
}
//**************************************************************************************************

function DeleteTrades(rowCell)
{
        SelectTradesGridRow(rowCell,0)
		if (confirm("Are you sure you want to delete this trade?")==true)
		{
			document.body.style.cursor = 'wait';
			return true;
		}
		else
		{  
			return false;
		}
	
}

//**************************************************************************************************
//**************************************************************************************************
function DeleteBroker(rowCell)
{
        SelectRow(rowCell,1)
		if (confirm("Are you sure you want to delete this broker?")==true)
		{
			document.body.style.cursor = 'wait';
			return true;
		}
		else
		{  
			return false;
		}
	
}

//**************************************************************************************************
//**************************************************************************************************
function DeleteUser(rowCell)
{
        SelectRow(rowCell,0); 
		if (confirm("Are you sure you want to delete this user?")==true)
		{
			document.body.style.cursor = 'wait';
			return true;
		}
		else
		{  
			return false;
		}
	
}

//**************************************************************************************************
function SelectTradesGridRow(rowCell,moreItems)
{
try
		{
			//get the parents of rowCell i.e table
			var table=rowCell.parentElement.parentElement.parentElement.parentElement;
			//get the children of table i.e. tbody
			var tBody=table.children;
			var toalItem=(tBody.item(1).childNodes.length-1)+moreItems;
			//loop through all the items in tBody and change their colours
			for(var i=1;i<toalItem;i++)
			{
		      if(tBody.item(1).childNodes(i).style.backgroundColor!='yellowgreen')
			     {	
					if(i%2==0) //means alternating item
						tBody.item(1).childNodes(i).style.backgroundColor='#FFFFFF';
					else
						tBody.item(1).childNodes(i).style.backgroundColor='#e1e1e1';
				 }
				
			}
			
			//get the parents of rowCell i.e. Tablerow and change its background colour
			var tableRow=rowCell.parentElement.parentElement;
			//if(tableRow.style.backgroundColor!='yellowgreen')
		    	tableRow.style.backgroundColor='Khaki';
		   
			
		}
	 catch(e)
	   {
	//	alert(e.message);
	   }
}
//**************************************************************************************************

function SelectRow(rowCell,moreItems)
{
try
		{
			//get the parents of rowCell i.e table
			var table=rowCell.parentElement.parentElement.parentElement.parentElement;
			//get the children of table i.e. tbody
			var tBody=table.children;
			var toalItem=(tBody.item(0).childNodes.length-1)+moreItems;
			//loop through all the items in tBody and change their colours
			for(var i=1;i<toalItem;i++)
			{
		      if(tBody.item(0).childNodes(i).style.backgroundColor!='lightyellow')
			     {	
					if(i%2==0) //means alternating item
						tBody.item(0).childNodes(i).style.backgroundColor='#FFFFFF';
					else
						tBody.item(0).childNodes(i).style.backgroundColor='#e1e1e1';
				 }
				
			}
			
			//get the parents of rowCell i.e. Tablerow and change its background colour
			var tableRow=rowCell.parentElement.parentElement;
			if(tableRow.style.backgroundColor!='lightyellow')
		    	tableRow.style.backgroundColor='yellowgreen';
		   
			
		}
	 catch(e)
	   {
	//	alert(e.message);
	   }
}

//**************************************************************************************************
//Code for the Modal Popup - Please wait functionality
//PS - This has been commented out since it has caused issues with the PDF export JS logic
//     Please Wait logic on page is also removed for time-being


/*
function pageLoad(sender, args) {
    var sm = Sys.WebForms.PageRequestManager.getInstance();
    if (!sm.get_isInAsyncPostBack()) {
        sm.add_beginRequest(onBeginRequest);
        sm.add_endRequest(onRequestDone);
    }
}

function onBeginRequest(sender, args) {
    var send = args.get_postBackElement().value;
    if (displayWait(send) == "yes") {
        $find('PleaseWaitPopup').show();
    }
}

function onRequestDone() {
    $find('PleaseWaitPopup').hide();
}

function displayWait(send) {
    switch (send) {
        default:
            return ("yes");
            break;
    }
}
*/