<!--
//document.domain = "www.tenongroup.com" 

qparams = getQueryParams();

//alert(qparams["epic"]);

var unitcode = qparams["epic"];

if (!unitcode || unitcode == 'undefined'){
  	unitcode = 'TNO';
	var ftse = (qparams["ftse"] == undefined)?'':qparams["ftse"];
	var sector = (qparams["sector"] == undefined)?'':qparams["sector"];
	var period = (qparams["period"] == undefined)?'412':qparams["period"];
	var period1 = period.substr(0,1);
	var period2 = period.substring(period.length-2,period.length);
	var index = (qparams["index"] == undefined)?'':qparams["index"];
	var day = (qparams["day"] == undefined)?'':qparams["day"];
	var month = (qparams["month"] == undefined)?'':qparams["month"];
	var year = (qparams["year"] == undefined)?'':qparams["year"];
}


// load all data
  var dl1 = new dataObject()
  dl1.datasource="fm_get_company_details"
  dl1.code=unitcode
  dl1.vname = "details"
  dl1.flist = "name,code"
  dl1.load()
// have to end script tag to perform the load

// load all data
  var dl2 = new dataObject()
  dl2.datasource="get_quote"
  dl2.unitcode=unitcode
  dl2.unittype="E"
  dl2.vname = "quote"
  dl2.flist = "unitcode,price,unitname,unitnamelong,unittype,bid,ask,midchange,currency,high,low,open,prevclose,volume,updatetime"
  dl2.load()
// have to end script tag to perform the load

// load all data
  var dl3 = new dataObject()
  dl3.datasource="fm_get_company_details"
  dl3.code=unitcode
  dl3.vname = "basicInfo"
  dl3.flist = "sedol,address,tel,sectorname,sharesinissue,ftse250,newft100,tmt,techmarkallshare,tech100,aim"
  dl3.load()
// have to end script tag to perform the load

// load all data
  var dl4 = new dataObject()
  dl4.datasource="get_sector_indices"
  dl4.vname = "sectors"
  dl4.flist = "unitcode,sectorname"
  dl4.load()
// have to end script tag to perform the load

// load all data
  var dl6 = new dataObject()
  dl6.datasource="ukw_get_headlines"
  dl6.unitcode=unitcode
  dl6.maxrecs = "10"
  dl6.vname = "headlines"
  dl6.flist = "newsdate,unitcode,articleid,headline"
  dl6.load()
// have to end script tag to perform the load

// load all data
  var dl7 = new dataObject()
  dl7.datasource="ukw_get_headlines"
  dl7.unitcode=unitcode
  dl7.startdate="2004-01-01"
  dl7.enddate="2005-01-01"
  dl7.filterdate="1"
  dl7.vname = "headlines2004"
  dl7.flist = "newsdate,unitcode,articleid,headline"
  dl7.load()
// have to end script tag to perform the load

// load all data
  var dl8 = new dataObject()
  dl8.datasource="ukw_get_headlines"
  dl8.unitcode=unitcode
  dl8.startdate="2005-01-01"
  dl8.enddate="2006-01-01"
  dl8.filterdate="1"
  dl8.vname = "headlines2005"
  dl8.flist = "newsdate,unitcode,articleid,headline"
  dl8.load()
// have to end script tag to perform the load

// load all data
  var dl9 = new dataObject()
  dl9.datasource="ukw_get_headlines"
  dl9.unitcode=unitcode
  dl9.startdate="2006-01-01"
  dl9.enddate="2007-01-01"
  dl9.filterdate="1"
  dl9.vname = "headlines2006"
  dl9.flist = "newsdate,unitcode,articleid,headline"
  dl9.load()
// have to end script tag to perform the load

// load all data
  var dl10 = new dataObject()
  dl10.datasource="ukw_get_headlines"
  dl10.unitcode=unitcode
  dl10.startdate="2007-01-01"
  dl10.enddate="2008-01-01"
  dl10.filterdate="1"
  dl10.vname = "headlines2007"
  dl10.flist = "newsdate,unitcode,articleid,headline"
  dl10.load()
// have to end script tag to perform the load

// load all data
  var dl11 = new dataObject()
  dl11.datasource="ukw_get_headlines"
  dl11.unitcode=unitcode
  dl11.startdate="2008-01-01"
  dl11.enddate="2009-01-01"
  dl11.filterdate="1"
  dl11.vname = "headlines2008"
  dl11.flist = "newsdate,unitcode,articleid,headline"
  dl11.load()
// have to end script tag to perform the load

// load all data
  var dl12 = new dataObject()
  dl12.datasource="ukw_get_headlines"
  dl12.unitcode=unitcode
  dl12.startdate="2008-01-01"
  dl12.enddate="2009-01-01"
  dl12.filterdate="1"
  dl12.vname = "headlines2008"
  dl12.flist = "newsdate,unitcode,articleid,headline"
  dl12.load()
// have to end script tag to perform the load

// load all data
  var dl13 = new dataObject()
  dl13.datasource="ukw_get_headlines"
  dl13.unitcode=unitcode
  dl13.startdate="2008-01-01"
  dl13.enddate="2009-01-01"
  dl13.filterdate="1"
  dl13.vname = "headlines2008"
  dl13.flist = "newsdate,unitcode,articleid,headline"
  dl13.load()
// have to end script tag to perform the load

// load all data
  var dl14 = new dataObject()
  dl14.datasource="ukw_get_headlines"
  dl14.unitcode=unitcode
  dl14.startdate="2009-01-01"
  dl14.enddate="2010-01-01"
  dl14.filterdate="1"
  dl14.vname = "headlines2009"
  dl14.flist = "newsdate,unitcode,articleid,headline"
  dl14.load()
// have to end script tag to perform the load

// load all data
  var dl15 = new dataObject()
  dl15.datasource="ukw_get_headlines"
  dl15.unitcode=unitcode
  dl15.startdate="2010-01-01"
  dl15.enddate="2011-01-01"
  dl15.filterdate="1"
  dl15.vname = "headlines2010"
  dl15.flist = "newsdate,unitcode,articleid,headline"
  dl15.load()
// have to end script tag to perform the load

// load all data
  var dl16 = new dataObject()
  dl16.datasource="ukw_get_headlines"
  dl16.unitcode=unitcode
  dl16.startdate="2011-01-01"
  dl16.enddate="2012-01-01"
  dl16.filterdate="1"
  dl16.vname = "headlines2011"
  dl16.flist = "newsdate,unitcode,articleid,headline"
  dl16.load()
// have to end script tag to perform the load

// load all data
  var dl17 = new dataObject()
  dl17.datasource="ukw_get_headlines"
  dl17.unitcode=unitcode
  dl17.startdate="2012-01-01"
  dl17.enddate="2013-01-01"
  dl17.filterdate="1"
  dl17.vname = "headlines2012"
  dl17.flist = "newsdate,unitcode,articleid,headline"
  dl17.load()
// have to end script tag to perform the load

// load all data
  
  var dl18 = new dataObject();
  dl18.datasource="ukw_get_headlines";
  dl18.unitcode=unitcode;
  dl18.startdate=getDateMinusOneYearString();
  dl18.enddate=getCurrentDateString();
  dl18.filterdate="1";
  dl18.vname = "headlinesLast12Months";
  dl18.flist = "newsdate,unitcode,articleid,headline";
  dl18.load();
// have to end script tag to perform the load

function zeroPad(iNumber, iDigits)
{
    var sPaddedNumber = iNumber + '';
    while(sPaddedNumber.length < iDigits) 
        sPaddedNumber = "0" + sPaddedNumber;
    return sPaddedNumber;
}

function getCurrentDateString()
{
   var dtNow = new Date();
   dtNow.setDate(dtNow.getDate()+1);
  var sYear = zeroPad(dtNow.getFullYear(), 4);
  var sMonth    = zeroPad(dtNow.getMonth() + 1, 2);
  var sDay    = zeroPad(dtNow.getDate(), 2);

  return sYear + '-' + sMonth +  '-' + sDay;
}

function getDateMinusOneYearString()
{
   var dtNow = new Date();
  var sYear = zeroPad(dtNow.getFullYear() - 1, 4);
  var sMonth = zeroPad(dtNow.getMonth() + 1, 2);
  var sDay = zeroPad(dtNow.getDate(), 2);
  return sYear + '-' + sMonth + '-' + sDay;
}

function getUpdateTime(){

  dw(genHTML(quote[0],"Live Feeds last updated on %updatetime%"));

}

function getPriceInfo(){

  dw(genHTML(quote[0],"<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='Price Information'>"));
  dw(genHTML(quote[0],"<tr><th class='left' colspan='2'>price information</th></tr>"));
  dw(genHTML(quote[0],"<tr class='stripe'><td class='left'>Share Price:</td><td class='left'>%price% p</td></tr>"));
  dw(genHTML(quote[0],"<tr><td class='left'>Bid Price:</td><td class='left'>%bid% p</td></tr>"));
  dw(genHTML(quote[0],"<tr class='stripe'><td class='left'>Offer Price:</td><td class='left'>%ask% p</td></tr>"));
  dw(genHTML(quote[0],"<tr><td class='left'>Day Change:</td><td class='left'>%midchange% p</td></tr>"));
  dw(genHTML(quote[0],"<tr class='stripe'><td class='left'>Currency:</td><td class='left'>%currency%</td></tr>"));
  dw(genHTML(quote[0],"<tr><td class='left'>Day High:</td><td class='left'>%high% p</td></tr>"));
  dw(genHTML(quote[0],"<tr class='stripe'><td class='left'>Day Low:</td><td class='left'>%low% p</td></tr>"));
  dw(genHTML(quote[0],"<tr><td class='left'>Open Price:</td><td class='left'>%open% p</td></tr>"));
  dw(genHTML(quote[0],"<tr class='stripe'><td class='left'>Prev Close:</td><td class='left'>%prevclose% p</td></tr>"));
  dw(genHTML(quote[0],"<tr><td class='left'>Volume:</td><td class='left'>%volume%</td></tr>"));
  dw(genHTML(quote[0],"</table>"));

}

function getCompInfo(){

  dw(genHTML(basicInfo[0],"<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='company information'>"));
  dw(genHTML(basicInfo[0],"<tr><th class='left' colspan='2'>company information</th></tr>"));
  dw(genHTML(details[0],"<tr class='stripe'><td class='left'>Company Name:</td><td class='left'>%name%</td></tr>"));
  dw(genHTML(basicInfo[0],"<tr><td class='left'>Address:</td><td class='left'>%address%</td></tr>"));
  dw(genHTML(basicInfo[0],"<tr class='stripe'><td class='left'>Tel No:</td><td class='left'>%tel%</td></tr>"));
  dw(genHTML(basicInfo[0],"</table>"));
}

function getShareInfo(){

  dw(genHTML(basicInfo[0],"<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='Share Information'>"));
  dw(genHTML(basicInfo[0],"<tr><th class='left' colspan='2'>share information</th></tr>"));
  dw(genHTML(basicInfo[0],"<tr class='stripe'><td class='left'>Sector:</td><td class='left'>%sectorname%</td></tr>"));
  dw(genHTML(basicInfo[0],"<tr><td class='left'>Shares in Issue:</td><td class='left'>%sharesinissue% m</td></tr>"));
  dw(genHTML(basicInfo[0],"<tr class='stripe'><td class='left'>Indices:</td><td class='left'>"));
  if (basicInfo[0].aim=='True'){document.write("FTSE AIM")}
  if (basicInfo[0].ftse250=='True'){document.write("FTSE 250")}
  if (basicInfo[0].newft100=='True'){document.write("FTSE 100")}
  if (basicInfo[0].tmt=='True'){document.write("TMT")}
  if (basicInfo[0].techmarkallshare=='True'){document.write("techMARK All Share")}
  if (basicInfo[0].tech100=='True'){document.write("TECH 100")}
  dw(genHTML(basicInfo[0],"</td></tr>"));
  dw(genHTML(basicInfo[0],"<tr><td class='left'>Sedol Code:</td><td class='left'>%sedol%</td></tr>"));
  dw(genHTML(details[0],"<tr class='stripe'><td class='left'>EPIC Code:</td><td class='left'>%code%</td></tr>"));
  dw(genHTML(basicInfo[0],"</table>"));

}

function chart(){

  errimage="this.src='/Images/inv_sharegraph_unav.jpg'"
  
  document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='Share Price Graph'>");
  document.write("<tr><th class='left' colspan='2'>share price graph</th></tr>");
  document.write("<tr><td class='left'>")  
  document.write('<p class="textshow">This graph is an image, and is not displayed on the text only version of this page.</p><img src="http://webfund5.financialexpress.net/prestel/gifchart.asp?wd=626&ht=370&code=E' + unitcode +',' + index + ',' + sector + '&startdate=' + year + '-' + month + '-' + day + '&gpcolour=HFF0000,H000000,H0000FF&ftcolour=H000000&bgcolour=FFFFFF&gdcolour=H808080&bdcolour=000000&axcolour=H336699&gphtype=' + period1 + '&span=' + period2 + '&ShowDate=1&chartbgcolour=FFFFFF&hdg=2&hdgpos=1&fg=1&vgridint=1&fontsize=8&fontname=verdana&yoffs=0" border="0" alt="Tenon Group Plc Share Price Graph" onError="' + errimage + '" >');
  document.write("</td></tr>");
  document.write("</table>");

}

function chartVolume(){

  errimage="this.src='/Images/inv_volumegraph_unav.jpg'"

  document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='Share Volume Graph'>");
  document.write("<tr><th class='left' colspan='2'>share volume graph</th></tr>");
  document.write("<tr><td class='left'>");
  document.write('<p class="textshow">This graph is an image, and is not displayed on the text only version of this page.</p><img src="http://webfund5.financialexpress.net/prestel/gifchart.asp?wd=626&ht=370&code=E' + unitcode +'&gpcolour=HFF0000,H000000,H0000FF&ftcolour=H000000&bgcolour=FFFFFF&gdcolour=H808080&bdcolour=000000&axcolour=H336699&gphtype=' + period1 + '&span=' + period2 + '&ShowDate=1&chartbgcolour=FFFFFF&hdg=2&hdgpos=1&fg=1&vgridint=1&fontsize=8&autovol=1&volht=117&fontname=verdana&yoffs=0" border="0" alt="Tenon Group Plc Share Volume Graph" onError="' + errimage + '" >');
  document.write("</td></tr>");
  document.write("</table>");

}

function writeDays(days){
  for (var i=0; i<=days; i++){
    document.write('<option value="' + i + '">' + i + '</option>');
  }
}

function writeMonths(months){
  for (var i=0; i<=months; i++){
    document.write('<option value="' + i + '">' + i + '</option>');
  }
}

function writeYears(yearA,yearB){
  for (var i=yearA; i<=yearB; i++){
    document.write('<option value="' + i + '">' + i + '</option>');
  }
}
function getSectors(){
  for (var i=0;i<sectors.length;i++){
    dw(genHTML(sectors[i],"<option value='N%unitcode%'>%sectorname%</option>"));
  }
}
function setSpanType(type){

  if (type == 'per'){
    document.ChartControl.day.selectedIndex = 0;
    document.ChartControl.month.selectedIndex = 0;
    document.ChartControl.year.selectedIndex = 0;
  }
  if (type == 'sd'){
    document.ChartControl.period.selectedIndex = 0;
  }
}

function openArticle(id){

  loadFlt('/investor-relations/investor-news/article.aspx?id=' + id,800,600);

}

function loadFlt(url,width,height){

  var browser = navigator.appName + " " + navigator.appVersion;
  var Newwindow = window.open(url,"choose","resizable=yes,height=" + height + ",width=" + width + ",top=100,left=100,scrollbars=yes");

  if ( browser.substring(0, 8) =="Netscape"){
    Newwindow.creator = self;
  }
  else{
    if (Newwindow.opener == null){
      Newwindow.opener = self;
    }
  }
}
/*
function writeHeadlines(){

  var stripe=1;

  dw("<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='stock exchange'>");
  dw("<tr><th class='left' colspan='2'>stock exchange</th></tr>");

  for (var i=0;i<headlines.length;i++){
  
    if (stripe==1) {
     
        dw(genHTML(headlines[i],"<tr class='stripe'><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines[i],"</td></tr>"));
        stripe=0;
        
    }
    
    else if (stripe==0) {
     
        dw(genHTML(headlines[i],"<tr><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines[i],"</td></tr>"));
        stripe=1;
        
    }
  
    
  }
  
  dw(genHTML(quote[0],"</table>"));
}

function writeHeadlines2004(){

  var stripe=1;

  dw("<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='stock exchange'>");
  dw("<tr><th class='left' colspan='2'>stock exchange</th></tr>");

  for (var i=0;i<headlines2004.length;i++){
  
    if (stripe==1) {
     
        dw(genHTML(headlines2004[i],"<tr class='stripe'><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines2004[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines2004[i],"</td></tr>"));
        stripe=0;
        
    }
    
    else if (stripe==0) {
     
        dw(genHTML(headlines2004[i],"<tr><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines2004[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines2004[i],"</td></tr>"));
        stripe=1;
        
    }
  
    
  }
  
  dw(genHTML(quote[0],"</table>"));
}

function writeHeadlines2005(){

  var stripe=1;

  dw("<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='stock exchange'>");
  dw("<tr><th class='left' colspan='2'>stock exchange</th></tr>");

  for (var i=0;i<headlines2005.length;i++){
  
    if (stripe==1) {
     
        dw(genHTML(headlines2005[i],"<tr class='stripe'><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines2005[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines2005[i],"</td></tr>"));
        stripe=0;
        
    }
    
    else if (stripe==0) {
     
        dw(genHTML(headlines2005[i],"<tr><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines2005[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines2005[i],"</td></tr>"));
        stripe=1;
        
    }
  
    
  }
  
  dw(genHTML(quote[0],"</table>"));
}

function writeHeadlines2006(){

  var stripe=1;

  dw("<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='stock exchange'>");
  dw("<tr><th class='left' colspan='2'>stock exchange</th></tr>");

  for (var i=0;i<headlines2006.length;i++){
  
    if (stripe==1) {
     
        dw(genHTML(headlines2006[i],"<tr class='stripe'><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines2006[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines2006[i],"</td></tr>"));
        stripe=0;
        
    }
    
    else if (stripe==0) {
     
        dw(genHTML(headlines2006[i],"<tr><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines2006[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines2006[i],"</td></tr>"));
        stripe=1;
        
    }
  
    
  }
  
  dw(genHTML(quote[0],"</table>"));
}

function writeHeadlines2007(){

  var stripe=1;

  dw("<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='stock exchange'>");
  dw("<tr><th class='left' colspan='2'>stock exchange</th></tr>");

  for (var i=0;i<headlines2007.length;i++){
  
    if (stripe==1) {
     
        dw(genHTML(headlines2007[i],"<tr class='stripe'><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines2007[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines2007[i],"</td></tr>"));
        stripe=0;
        
    }
    
    else if (stripe==0) {
     
        dw(genHTML(headlines2007[i],"<tr><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>"));
        dw(fmtDate(genHTML(headlines2007[i],"%newsdate%"), "dd/MM/yyyy&nbsp;&nbsp;hh:mm:ss" ));
        dw(genHTML(headlines2007[i],"</td></tr>"));
        stripe=1;
        
    }
  
    
  }
  
  dw(genHTML(quote[0],"</table>"));
}
*/
function writeHeadlines(sYear)
{
 if (sYear == undefined)
        sYear="Last12Months";
  var stripe=1;

  dw("<table width='100%' border='0' cellspacing='0' cellpadding='0' summary='stock exchange'>");
  dw("<tr><th class='left' colspan='2'>stock exchange</th></tr>");
 
  var headlines = eval('headlines' + sYear);
  for (var i=0;i<headlines.length;i++)
  {
    if (stripe==1) 
    {
        dw(genHTML(headlines[i],"<tr class='stripe'><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>%newsdate%</td></tr>"));
        stripe=0;
    }
    
    else if (stripe==0) 
    {
        dw(genHTML(headlines[i],"<tr class='left'><td class='left'><a href=\"javascript:openArticle('%articleid%');\">%headline%</a></td><td class='left'>%newsdate%</td></tr>"));
        stripe=1;
    }
  }
  
  dw(genHTML(quote[0],"</table>"));
}

//-->

