function checkLogin (theLoginForm) {

//form name: login
//username field: username
//password field: password

var user = theLoginForm.username.value;
var pass = theLoginForm.password.value;

if(user=="") {
	//document.login.username.focus();
	return false;
}
if(pass=="") {
	//document.login.password.focus();
	return false;
}

}


function searchGems () {

//select inputs: variety and nature

var variety = '*';
var nature = '*';

variety = document.searchbox.variety.value;
nature = document.searchbox.nature.value;

var urlRedirect = 'index.php?pageid=search&variety='+variety+'&nature='+nature+'&shape=*&treatment=*&color=*&weight=*&orderBy=entry_date&order=DESC&numPerPage=25&searchForm=true&resultCount=0';

window.location = urlRedirect;


}


function confirmDelete(item, str)
{
var urlRedirect = 'index.php?pageid=mystocks&action=delete&stockId='+item+str;

if(confirm('Are you sure you want to delete item '+item+' permenently?')) 
window.location = urlRedirect;
}

function confirmAdminDelete(item, comp, str)
{
var urlRedirect = 'admin_loader.php?pageid=database&action=delete&stockId='+item+'&compid='+comp+str;

if(confirm('Are you sure you want to delete item '+item+' permenently?')) 
window.location = urlRedirect;
}

function stockNoEmpty(item)
{
if(item.stockNo.value=='') 
{
alert('Please enter a stock number or use the above search');
return false;
}
else return true;
}

function popUpHelper(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=300,height=300,left = 362,top = 234');");
}


function changeItemQty(item, stockId, compId) {
  var qty = item.value;
  var urlRedirect = 'index.php?pageid=cart&action=UPDATE&stockId='+stockId+'&sellerId='+compId+'&quantity='+qty;
  window.location = urlRedirect;
}
