function doConfigure( filePathAndName ) {
	//show msg
	var msgDiv = document.getElementById( "pleaseWaitMsgDiv" );
	msgDiv.style.display = "";
	msgDiv.style.visibility = "visible";
	//get scratchListId to configure
   	var checkBoxes = document.getElementsByName("scratchListCheckboxes");
	var scratchListId = "none";
	if( typeof filePathAndName == 'undefined' || filePathAndName == "" ) {
		for (var i = 0; i < checkBoxes.length; i++) {
			if( checkBoxes[i].checked ) {
				scratchListId = checkBoxes[i].value;
				break;
			}
		}
	}
	document.location = "ACCS_Sample_Config.cfm?scratchListId=" + scratchListId + "&filePathAndName=" + filePathAndName;
}
function showOrHideGroup( groupName ) {
	//get link element and div
	var link = document.getElementById( groupName );
	var div = document.getElementById( groupName + " Div" );
	//shor or hide div
	if( div.style.visibility == "hidden" ) {
		link.innerHTML = "<b>Hide " + groupName + "</b>";
		div.style.display = "";
		div.style.visibility = "visible";
	}else{
		link.innerHTML = "<b>Show " + groupName + "</b>";
		div.style.display = "none";
		div.style.visibility = "hidden";
	}
}
function cursor_wait() {
	document.body.style.cursor = 'wait';
}
function cursor_clear() {
	document.body.style.cursor = 'default';
}
function toggleOption(optionCode) {
	var modalWinMaskDiv = document.getElementById("modalWinMask");
	//do toggle request - don't want IE to cache so use random=new Date()
	var request = getRequest();
	request.open("get", "/vehicles/_inc/Config_ToggleOption.cfm?optionCode="+optionCode+"&random="+ new Date(), false);
	request.send(null);
	var result = trimString( request.responseText );
    //get response
	var returnParams = result.split("~~");
	//get toggle conflict
	var isConflict = returnParams[0];
    if ( isConflict == "yesConflict" ) {
		//show mask
		modalWinMaskDiv.style.height = document.body.scrollHeight + "px";
	    modalWinMaskDiv.style.width = document.body.clientWidth + "px";
	    modalWinMaskDiv.style.display = "";
	    modalWinMaskDiv.style.visibility = "visible";
		//get originating option code and description
		var originatingOptionCode = returnParams[1].split(";;")[0];
		var originatingOptionDesc = returnParams[1].split(";;")[1];
		var addOrDelete = returnParams[2];
		//set conflict div table content
		var conflictingOptionCodesAndDescs = returnParams[3].split(";;")
		var content = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" style=\"font-size:14px;background-color:FFFFFF;\">";
		if ( addOrDelete == "add" ){
			content += "<tr><td colspan=\"2\">The addition of option code: ";
			content += "<br><b>" + originatingOptionCode + " (" + originatingOptionDesc + ")</b><br>";
			content += "</td></tr><tr><td colspan=\"2\">requires selecting one of these options:</td></tr><tr><td colspan=\"2\"><hr></td></tr>";
			for (var i = 0; i < conflictingOptionCodesAndDescs.length; i++) {
				var conflictOptionCode = conflictingOptionCodesAndDescs[i].split("::")[0];
				var conflictOptionDesc = conflictingOptionCodesAndDescs[i].split("::")[1];
				content += "<tr><td><input type=\"checkbox\" onclick=\"resolveConflict('";
				content += conflictOptionCode;
				content += "');\"></td><td><b>";
				content += conflictOptionCode + " (" + conflictOptionDesc + ")";
				content += "</b></td></tr>";
			}
			content += "</table>";
		}else{
			content += "<tr><td colspan=\"2\">The removal of option code: ";
			content += "<br><b>" + originatingOptionCode + " (" + originatingOptionDesc + ")</b><br>";
			content += "</td></tr><tr><td colspan=\"2\">requires selecting one of these options:</td></tr><tr><td colspan=\"2\"><hr></td></tr>";
			for (var i = 0; i < conflictingOptionCodesAndDescs.length; i++) {
				var conflictOptionCode = conflictingOptionCodesAndDescs[i].split("::")[0];
				var conflictOptionDesc = conflictingOptionCodesAndDescs[i].split("::")[1];
				content += "<tr><td><input type=\"checkbox\" onclick=\"resolveConflict('";
				content += conflictOptionCode;
				content += "');\"></td><td><b>";
				content += conflictOptionCode + " (" + conflictOptionDesc + ")";
				content += "</b></td></tr>";
			}
			content += "</table>";
		}
	    //show conflict dialog and content
	    document.getElementById("conflictContent").innerHTML = content;
	    var conflictDiv = document.getElementById("conflictDialog");
		conflictDiv.style.top = document.body.scrollTop + 200;
        conflictDiv.style.left = 200;
		conflictDiv.style.display = "";
		conflictDiv.style.visibility = "visible";
		cursor_clear();
	}else{
		//show new option images for each option
		var optionList = "";
		var optionCodes = returnParams[1].split(";;");
		for (var i = 0; i < optionCodes.length; i++) {
			var optionString = optionCodes[i].split("::");
			var optionCode2 = optionString[0];
			var optionState = optionString[1];
			if ( optionState.toLowerCase() == "selected"){
				if (optionList == ""){
					optionList = optionCode2;
				}else{
					optionList = optionList+","+optionCode2;
				}
			}
			//sometimes we get no option code; i.e. Honda vehicles
			if ( optionCode2.length > 0 ) {
				var optionImage = document.getElementById("img" + optionCode2);
				var imagePath = "_img/" + optionState.toLowerCase() + ".gif";
				optionImage.src = imagePath;
				optionImage.title = optionState;
			}
            var checklistStatus =  document.getElementById("checklistStatus" + optionCode2);
            if( checklistStatus ){
                if( optionState.toLowerCase() == "selected" || optionState.toLowerCase() == "included" || optionState.toLowerCase() == "required" ){
                    checklistStatus.innerHTML = "-->";
                } else {
                    checklistStatus.innerHTML = "&nbsp;";
                }
            }
        }
		var checklistTables = document.getElementsByName( "checklistTable" );
		for( var i=0; i < checklistTables.length; i++ ){
			if( checklistTables[i].innerHTML.indexOf("-->") > -1 || checklistTables[i].innerHTML.indexOf("--&gt;") > -1 ){
				checklistTables[i].style.backgroundColor = "White";
			} else {
				checklistTables[i].style.backgroundColor = "Red";
			}
		}
        //update summary
		var buildid = document.getElementById("autobuildid").value;
		var request = getRequest();
		request.open("get", "/_inc/act_retrieve_Data.cfm?data=buildit&buildid=" + buildid + "&options=" + optionList, false);
		request.send(null);
		var result = trimString( request.responseText );
		document.getElementById("configoptionsinit").style.display = "none";
		document.getElementById("configurationoptions").style.display = "inline";
		document.getElementById("configurationoptions").innerHTML = result;
	}
	//hide mask
	var colorchoice = "color"+optionCode;
	if (document.getElementById(colorchoice) != null){
		doImageSwap(document.getElementById(colorchoice).value);
	}
	if ( isConflict != "yesConflict" ){
		modalWinMaskDiv.style.visibility = "hidden";
	}
	cursor_clear();
}
function resolveConflict(optionCode) {
	//hide conflict dialog
    document.getElementById("conflictDialog").style.visibility = "hidden";
    document.getElementById("conflictDialog").style.display = "none";
    //toggle selected conflict option
    toggleOption(optionCode);
}
function trimString(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function saveStyle( style, type ) {
	var request = getRequest();
	request.open("get", "/vehicles/_inc/act_SaveStyle.cfm?type="+type+"&style="+style, false);
	request.send(null);
	//show msg
	var msgDiv = document.getElementById( "styleSaveDiv" );
	var msgSpan = document.getElementById( "savemsg" );
	msgDiv.style.display = "inline";
	msgSpan.innerHTML = request.responseText;
}
// -->