var theImages = new Array();
var newImage;

theImages[0] = 'url('+root+'images/backgrounds/001.gif)';
theImages[1] = 'url('+root+'images/backgrounds/002.gif)';
theImages[2] = 'url('+root+'images/backgrounds/003.gif)';
theImages[3] = 'url('+root+'images/backgrounds/004.gif)';
theImages[4] = 'url('+root+'images/backgrounds/005.gif)';
theImages[5] = 'url('+root+'images/backgrounds/006.gif)';
theImages[6] = 'url('+root+'images/backgrounds/007.gif)';
theImages[7] = 'url('+root+'images/backgrounds/008.gif)';
theImages[8] = 'url('+root+'images/backgrounds/009.gif)';
theImages[9] = 'url('+root+'images/backgrounds/010.gif)';
theImages[10] = 'url('+root+'images/backgrounds/011.gif)';
theImages[11] = 'url('+root+'images/backgrounds/012.gif)';

function init()
{



	if (document.getElementById){
		var x = document.getElementById('header_nav').getElementsByTagName('img');
            }
	else if (document.all) {
		var x = document.all['header_nav'].all.tags('img');
            }
	else {
             return;
          }
	var preloads = new Object();
	for (var i=0;i<x.length;i++)
	{
		
		preloads['n'+x[i].id] = new Image;
		preloads['n'+x[i].id].src = root+'images/interface/'+ x[i].id + '_On.gif';
		
		preloads['o'+x[i].id] = new Image;
		preloads['o'+x[i].id].src = root+'images/interface/'+ x[i].id + '_Off.gif';
		preloads['o'+x[i].id].onerror = function () {this.src=root+'images/interface/default.gif'}
		x[i].onmouseover = function () {this.src=preloads['n'+this.id].src;}
		x[i].hover = function () {this.src=preloads['n'+this.id].src;}
		x[i].onmouseout = function () {this.src=preloads['o'+this.id].src;}
	}
	
	//This selects a random background image on the page load
	var bgimage=theImages[(Math.round(Math.random()*(theImages.length-1)))]
	//document.getElementById('mainBody').style.backgroundImage = bgimage;

	
	
	

}

function changeImage(changer) {
	newImage = theImages[changer];
	document.getElementById('mainBody').style.backgroundImage = newImage;

}

function ShowDisplay(sectionS) {
    document.getElementById(sectionS).style.display = 'block'; 
}

function HideDisplay(sectionH) {
    document.getElementById(sectionH).style.display = 'none';
}

function formshowhide(id) {
    if (id == "quote") {
        document.getElementById('quotef').style.display = "block";
        document.getElementById('otherf').style.display = "none";
    }
    else {
        document.getElementById('quotef').style.display = "none";
        document.getElementById('otherf').style.display = "block";
    }
}

function toggleMenu(objID,thisObj) {
	if (!document.getElementById) return;
		var ob = document.getElementById(objID).style;
		ob.display = (ob.display == 'block')?'none': 'block';
		var str = document.images[thisObj].src;
		var pos=str.indexOf("plus");
		document.images[thisObj].src = (pos > 0)?'images/interface/minus.jpg': 'images/interface/plus.jpg';
		
}

function submitSubscribeNow() {
    var strEmail = document.getElementById('ea').value;
    //alert("constant_Frame_Email.aspx?userEmail=" + strEmail);
    //window.open("http://visitor.constantcontact.com/d.jsp?ea=" + strEmail + "&m=1101900345378&p=oi", "blank");
    window.location = "constant_Iframe_Email.aspx?userEmail=" + strEmail;
}


    var bslideShowSpeed = 7000;
    var bcrossFadeDuration = 3;
    var Banner = new Array();
    var bt;
    var bj = 0;
    var bp = Banner.length;

    function runBannerSlideShow() {
        if (document.getElementById("SlideShow")) {
            if (document.all) {
                //document.getElementById("SlideShow").style.filter = "blendTrans(duration=2)";
                document.getElementById("SlideShow").style.filter = "blendTrans(duration=bcrossFadeDuration)";
                document.getElementById("SlideShow").filters.blendTrans.Apply();
            }
            if (Banner[bj][1] != '') {

                document.getElementById("SlideShowPic").style.display = '';
                document.getElementById("SlideShow").src = Banner[bj][1]; 
                document.getElementById("lnkSlideShow").href = Banner[bj][3]; 
                if (Banner[bj][4] == "1")
                    document.getElementById("lnkSlideShow").target = "_blank";

                if (document.all) {
                    document.getElementById("SlideShow").filters.blendTrans.Play();
                }
            }
            bj = bj + 1;
            if (bj >= Banner.length)
                bj = 0;

        }
        bt = setTimeout('runBannerSlideShow()', bslideShowSpeed);
    }
