/* ********* THERE ARE FIVE SCRIPTS USED *********/

function art()// 1. Set initial exhibit on select option and display in iframes
{
 document.getElementById("iframe-art").src="art-auction/images/sue-coe.jpg";
 document.getElementById("iframe-info").src="art-auction/info/sue-coe.html";
 document.getElementById("artImage").artists.options[0].selected=true;
 document.getElementById("artImage").artists.focus();
}

function selectArtist()// 2. Get data for selected artist and dispaly
{
 var artist=document.getElementById("artImage").artists.value;   
 document.getElementById("iframe-art").src="art-auction/images/" + artist + ".jpg";
 document.getElementById("iframe-info").src="art-auction/info/" + artist + ".html"; 
}

function showAddressBox()// 3. Show address box on art_pledge-form
{
 document.getElementById("addressBox").style.visibility="visible"
}
function hideAddressBox()// 4. Hide address box on art_pledge-form
{
 document.getElementById("addressBox").style.visibility="hidden"
}

function backToForm()// 5. Return user to previous form
{
 window.history.go(-1)
}

function floatingWindow($file) // 6. Floating window for Invasive plants ??
{
 //$file="green_guide/?cPath=50";
 thisWindow = window.open($file, "Floating Window", "scrollbars=yes, width=645, height=450") 
}

function externalLinks()
{
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++)
  {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
  }
}
window.onload = externalLinks;


//-- JavaScript code written by Alan Simpson - www.coolnerds.com
//-- Do the calculation based on three passed values.
//-- Changed document.ConverTable to document.getElementById('ConverTable')to read id attribute in XHTML ratherthan name in HTMLas dir=" ..... Roger Lovejoy""
function calc(val,factor,putin)
 {
 if (val == "")
  {
  val = "0"
  }
  //Evaluate expression and display in appropriate table cell.  Math.round added by IWB
  evalstr = "document.getElementById('ConverTable')."+putin+ ".value = "
  evalstr += " Math.round( " + val + "*" + factor +" ) "
  eval(evalstr)
  {
  var totalgas=0
  var carbon=0
  //Without the Math.round() phrase it concatenates the text values of the answers not adds them (roger lovejoy : because the value is text)
   {
   totalgas=Math.round(document.getElementById('ConverTable').ans1.value) + Math.round(document.getElementById('ConverTable').ans2.value) + Math.round(document.getElementById('ConverTable').ans3.value) + Math.round(document.getElementById('ConverTable').ans4.value) + Math.round(document.getElementById('ConverTable').ans5.value) + Math.round(document.getElementById('ConverTable').ans6.value) + Math.round(document.getElementById('ConverTable').ans7.value) + Math.round(document.getElementById('ConverTable').ans8.value) + Math.round(document.getElementById('ConverTable').ans9.value) + Math.round(document.getElementById('ConverTable').ans10.value)
   }
   {
   carbon = Math.round( totalgas * 2.73 ) / 10 	//0.273 is the CO2 to C conversion factor (12/44th)
   }
   document.getElementById('ConverTable').totalgas.value = totalgas;
   document.getElementById('ConverTable').carbon.value = carbon;
  }
 }


/************* END OF WORKING SCRIPTS ***************/



function loadCredits()
{
//credits=window.open("includes/credits.htm","credits","scrollbars=no");
//window.credits.resizeTo(196,312)
}
// Some codeing bits //

/* 
window.alert('Art Exhibit ' + exhibit + ' to be displayed here'
+ '\n You cannot view another until you close this window.'); 
*/
   
/*
 picture=window.open("images/art-auction/" + exhibit + ".jpg","picture","scrollbars=yes");
 window.picture.resizeTo(450,400); 
 window.picture.focus()
 */
