// 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("http://www.affordable-solar.com/images/SunInsolationUS(finished-02.jpg");
		SunInsolationUS_finished__01_ImageMap_01_over = newImage("http://www.affordable-solar.com/images/SunInsolationUS(finished-03.jpg");
		SunInsolationUS_finished__01_ImageMap_04_over = newImage("http://www.affordable-solar.com/images/SunInsolationUS(finished-04.jpg");
		SunInsolationUS_finished__01_ImageMap_03_over = newImage("http://www.affordable-solar.com/images/SunInsolationUS(finished-05.jpg");
		SunInsolationUS_finished__01_ImageMap_02_over = newImage("http://www.affordable-solar.com/images/SunInsolationUS(finished-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');
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((akwh * 12) * 1.55);
var trees = Number((akwh * 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;
}

//-->
