﻿ //This is the script that enables the news items to expand and contract.
 function makeVisible(whichNavs)
 {
 document.getElementById(whichNavs).style.display=(document.getElementById(whichNavs).style.display=="none")?"block":"none";
 }

Event.observe(window, 'load', init, false);


//INIT
//This is the loading function that is called above.

function init(){
		orangebox();
		greet();
		previous();
	}
	
	
	
	
// NAMES ARRAY
// Global array that is used by the 'greet' function.
// These names correspond to the various front page 'stories'
// that the user scrolls through

var names=new Array(4)
names[0]="01";
names[1]="02";
names[2]="03";	
names[3]="04";	
names[4]="05";	

i=1;

function iscript(){
		i = (i < (names.length - 1))?i + 1 : 0;
}



	
// GREET
// this function cycles through the NAMES array and addes 
// the corresponding background style to the 'BG' div.

// It then takes the name from the array and pulls in the story content from
// it's corresponding .php file in the includes directory.
function greet(){

var next = $("next");
var bg = $("bg");

next.onclick = function (){

	Element.setStyle(bg, {background:"url(images/main/bg-" + names[i] + ".jpg) top left no-repeat"});
	new Ajax.Updater("intro", "includes/" + names[i] +".php", {method: 'get'});
	iscript('+');
	
	}
}



// ORANGE BOX
// this manually tells the browser to change the background style
// to be orange on mouse over, and back to gray for mouse out, for the 
// option boxes at the bottom of the page.


function orangebox() {
	var customers = $("customers");
	var getstarted = $("getstarted");
	var testdrive = $("testdrive");
	var learnmore = $("learnmore");
	
	customers.onmouseover = function() {
		Element.setStyle(customers, {background:'url(images/options/orangebox.jpg) top left no-repeat'});
		}
	
		customers.onmouseout = function() {
		Element.setStyle(customers, {background:'url(images/options/graybox.jpg) top left no-repeat'});
		}
		
		
	getstarted.onmouseover = function() {
		Element.setStyle(getstarted, {background:'url(images/options/orangebox.jpg) top left no-repeat'});
		}
	
		getstarted.onmouseout = function() {
		Element.setStyle(getstarted, {background:'url(images/options/graybox.jpg) top left no-repeat'});
		}
		
		
		
	testdrive.onmouseover = function() {
		Element.setStyle(testdrive, {background:'url(images/options/testdrivebox-orange.jpg) top left no-repeat'});
		}
	
		testdrive.onmouseout = function() {
		Element.setStyle(testdrive, {background:'url(images/options/testdrivebox.jpg) top left no-repeat'});
		}
		
		

	learnmore.onmouseover = function() {
		Element.setStyle(learnmore, {background:'url(images/options/orangebox.jpg) top left no-repeat'});
		}
	
		learnmore.onmouseout = function() {
		Element.setStyle(learnmore, {background:'url(images/options/graybox.jpg) top left no-repeat'});
		}
	
	}





