function Start(page)
{
  OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,height=500,width=658,location=no,scrollbars=no,resizable=no,status=no,left=100,top=100");
}

// Drop down box
function SelectIt()
{
  if (document.Links.Select.options[document.Links.Select.selectedIndex].value != "none")
  {
    self.location = document.Links.Select.options[document.Links.Select.selectedIndex].value
  }
}


  
function doSubmit()
{
  var startDay =  document.PRICES.startday.options[document.PRICES.startday.options.selectedIndex].value;
  var startMonth = document.PRICES.startmonth.options[document.PRICES.startmonth.options.selectedIndex].value;
  var startYear =  document.PRICES.startyear.options[document.PRICES.startyear.options.selectedIndex].value;
  var finishDay = document.PRICES.finishday.options[document.PRICES.finishday.options.selectedIndex].value;
  var finishMonth = document.PRICES.finishmonth.options[document.PRICES.finishmonth.options.selectedIndex].value;
  var finishYear = document.PRICES.finishyear.options[document.PRICES.finishyear.options.selectedIndex].value;
  
  var firstDate = new Date();
  var beginDate = new Date();
  var endDate = new Date();
  var localDate = new Date();
    
  firstDate.setDate(2);
  firstDate.setMonth(0); //Month number minus 1
  firstDate.setFullYear(1998);

  beginDate.setDate(startDay);
  beginDate.setMonth(startMonth-1);
  beginDate.setFullYear(startYear);
    
  endDate.setDate(finishDay);
  endDate.setMonth(finishMonth-1);
  endDate.setFullYear(finishYear);
  

  if (beginDate < firstDate)
  {
    alert('Please check the dates selected. Start date cannot be before the 2nd January 1998');
  }
  else if (beginDate > endDate)
  {
    alert('Please check the dates selected. Start date cannot be after end date');
  }  
  else if (endDate > localDate)
  {
    alert('Please check the dates selected. End date cannot be in the future');
  }
  else
  {
    top.location.href= "http://miranda.hemscott.com/servlet/HsPublic?context=ir.sn&path=irCsvDownload&service=getPriceAndVolumeXml&fromDate="+startDay+"-"+startMonth+"-"+startYear+"&toDate="+finishDay+"-"+finishMonth+"-"+finishYear+"&symbols=SN.@LSE&transform=separate_download";
  } 
}
      
function writeYear(theYear)
{
  var d = new Date();
  y = d.getFullYear();
      
  startYear = theYear;
      
  for (i=startYear; i<(y+1) ; i++)
  {
    document.write('<option value="'+i+'">'+i+'</option>')
  } 
}


var spaceAtPosition;
var slashAtPosition;
var dd;
var mm;
var yy;
var monthName;
var testDayZeroPadded;

var hemscottDate="<#DATE>";
spaceAtPosition=hemscottDate.indexOf(" ");
slashAtPosition=hemscottDate.indexOf("/");

testDayZeroPadded=(slashAtPosition-spaceAtPosition);

yy=hemscottDate.substring(hemscottDate.length-4,hemscottDate.length);
mm=hemscottDate.substring(slashAtPosition+1,2);

if (testDayZeroPadded=='2')
{
dd=hemscottDate.substr(spaceAtPosition+1,1);
}

if (testDayZeroPadded=='3')
{
dd=hemscottDate.substr(spaceAtPosition+1,2);
}


if (mm == 01)
{
monthName="January";

}

if (mm == 02)
{
monthName="Feburary";
}

if (mm == 03)
{
monthName="March";
}

if (mm == 04)
{
monthName="April";
}

if (mm == 05)
{
monthName="May";
}

if (mm == 06)
{
monthName="June";
}

if (mm == 07)
{
monthName="July";
}

if (mm == 08)
{
monthName="August";
}

if (mm == 09)
{
monthName="September";
}

if (mm == 10)
{
monthName="October";
}

if (mm == 11)
{
monthName="November";
}

if (mm == 12)
{
monthName="December";
}


function clickofflse(x)

{
    document.clickchangelse.selectionslse.selectedindex=0
    self.location.href=x;
}


function clickoffnyse(x)

{
    document.clickchangenyse.selectionsnyse.selectedindex=0
    self.location.href=x;
}


//IExplorer
if (document.layers) {
    SharesLSE = "<layer name=\"sharepriceLSE\" top=\"53\" left=\"0\" width=\"600\" height=\"175\" src=\"/servlet/HsPublic?context=ir.snn&path=trading&service=getDelayedPrices&market=LSE&symbol=SN.&transform=sn._lse_prices_iframe2\"></layer>\n";
} 
//FireFox
else {
    SharesLSE = "<iframe name=\"sharepriceLSE\" style=\"top: 53px; left:0px\" width=\"600px\" height=\"200px\" src=\"/servlet/HsPublic?context=ir.snn&path=trading&service=getDelayedPrices&market=LSE&symbol=SN.&transform=sn._lse_prices_iframe2\" vspace=\"0\" frameborder=\"0\"></iframe>\n";
}


//IExplorer
if (document.layers) {
    Shares = "<layer name=\"shareprice\" top=\"210\" left=\"0px\" width=\"625px\" height=\"175\" src=\"/servlet/HsPublic?context=ir.snn&path=trading&service=getDelayedPrices&market=NYSE&symbol=SNN&transform=snn_nyse_prices_iframe2\"></layer>\n";
}


//FireFox
else  {
    Shares = "<iframe name=\"shareprice\" style=\" top: 210px; left:0\" width=\"600px\" height=\"200px\" src=\"/servlet/HsPublic?context=ir.snn&path=trading&service=getDelayedPrices&market=NYSE&symbol=SNN&transform=snn_nyse_prices_iframe2\" vspace=\"0\" frameborder=\"0\"></iframe>\n";
}

