//If using image buttons as controls, Set image buttons' image preload here true
//(use false for no preloading and for when using no image buttons as controls):
var preload_ctrl_images=false;

//And configure the image buttons' images here:
var previmg='/graphics/slide/left.gif';
var stopimg='/graphics/slide/stop.gif';
var playimg='/graphics/slide/play.gif';
var nextimg='/graphics/slide/right.gif';

var slides=[]; //FIRST SLIDESHOW
//configure the below images and descriptions to your own. 
slides[0] = ["/graphics/slide/photo1.jpg", ""];
slides[1] = ["/graphics/slide/photo2.jpg", ""];
slides[2] = ["/graphics/slide/photo3.jpg", ""];
slides[3] = ["/graphics/slide/photo4.jpg", ""];
slides[4] = ["/graphics/slide/photo5.jpg", ""];
//above slide show uses only the defaults

var slides2=[]; //SECOND SLIDESHOW
//configure the below images and descriptions to your own. 
slides2[0] = ["/graphics/slide/photo1.jpg", ""];
slides2[1] = ["/graphics/slide/photo2.jpg", ""];
slides2[2] = ["/graphics/slide/photo3.jpg", ""];
slides2[3] = ["/graphics/slide/photo4.jpg", ""];
slides2[4] = ["/graphics/slide/photo5.jpg", ""];
//optional properties for these images:
slides2.desc_prefix='<b>Description:<\/b> '; //string prefix for image descriptions display
slides2.controls_top=1; //use for top controls
slides2.counter=1; //use to show image count
slides2.width=140; //use to set width of widest image if dimensions vary
slides2.height=225; //use to set height of tallest image if dimensions vary
slides2.no_auto=1; //use to make show completely user operated (no play button, starts in stopped mode)
slides2.use_alt=1; //use for descriptions as images alt attributes
slides2.use_title=1; //use for descriptions as images title attributes
slides2.nofade=1; //use for no fade-in, fade-out effect for this show
slides2.border=2; //set border width for images
slides2.border_color='lightblue'; //set border color for images

var slides3=[]; //THIRD SLIDESHOW
//configure the below images and descriptions to your own, note optional links, target and window specifications. 
slides3[0] = ["/graphics/slide/photo1.jpg", ""];
slides3[1] = ["/graphics/slide/photo2.jpg", ""];
slides3[2] = ["/graphics/slide/photo3.jpg", ""];
slides3[3] = ["/graphics/slide/photo4.jpg", ""];
slides3[4] = ["/graphics/slide/photo5.jpg", ""];
slides3[5] = ["/graphics/slide/photo6.jpg", ""];
slides3[6] = ["/graphics/slide/photo7.jpg", ""];
slides3[7] = ["/graphics/slide/photo8.jpg", ""];
slides3[8] = ["/graphics/slide/photo9.jpg", ""];
slides3[9] = ["/graphics/slide/photo10.jpg", ""];
slides3[10] = ["/graphics/slide/photo11.jpg", ""];
slides3[11] = ["/graphics/slide/photo12.jpg", ""];
slides3[12] = ["/graphics/slide/photo13.jpg", ""];
slides3[13] = ["/graphics/slide/photo14.jpg", ""];
slides3[14] = ["/graphics/slide/photo15.jpg", ""];
slides3[15] = ["/graphics/slide/photo16.jpg", ""];
slides3[16] = ["/graphics/slide/photo17.jpg", ""];
slides3[17] = ["/graphics/slide/photo18.jpg", ""];
slides3[18] = ["/graphics/slide/photo19.jpg", ""];
slides3[19] = ["/graphics/slide/photo20.jpg", ""];
slides3[20] = ["/graphics/slide/photo21.jpg", ""];
slides3[21] = ["/graphics/slide/photo22.jpg", ""];
slides3[22] = ["/graphics/slide/photo23.jpg", ""];
slides3[23] = ["/graphics/slide/photo24.jpg", ""];
slides3[24] = ["/graphics/slide/photo25.jpg", ""];
slides3[25] = ["/graphics/slide/photo26.jpg", ""];
slides3[26] = ["/graphics/slide/photo27.jpg", ""];
slides3[27] = ["/graphics/slide/photo28.jpg", ""];
slides3[28] = ["/graphics/slide/photo29.jpg", ""];
slides3[29] = ["/graphics/slide/photo30.jpg", ""];
//optional properties for these images:
slides3.no_descriptions=1; //use for no descriptions displayed
slides3.pause=1; //use for pause onmouseover
slides3.image_controls=1; //use images for controls
slides3.button_highlight='#cccccc'; //onmouseover background-color for image buttons (requires image_controls=1)
slides3.specs='width=300, height=200' //global specifications for this show's new window(s)
slides3.random=1; //set a random slide sequence on each page load
slides3.manual_start=0; //start show in manual mode (stopped)

//Notes:
//slides#.target will set a target for a slide group, will be overridden by slides#[#][3], if present
//slides#.specs will set new window specifications for a slide group, will be overridden by slides#[#][4], if present
//slides#.fadecolor will set fading images background color, defaults to white
//slides#.no_controls will set a slide show with no controls
//slides#.random will set a random slide sequence on each page load
//slides#.delay=3000 will set miliseconds delay between slides for a given show, may also be set in the call as the last parameter
//slides#.jumpto=1 will display added controls to jump to a particular image by its number
//slides#.no_added_linebreaks=1; use for no added line breaks in formatting of texts and controls

//use below to create a customized onclick event for linked images in a given show:
//slides#.onclick="window.open(this.href,this.target,'top=0, left=0, width='+screen.availWidth+', height='+screen.availHeight);return false;"

function resetForm () {
	var makeList = document.vs.make;
	var modelList = document.vs.model;
	makeList.options.length = 0;
  makeList.options[0] = new Option("MAKE","",0,1);
 	modelList.options.length = 0;
 	modelList.options[0] = new Option("MODEL","",0,1);
}
function vehicleSearch() {
 var yearSelected = document.vs.year.options[document.vs.year.selectedIndex].value;
 var makeList = document.vs.make;
 var modelList = document.vs.model;
 var makeSelected = makeList.options[makeList.selectedIndex].value;
 var modelSelected = modelList.options[modelList.selectedIndex].value;
 var url = '/ecom/php/pt.vehicleSearch.php/?year=' + escape(yearSelected) + '&make=' + escape(makeSelected) + '&model=' + escape(modelSelected);
 http.open("GET", url, true);
 http.onreadystatechange = handleHttpResponse;
 http.send(null);
}

function handleHttpResponse() { 
	if (http.readyState == 4) { // Split the comma delimited response into an array  
		results = http.responseText.split(","); 
	  var yearSelected = document.vs.year.options[document.vs.year.selectedIndex].value;
	  var makeList = document.vs.make;
	  var modelList = document.vs.model;
	  var applicationGuideID = document.vs.applicationGuideID;
	  var makeSelected = makeList.options[makeList.selectedIndex].value;
	  var modelSelected = modelList.options[modelList.selectedIndex].value;
	  var optionSelected;
	  var makes = new Array();
	  var models = new Array();
	  if (yearSelected) {
	  	var listIndex = 0;
			if (!makeSelected && !modelSelected) {
				makeList.options.length = 0;
			  makeList.options[0] = new Option("MAKE","",0,1);
				for (index in results) {
		 	  	listIndex++;
			 	    optionSelected = 0;
		 	    if (makeSelected == results[index]) {
		 	      optionSelected = 1;
		 	    }
		 	     makeList.options[listIndex] = new Option(results[index],results[index],0,optionSelected);
		 	  }
			} else if (makeSelected && !modelSelected) {
		  	modelList.options.length = 0;
		  	modelList.options[0] = new Option("MODEL","",0,1);
	  	  listIndex = 0;
				for (index in results) {
		 	  	listIndex++;
			 	    optionSelected = 0;
		 	    if (modelSelected == results[index]) {
		 	      optionSelected = 1;
		 	    }
		 	     modelList.options[listIndex] = new Option(results[index],results[index],0,optionSelected);
		 	  }
			} else if (yearSelected && makeSelected && modelSelected) {
				document.vs.applicationGuideID.value = results;
			}
		}
	} 
}
function getHTTPObject() { 
	var xmlhttp; /*@cc_on 
	@if (@_jscript_version >= 5) 
		try { 
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
		} catch (e) { 
			try { 
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
			} catch (E) { 
				xmlhttp = false; 
			} 
		} 
	@else 
	xmlhttp = false; 
	@end @*/  
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 
		try { 
			xmlhttp = new XMLHttpRequest(); 
		} catch (e) { 
			xmlhttp = false; 
		} 
	} 
	return xmlhttp;
} 
var http = getHTTPObject(); // We create the HTTP Object 
function processVS() {
  var bSuccess = false;
  if(document.vs.year && document.vs.year.value != "") {
    if(document.vs.make && document.vs.make.value != "") {
      if(document.vs.model && document.vs.model.value != "") {
        bSuccess = true;
      }
    }
  }
  if(!bSuccess) {
    alert('Please make selections in all three fields in the Vehicle Matcher to get results.');
	}
  return bSuccess;
}
