///////////////TRIM KEY///////////////////
function trim(Key) {
	while(''+Key.charAt(Key.length-1)==' ')
		{ Key=Key.substring(0,Key.length-1); }
	return Key;
}

/////////////VALIDATE SETTINGS//////////////

function validateSettings() {	
	
	a = document.frmModifPasswd;
	a.txtNew.value = trim(a.txtNew.value);
	if (a.txtNew.value=="") {
		alert('Enter the new password!');
		a.txtNew.focus();
		return false;
	}
}

/////////////VALIDATE INVENTORY//////////////

function validateInventory() {
	
	a = document.frmCar;
	a.make.value = trim(a.make.value);
	if (a.make.value=="") {
		alert('Enter the make!');
		a.make.focus();
		return false;
	}
	a.model.value = trim(a.model.value);
	if (a.model.value=="") {
		alert('Enter the model!');
		a.model.focus();
		return false;
	}
	a.year.value = trim(a.year.value);
	if (a.year.value=="") {
		alert('Enter the year!');
		a.year.focus();
		return false;
	}
	a.price.value = trim(a.price.value);
	if (a.price.value=="") {
		alert('Enter the price!');
		a.price.focus();
		return false;
	}
	a.smallPic.value = trim(a.smallPic.value);
	if (a.smallPic.value=="") {
		alert('Enter the smallPic!');
		a.smallPic.focus();
		return false;
	}
	a.bigPic.value = trim(a.bigPic.value);
	if (a.bigPic.value=="") {
		alert('Enter the bigPic!');
		a.bigPic.focus();
		return false;
	}
}

////////////POPUP RESIZED - OPEN WINDOW//////////////////////
function openWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { 
		win.window.focus(); 
	}
}
