//////////////////////////////////
function checksearchform(myform)
{
//alert("In function");

if (isWhitespace(myform.manufacturer.value) &&
    isWhitespace(myform.product_name.value) &&
	isWhitespace(myform.price_from.value) &&
	isWhitespace(myform.price_to.value) )
{
  alert("Please enter a search term");
  return false;
}	

if (isWhitespace(myform.price_from.value) && isWhitespace(myform.price_to.value))
{
  return true;
}

if (!isNumber(myform.price_from.value))
{
alert("Please enter only numbers in Price fields");
myform.price_from.focus();
return false;
}

if (!isNumber(myform.price_to.value))
{
alert("Please enter only numbers in Price fields");
myform.price_to.focus();
return false;
}
return true;
}
///////////////////////////////////
function check_product_form(myform)
{

/*
$category_id  = isset($_POST['category_id']) ? $_POST['category_id'] : '';
$product_id  = isset($_POST['product_id']) ? $_POST['product_id'] : '';
$product_title  = isset($_POST['product_title']) ? $_POST['product_title'] : '';
$manufacturer  = isset($_POST['manufacturer']) ? $_POST['manufacturer'] : '';
$image  = isset($_POST['image']) ? $_POST['image'] : '';
$large_image  = isset($_POST['large_image']) ? $_POST['large_image'] : '';
$retail_price  = isset($_POST['retail_price']) ? $_POST['retail_price'] : '';
$our_price  = isset($_POST['our_price']) ? $_POST['our_price'] : '';
$features_desc  = isset($_POST['features_desc']) ? $_POST['features_desc'] : '';
$compare_feature1  = isset($_POST['compare_feature1']) ? $_POST['compare_feature1'] : '';
$compare_feature2  = isset($_POST['compare_feature2']) ? $_POST['compare_feature2'] : '';
$compare_feature3  = isset($_POST['compare_feature3']) ? $_POST['compare_feature3'] : '';
$compare_feature4  = isset($_POST['compare_feature4']) ? $_POST['compare_feature4'] : '';
$details_desc
*/

if (isWhitespace(myform.product_id.value))
{
alert("Please enter product_id");
myform.product_id.focus();
return false;
}
if (isWhitespace(myform.product_title.value))
{
alert("Please enter product_title");
myform.product_title.focus();
return false;
}
if (isWhitespace(myform.manufacturer.value))
{
alert("Please enter manufacturer");
myform.manufacturer.focus();
return false;
}
var regex = /\./;
if (regex.test(myform.image.value))
{
alert("Please don't include file type in image names, jpg is assumed.");
myform.image.focus();
return false;
}

if (regex.test(myform.large_image.value))
{
alert("Please don't include file type in image names, jpg is assumed.");
myform.large_image.focus();
return false;
}


}
/////////////////////////////
function confirm_delete()
{
  if (confirm("Are you sure you want to delete this record?"))
  {
    return true;
  }
  else
  {
    return false;
  }
}
function confirm_branch_delete()
{
  if (confirm("Are you sure you want to delete this location?"))
  {
    return true;
  }
  else
  {
    return false;
  }
}
function confirm_document_delete()
{
  if (confirm("Are you sure you want to delete this document?"))
  {
    return true;
  }
  else
  {
    return false;
  }
}
function confirm_auth_delete()
{
  if (confirm("Are you sure you want to delete this Authority?"))
  {
    return true;
  }
  else
  {
    return false;
  }
}
function popup(mylink, windowname)
{
	   if (! window.focus) return true;
	   var href;
	   if (typeof(mylink) == 'string')
           href=mylink;
       else
          href=mylink.href;
	   window.open(href, windowname, 'width=800,height=600,scrollbars=yes');
	   return false;
}

