// JavaScript Document

/*-----------------------------------------------------------------

AutoBoss Version 1.1 - Online Vehicle Inventory Manager

AutoBoss is (c) Copyright 2005 Curve2 Design.  All Rights Reserved.



THE WRITTEN AND GRAPHICAL CONTENT OF AUTOBOSS IS FULLY PROTECTED 

BY THE UNITED STATES COPYRIGHT LAWS AND INTERNATIONAL TREATY

PROVISIONS AND IS CONSIDERED A TRADE SECRET BELONGING TO THE 

COPYRIGHT HOLDER.



ANY UNAUTHORIZED REPRODUCTION OR DISTRIBUTION OF AUTOBOSS IN PART

OR IN ITS ENTIRETY IS STRICTLY PROHIBITED.



For more information visit: www.curve2.com/license-autoboss.php

-----------------------------------------------------------------*/



// verify required fields

function checkrequired(form) {

	var pass = true;

	for(i = 0; i < form.length; i++) {

		var tempobj = form.elements[i];

		if(tempobj.alt == "required") {

			if(tempobj.value == '') {

				pass = false;

				break;

			}

		}

	}

	if(!pass) {

		alert("Please enter the required information.");

		tempobj.focus(); // set focus to missing field

		return false;

	}

	else { return true; } 

}



// image swap for view page

function swap(target, fname) {

	document[target].src = "images/" + fname;

}



// make sure at least one search criteria has been provided

function checksearch(form) {

	var count = 0;

	

	for(i = 0; i < form.length; i++) {

		var tempobj = form.elements[i];

		if(tempobj.value == '') {

			count++;

		}

	}

	i-=2;

	if(count == i) {

		alert("You have not entered any search criteria.");

		return false;

	}

	else {

		//alert("You DID enter search criteria." + count + "  " + i);

		return true;

	} 

}



// confirm removal of vehicle listing

function verify_removal(ccode) {

	msg = "Are you sure you want to remove this listing?";

	if(confirm(msg)) {

		window.location='remove.php?ccode=' + ccode;

	} else {

		return false;

	}

}



// confirm removal of image from vehicle listing

function verify_image(imageid, ccode) {

	msg = "Are you sure you want to remove this image?";

	if(confirm(msg)) {

		window.location='removeimg.php?id=' + imageid + '&ccode=' + ccode;

	} else {

		return false;

	}

}



// display invalid stock number message

function invalid_stock(stock) {

	msg = "The stock number " + stock + " appears to be invalid.";

	if(confirm(msg)) {

		window.location='cpanel.php';

	} else {

		window.location='cpanel.php';

	}

}

