	defaultReturnPeriod = 4//CUSTOMISE THIS:::::::::Note 5
graphAreaOffsetY = -60//Note 6
isGraphDivRelative = true //Note 1
lineThicknessX = 1
lineThicknessY = 2
toolTipsMovingBoundedMethod = 1

if(document.layers && isGraphDivRelative){
  nsAndRelative = true//leave this one.
  nsRelGraphDivToDocX = 37//Note 2
  nsRelGraphDivToDocY = 30
}
function ggPageOnload(){
  setComparisonsSelected()
}
loadedCompName1 = ''
loadedCompName2 = ''
loadedCompName3 = ''
loadedCompName4 = ''
function setComparisonsSelected(){
  for(i=0;i<comparatorsArray.length;i++){
    eval('document.chartForm.isCoyid'+(i+1)+'.value = "'+comparatorsArray[i][0] + '"')
    eval('document.chartForm.isComp'+(i+1)+'.value = "'+comparatorsArray[i][1] + '"')
    eval('loadedCompName'+(i+1)+' = "'+comparatorsArray[i][1]+'"')//These two create variables used by stopCompXSelection
    eval('loadedCompId'+(i+1)+' = "'+comparatorsArray[i][0]+'"')
  }
}
function getComparisons(){
  var comparisons = "";
    
  if(document.chartForm.theIndex.value != ""){comparisons += document.chartForm.theIndex.value + "@IT"}
  if(document.chartForm.theSector.value != ""){if(comparisons != ""){comparisons += ","} comparisons += document.chartForm.theSector.value + "@GRP"}
  if(document.chartForm.isCoyid1.value != ""){if(comparisons != ""){comparisons += ","} comparisons += document.chartForm.isCoyid1.value}
  if(document.chartForm.isCoyid2.value != ""){if(comparisons != ""){comparisons += ","} comparisons += document.chartForm.isCoyid2.value}
  if(document.chartForm.isCoyid3.value != ""){if(comparisons != ""){comparisons += ","} comparisons += document.chartForm.isCoyid3.value}
  if(document.chartForm.isCoyid4.value != ""){if(comparisons != ""){comparisons += ","} comparisons += document.chartForm.isCoyid4.value}
  
  if(comparisons != ""){comparisons = '&comparisons=' + comparisons}
  return comparisons  
}
function findCompany(whichComp){
  writeToDiv('errorDiv','')
  findWin = window.open("apps/findcompany.cfm?company="+escape(eval('document.chartForm.isComp'+whichComp+'.value')), "findWindow", "toolbar=no,menubar=no,height=500,width=400,location=no,scrollbars=yes,resizable=no,status=no,left=100,top=100");
  changingWhichComp = whichComp
}

function receiveDetails(coyid,name){
  theCoyid = coyid
  theCompName = name
  eval('document.chartForm.isCoyid'+changingWhichComp+'.value = unescape(theCoyid)')
  eval('document.chartForm.isComp'+changingWhichComp+'.value = unescape(theCompName)')
  eval('doShowTempComp'+changingWhichComp+' = true')
  eval('hasCompName'+changingWhichComp+' = true')
  self.location.hash = 'hasherrorDiV'
  writeToDiv('errorDiv','Please click &#145;Draw Graph&#146; to obtain company data')
}

function getCoyid(theString){
  theStringSplit = theString.split('@')
  return theStringSplit[0]
}

function stopCompXSelection(theCompNum){
  if(eval('document.chartForm.isComp'+theCompNum+'.value == loadedCompName'+theCompNum)){
    writeToDiv('errorDiv','')
    eval('document.chartForm.isCoyid'+theCompNum+'.value = loadedCompId'+theCompNum)
  } else {
    eval('document.chartForm.isCoyid'+theCompNum+'.value = ""')
    if(eval('document.chartForm.isComp'+theCompNum+'.value != ""')){
      writeToDiv('errorDiv','Please click &#145;Find&#146; to verify this company')
    } else {
      writeToDiv('errorDiv','')
    }
  }
  eval('document.chartForm.isComp'+theCompNum+'.focus()')
}
function setIndexSector(){
  var comparitorsArray = new Array()
  var indexArray = new Array()
  var sectorArray = new Array()
  var selectedIndex = ""
  var selectedSector = ""
  
  selectedComparitors = comparisonsParam
  comparitorsArray = selectedComparitors.split(",")
  for(i=0;i<comparitorsArray.length;i++){
    if(comparitorsArray[i].indexOf("@IT") != -1){
      indexArray = comparitorsArray[i].split("@")
      selectedIndex = indexArray[0]
    }
    if(comparitorsArray[i].indexOf("@GRP") != -1){
      sectorArray = comparitorsArray[i].split("@")
      selectedSector = sectorArray[0]
    }
  } 
  if(selectedIndex != ""){
    for(i=0;i<document.chartForm.theIndex.options.length;i++){
      if(document.chartForm.theIndex.options[i].value == selectedIndex){
        document.chartForm.theIndex.options[i].selected = true
        break
      }
    }
  }else{
   document.chartForm.theIndex.options[0].selected = true
  }
  
  if(selectedSector != ""){
    for(i=0;i<document.chartForm.theSector.options.length;i++){
      if(document.chartForm.theSector.options[i].value == selectedSector){
        document.chartForm.theSector.options[i].selected = true
        break
      }
    }
  }else{
   document.chartForm.theSector.options[0].selected = true
  }
}
function goToGraphURL(newURL){
  self.location.href = newURL;
}

///TOOLTIPS.
tooltipsHTMLBefore = '<table border="0" cellspacing="0" cellpadding="0" style="background-color: #000000"><tr><td><table width="1" border="0" cellspacing="0" cellpadding="0" style="font-family: Arial, Verdana, sans-serif; font-size: xx-small; background-color: #9999cc; color: #ffffff"><tr><td><nobr>'
tooltipsHTMLAfter = '<span id="tooltipsDivWidthFinder" style="position:relative; left:0px; top:0px; width:0px; height:0px; z-index:5; visibility:visible;"></span></nobr></td></tr></table></td></tr></table>'
if(document.layers){
  tooltipsStaticHTMLBefore = '<font style="font-family: Arial, Verdana, sans-serif; font-size:10px; background-color: #9999cc; color: #ffffff">'
  tooltipsStaticHTMLAfter = '</font>'
} else {
  tooltipsStaticHTMLBefore = ''
  tooltipsStaticHTMLAfter = ''
}

function onloadAllGG(){
  setPeriod()
  setReturnPeriod()
  setDateRange()
  setIndexSector()
  setAxisSelected()
  giveImageImgMap()
  ggPageOnload()
  nsCaptureEvents()
  setLineThickness()
  requiredMouseEvents()
  //hideTooltipsTrStatic()
}
