﻿// Swap Functions

imagepath = "";
// Preload images - ON


	//coldOn = new Image();
	//coldOn.src = imagepath + "COLDOn.jpg";
	
//Preload images - OFF

	//coldOff = new Image();
	//coldOff.src = imagepath + "COLDOff.jpg";

// Image Rollovers
function menuSwap(img){
	if (document.images) {
		document [img].src = eval(img + "On.src");
		
	}
}

function menuUnSwap(img){
    if (document.images) {
		document [img].src = eval(img + "Off.src");
		
	}
}

function popWin(url,w,h){
	window.open(url,"bios","width="+w+",height="+h+",scrollbars=1,resizable=1")
}

var old = 'step_1';
function menuOpen(menu){
	menuObj = document.getElementById(menu);
	oldObj = document.getElementById(old);
	
	menuObj.style.display = "block";
	if(old && old != menu) { 
		oldObj.style.display = "none";
	}
	old = menu;
}

var container = new Array(0,0,0,0);

function checkForm(){
	passFail = 1;
	formName = document.getElementById('quoteForm');
	
	for(i=0;i<container.length;i++){
		if(container[i] != 1){
			passFail = 0;
		}
	}
	
	if(passFail){
		menuOpen('submitting');
		formName.submit();
	} else {
		alert('please fill required fields.');
		menuOpen('step_1');
		return false;
	}
}

function checkRequired(val,name, valSwitch){
	if(val.value==""){
		alert("a valid " + name + " is required");
		container[valSwitch] = 0;
	} else {
		container[valSwitch] = 1;
	}
	
}

function checkNext(cur){
	if(container[cur] == 0){
		alert('please fill in required fields');
	} else {
		menuOpen('step_'+(cur+1));
	}
}
function checkNext2(cur,cur2){
	if(container[cur] == 0 || container[cur2] == 0){
		alert('please fill in required fields');
	} else {
		document.quoteForm.submit();
	}
}
