// JavaScript Document
function showPic (whichpic) {
if (document.getElementById) {
document.getElementById('placeholder').src = whichpic.href;
  if (whichpic.title) {
   document.getElementById('desc').innerHTML = whichpic.rev;
  } else {
   document.getElementById('desc').innerHTML = "";
  }
  return false;
 } else {
  return true;
 }
}

//javascript for static grid tie estimator page








//**********************************************tooltip code*************************************************************************


//*********************************************************** SUN MAP IMAGE HOVER CHANGE ************************************************
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImagesSunMap() {
	if (document.images) {
		SunInsolationUS_finished__01_ImageMap_11_over = newImage("images/SunInsolationUS%28finished-02.jpg");
		SunInsolationUS_finished__01_ImageMap_01_over = newImage("images/SunInsolationUS%28finished-03.jpg");
		SunInsolationUS_finished__01_ImageMap_04_over = newImage("images/SunInsolationUS%28finished-04.jpg");
		SunInsolationUS_finished__01_ImageMap_03_over = newImage("images/SunInsolationUS%28finished-05.jpg");
		SunInsolationUS_finished__01_ImageMap_02_over = newImage("images/SunInsolationUS%28finished-06.jpg");
		preloadFlag = true;
	}
}
//************************************************* CODE FOR GT ESTIMATOR CALCULATIONS ****************************************

<!--
function enter_sunhrs(hrs)
{
document.getElementById('txt_sunhrs').value = Number(hrs);
}
function gt_check()
{
if(isNaN(document.getElementById('txt_akwh').value) || Trim(document.getElementById('txt_akwh').value) == "" || Trim(document.getElementById('txt_akwh').value) == 0){
window.alert('Please enter only valid numbers, including decimals in the monthly electrical use field');
document.getElementById('txt_akwh').select();
document.getElementById('txt_akwh').focus();
}
else if(isNaN(document.getElementById('txt_bill').value) && Trim(document.getElementById('txt_bill').value) != "" && Trim(document.getElementById('txt_bill').value) != 0){
window.alert('Please enter only valid numbers, including decimals, or leave this field blank');
document.getElementById('txt_bill').select();
document.getElementById('txt_bill').focus();
}
else if(isNaN(document.getElementById('txt_percent').value) || Trim(document.getElementById('txt_percent').value) == ""|| Trim(document.getElementById('txt_percent').value) == 0){
window.alert('Please enter only valid numbers, including decimals');
document.getElementById('txt_percent').select();
document.getElementById('txt_percent').focus();
}
else if(isNaN(document.getElementById('txt_sunhrs').value) || Trim(document.getElementById('txt_sunhrs').value) == "" || Trim(document.getElementById('txt_sunhrs').value) == 0){
window.alert('Please enter only valid numbers, including decimals');
document.getElementById('txt_sunhrs').select();
document.getElementById('txt_sunhrs').focus();
}
else if(document.getElementById('txt_sunhrs').value > 7) {
window.alert('Too Many Sun Hours.  The most possible is 7!');
document.getElementById('txt_sunhrs').select();
document.getElementById('txt_sunhrs').focus();
}
else{
document.gt-form.submit();	
}
}
function gt_calc()
{
if(isNaN(document.getElementById('txt_akwh').value) || Trim(document.getElementById('txt_akwh').value) == ""){
window.alert('Please enter only valid numbers, including decimals');
document.getElementById('txt_akwh').select();
document.getElementById('txt_akwh').focus();
}
else if(isNaN(document.getElementById('txt_bill').value) && Trim(document.getElementById('txt_bill').value) != ""){
window.alert('Please enter only valid numbers, including decimals');
document.getElementById('txt_bill').select();
document.getElementById('txt_bill').focus();
}
else if(isNaN(document.getElementById('txt_percent').value) || Trim(document.getElementById('txt_percent').value) == ""){
window.alert('Please enter only valid numbers, including decimals');
document.getElementById('txt_percent').select();
document.getElementById('txt_percent').focus();
}
else if(isNaN(document.getElementById('txt_sunhrs').value) || Trim(document.getElementById('txt_sunhrs').value) == ""){
window.alert('Please enter only valid numbers, including decimals');
document.getElementById('txt_sunhrs').select();
document.getElementById('txt_sunhrs').focus();
}
else if(document.getElementById('txt_sunhrs').value > 7) {
window.alert('Are you serial?');
document.getElementById('txt_sunhrs').select();
document.getElementById('txt_sunhrs').focus();
}
else{
var bill = Number(document.getElementById('txt_bill').value);
var akwh = Number(document.getElementById('txt_akwh').value);
var percent = Number((document.getElementById('txt_percent').value) / 100);
var sunhrs = Number(document.getElementById('txt_sunhrs').value);
var system_wattage = Math.round(((((akwh * percent) / 30) / sunhrs) / .80) * 1000);
var c02 = Number((system_wattage * 12) * 1.55);
var trees = Number((system_wattage * 12) / 445);
var savings1 = Number(bill * 12);
var savings15 = Number(bill * 180);
var savings20 = Number(bill * 240);
var housevalue = Number(savings1 * 20);
//document.getElementById(label + '_watt_hrs').value = watt_hrs;
//window.alert(system_wattage);
if(bill != 0 || bill != ""){
document.getElementById('financial').innerHTML = "<br /><span style=\"padding:5px; width:98%; display:block; position:relative; background-color:#cccccc;\"><strong>Financial Benefits</strong></span>";

document.getElementById('utilize').innerHTML = "<p><strong>If you utilize solar for 100% of your electricity needs, </p></strong>";
document.getElementById('housevalue').innerHTML = "<strong>You will add $" + housevalue.toFixed(2) + " in value to your home</strong>";
document.getElementById('savings1').innerHTML = "<strong>Over a year, you will save  $" + savings1.toFixed(2) + " in electric bills</strong>";
document.getElementById('savings15').innerHTML = "<strong>Over 15 years, you will save  $" + savings15.toFixed(2) + " in electric bills</strong>";
document.getElementById('savings20').innerHTML = "<strong>Over 20 years, you will save $" + savings20.toFixed(2) + " in electric bills</strong>";
}
document.getElementById('trees').innerHTML = "<strong>You will eliminate  " + Math.round(c02) + " lbs. of C02 per year and this is equivalent to planting " + Math.round(trees) + " trees every year</strong><br /><img src=\"/images/Trees.gif\" />";

document.getElementById('environmental').innerHTML = "<span style=\"padding:5px; width:98%; display:block; position:relative; background-color:#cccccc;\"><strong>Environmental Benefits</strong></span><br />";
document.getElementById('wattage').innerHTML = "<strong>You will need a system producing <span style=\"color:#000; font-weight:bold;\">" + (system_wattage / 1000).toFixed(2) + "</span> DC kW to cover " + Math.round(percent * 100) + "% of your monthly power usage</strong>";
if (calculate == 1){
document.getElementById('system').innerHTML = "<strong>Recommended System: " + system + "</strong>";
document.getElementById('rec_system').innerHTML = "<span style=\"padding:5px; width:98%; display:block; position:relative; background-color:#cccccc;\"><strong>Recommended System</strong></span><br />";

}

}
}
<!--
/* Script by: www.jtricks.com
 * Version: 20070301
 * Latest version:
 * www.jtricks.com/javascript/window/box.html
 */
// Moves the box object to be directly beneath an object.
function move_box(an, box)
{
    var cleft = 0;
    var ctop = 0;
    var obj = an;

    while (obj.offsetParent)
    {
        cleft += obj.offsetLeft;
        ctop += obj.offsetTop;
        obj = obj.offsetParent;
    }

    box.style.left = cleft + 'px';

    ctop += an.offsetHeight + 8;

    // Handle Internet Explorer body margins,
    // which affect normal document, but not
    // absolute-positioned stuff.
    if (document.body.currentStyle &&
        document.body.currentStyle['marginTop'])
    {
        ctop += parseInt(
            document.body.currentStyle['marginTop']);
    }

    box.style.top = ctop + 'px';
}

// Shows a box if it wasn't shown yet or is hidden
// or hides it if it is currently shown
function show_hide_box(an, width, height, borderStyle)
{
    var href = an.href;
    var boxdiv = document.getElementById(href);

    if (boxdiv != null)
    {
        if (boxdiv.style.display=='none')
        {
            // Show existing box, move it
            // if document changed layout
            move_box(an, boxdiv);
            boxdiv.style.display='block';

            bringToFront(boxdiv);

            // Workaround for Konqueror/Safari
            if (!boxdiv.contents.contentWindow)
                boxdiv.contents.src = href;
        }
        else
            // Hide currently shown box.
            boxdiv.style.display='none';
        return false;
    }

    // Create box object through DOM
    boxdiv = document.createElement('div');

    // Assign id equalling to the document it will show
    boxdiv.setAttribute('id', href);

    boxdiv.style.display = 'block';
    boxdiv.style.position = 'absolute';
    boxdiv.style.width = width + 'px';
    boxdiv.style.height = height + 'px';
    boxdiv.style.border = borderStyle;
    boxdiv.style.textAlign = 'right';
    boxdiv.style.padding = '4px';
    boxdiv.style.background = '#FFFFFF';
    document.body.appendChild(boxdiv);

    var offset = 0;

    // Remove the following code if 'Close' hyperlink
    // is not needed.
    var close_href = document.createElement('a');
    close_href.href = 'javascript:void(0);';
    close_href.onclick = function()
        { show_hide_box(an, width, height, borderStyle); }
    close_href.appendChild(document.createTextNode('Close'));
    boxdiv.appendChild(close_href);
    offset = close_href.offsetHeight;
    // End of 'Close' hyperlink code.

    var contents = document.createElement('iframe');
    //contents.scrolling = 'no';
    contents.overflowX = 'hidden';
    contents.overflowY = 'scroll';
    contents.frameBorder = '0';
    contents.style.width = width + 'px';
    contents.style.height = (height - offset) + 'px';

    boxdiv.contents = contents;
    boxdiv.appendChild(contents);

    move_box(an, boxdiv);

    if (contents.contentWindow)
        contents.contentWindow.document.location.replace(
            href);
    else
        contents.src = href;

    // The script has successfully shown the box,
    // prevent hyperlink navigation.
    return false;
}

function getAbsoluteDivs()
{
    var arr = new Array();
    var all_divs = document.body.getElementsByTagName("DIV");
    var j = 0;

    for (i = 0; i < all_divs.length; i++)
        if (all_divs.item(i).style.position=='absolute')
        {
            arr[j] = all_divs.item(i);
            j++;
        }

    return arr;
}

function bringToFront(obj)
{
    if (!document.getElementsByTagName)
        return;

    var divs = getAbsoluteDivs();
    var max_index = 0;
    var cur_index;

    // Compute the maximal z-index of
    // other absolute-positioned divs
    for (i = 0; i < divs.length; i++)
    {
        var item = divs[i];
        if (item == obj ||
            item.style.zIndex == '')
            continue;

        cur_index = parseInt(item.style.zIndex);
        if (max_index < cur_index)
        {
            max_index = cur_index;
        }
    }

    obj.style.zIndex = max_index + 1;
}

//-->
<!--
/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointer" src="images/arrow2.gif" style="visibility:hidden;">') //write out pointer image
document.onmousemove=positiontip;

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobj=document.all? document.all["dhtmlpointer"] : document.getElementById? document.getElementById("dhtmlpointer") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var nondefaultpos=false
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-e.clientX-offsetfromcursorX
var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-e.clientY-offsetfromcursorY

var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth){
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=curX-tipobj.offsetWidth+"px"
nondefaultpos=true
}
else if (curX<leftedge)
tipobj.style.left="5px"
else{
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetfromcursorX-offsetdivfrompointerX+"px"
pointerobj.style.left=curX+offsetfromcursorX+"px"
}

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight){
tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
nondefaultpos=true
}
else{
tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
pointerobj.style.top=curY+offsetfromcursorY+"px"
}
tipobj.style.visibility="visible"
if (!nondefaultpos)
pointerobj.style.visibility="visible"
else
pointerobj.style.visibility="hidden"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
pointerobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
var carbonFootPrint = '(Carbon footprint From Wikipedia, the free encyclopedia)Carbon footprint is a measure of the amount of carbon'
+' dioxide or CO2 emitted through the combustion of fossil fuels; in the case of an organization, business or enterprise, as part of'
+' their everyday operations; in the case of an individual or household, as part of their daily lives; or a product or commodity in'
+' reaching market. In materials, is essentially a measure of embodied energy, the result of life cycle analysis.'
+' A carbon footprint is often expressed as tons of carbon dioxide or tons of carbon emitted, usually on a yearly basis.';
document.onmousemove=positiontip;
// -->

