// JScript source code
//Developer: Frank Zakikian

// script constants
var imagedefault='wheel_images/nophoto.jpg';

// shorthand for document.getElementById
function d(o){
	return document.getElementById(o);
}

// our function to load the image
function loadimage(imgId){
  var image = d(imgId);
  // reset image to our imageDefault (path) constant
  //image.style.height='160px';
  //image.style.width='180px';
  image.className='imgWheelCat';
  image.src=imagedefault;
}

function changeMake(form, destination){
	var vehMod=d('idModel');
	var vehYr=d('idYear');
	ClearBWno();
	vehYr.selectedIndex=-1;
  vehMod.selectedIndex=-1;
  form.action = destination;
  form.submit();
  }

function changeModel(form, destination){
	var vehYr=d('idYear')
	ClearBWno();
	vehYr.selectedIndex=-1;
	form.action = destination;
	form.submit();
  }     
  
function changeYear(form, destination){
  ClearBWno();
	document.getElementById('idSubmit').disabled = false;
  form.action = destination;
  form.target = '_parent';
  //form.submit();
  }
  
function LoadWheelDetail(whKey,whNum,whImg){
  var form=d('idWheelDetailForm');
	var hidWh=d('idPartNum');
	var hidIm=d('idWheelImg');
	var hidID=d('idWheelKey');
	hidWh.value=whNum;
	hidIm.value=whImg;
	hidID.value=whKey;
	form.submit();
	}
	
function ValBWNo(str,targetID){
	var btn=d(targetID);
	if(str.length<3){
		btn.style.color='lightgray';
		btn.disabled=true;	
		return;
		}
	btn.style.color='blue';
	btn.disabled=false;
	}

function ClearBWno(){
	var bwno=d('idBWPart');
	bwno.value='';
	}