/*********** V A R I A B L E S *****************************/
var checkCount = 0;
/*********** V A R I A B L E S *****************************/

function CheckAndGo()
{
  if(window.document.forms[0].SearchString.value == "")
  {
    alert("Enter word, please");
    window.document.forms[0].SearchString.focus();
  }
  else
    window.location.href = "Search.asp?word=" + window.document.forms[0].SearchString.value;
}
//================================================================
function CheckAndSubmit()
{
  if(window.document.forms[0].txtName.value == "")
  {
    alert("Fill first name");
    window.document.forms[0].txtName.focus();
    return;
  }  
  if(window.document.forms[0].txtLastName.value == "")
  {
    alert("Fill last name");
    window.document.forms[0].txtLastName.focus();    
    return;
  }  
/*
  if(window.document.forms[0].txtJobTitle.value == "")
  {
    alert("Fill job title");
    window.document.forms[0].txtJobTitle.focus();
    return;
  }
  if(window.document.forms[0].txtLaboratoryName.value == "")
  {
    alert("יש למלא שם מעבדה");
    window.document.forms[0].txtLaboratoryName.focus();    
    return;
  }  
  if(window.document.forms[0].txtAddress.value == "")
  {
    alert("יש למלא כתובת");
    window.document.forms[0].txtAddress.focus();    
    return;
  }
*/  
  if(window.document.forms[0].txtPhone.value == "")
  {
    alert("Enter phone number");
    window.document.forms[0].txtPhone.focus();
    return;
  }  
/*
  if(window.document.forms[0].txtFax.value == "")
  {
    alert("יש למלא מספר פקסמיליה");
    window.document.forms[0].txtFax.focus();    
    return;
  }
  if(window.document.forms[0].txtEmail.value == "")
  {
    alert("Feel e-mail");
    window.document.forms[0].txtEmail.focus();
    return;
  }
  else
  {
    var obj = window.document.forms[0].txtEmail;
    var index;
    if(obj.value.length < 7)
    {
      alert("Invalid email");
      obj.select();
      obj.focus();
      return;
    }
    index = obj.value.indexOf("@");
    if(index < 1 || index == obj.value.length - 1)
    {
      alert("Invalid email");
      obj.select();
      obj.focus();
      return;
    }
    index = obj.value.indexOf(".");
    if(index == -1)
    {
      alert("Invalid email");
      obj.select();
      obj.focus();
      return;
    }
  }
  if(window.document.forms[0].txtQuantity.value == "")
  {
    alert("Feel quantity");
    window.document.forms[0].txtQuantity.focus();    
    return;
  }
*/  
  window.document.forms[0].submit();
}
//================================================================
function CheckEnter()
{
  if(window.event.keyCode == 13)
    CheckAndGo();
}
//================================================================
function ChangeImage(picture, obj)
{
  var pic = eval("window.document.images['" + obj.name + "']");
  pic.src = "images/" + picture;
}
//================================================================
function FutureCourses()
{
  window.document.forms[0].whatCourse.value = "new";
  window.document.forms[0].submit();
}
//================================================================
function OldCourses()
{
  window.document.forms[0].whatCourse.value = "old";
  window.document.forms[0].submit();
}
//================================================================
function AllCourses()
{
  window.document.forms[0].whatCourse.value = "all";
  window.document.forms[0].submit();
}
//================================================================
function AdditionalData(id)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("additionaldata.asp?id=" + id, "AdditionalData", "toolbar=no, status=no, menubar=no, width=700, height=500, left=140, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("additionaldata.asp?id=" + id, "AdditionalData", "toolbar=no, status=no, menubar=no, width=700, height=500, left=40, top=50, resizable=yes, scrollbars=yes", true);    
}
//================================================================
function OpenHelp()
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("help.htm", "HelpWindow", "toolbar=no, status=no, menubar=no, width=740, height=570, left=90, top=50, resizable=yes, scrollbars=yes", true);
  else  
    window.open("help800x600.htm", "HelpWindow", "toolbar=no, status=no, menubar=no, width=700, height=460, left=40, top=30, resizable=yes, scrollbars=yes", true);
}
//================================================================
function OpenCourse(id, criteria)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("Courses1.asp?id=" + id + "&word=" + criteria, "Course", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=5, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("Courses1.asp?id=" + id + "&word=" + criteria, "Course", "toolbar=no, status=no, menubar=no, width=780, height=450, left=5, top=50, resizable=yes, scrollbars=yes", true);    
}
//================================================================
function OpenFaq(id, criteria)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("Faq1.asp?id=" + id + "&word=" + criteria, "Faq", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=5, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("Faq1.asp?id=" + id + "&word=" + criteria, "Faq", "toolbar=no, status=no, menubar=no, width=780, height=450, left=5, top=100, resizable=yes, scrollbars=yes", true);    
}
//================================================================
function OpenCompany(id, criteria)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("Links1.asp?id=" + id + "&word=" + criteria, "Company", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=5, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("Links1.asp?id=" + id + "&word=" + criteria, "Company", "toolbar=no, status=no, menubar=no, width=780, height=450, left=5, top=100, resizable=yes, scrollbars=yes", true);      
}
//================================================================
function Subscribe(id)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("Harshama.asp?id=" + id, "Subscribe", "toolbar=no, status=no, menubar=no, width=1024, height=768, left=0, top=0, resizable=yes, scrollbars=yes", true);
  else
    window.open("Harshama800x600.asp?id=" + id, "Subscribe", "toolbar=no, status=no, menubar=no, width=790, height=580, left=0, top=0, resizable=yes, scrollbars=yes", true);
}
//================================================================
function StatusOn(str)
{
  window.status = str;
}
//================================================================
function StatusOff()
{
  window.opener.status = "";
}
//================================================================
function MarkString(strSourse, search)
{
  var str, str1, str2, str3, str4, i;
  str = strSourse;
  str1 = str.split(" ");
  
  for(i = 0; i < str1.length; i++)
  {  
    index = str1[i].search(search);
    if(index != -1)
    {
      str2 = str1[i].substr(0, index);
      str3 = search;
      str4 = str1[i].substr(index + search.length);
      document.write (str2 + "<font color=red><b>" + str3 + "</b></font>" + str4 + " ");
    } 
    else
      document.write (str1[i] + " ");
  }  
}
//================================================================
function CalculatePrice()
{
  if(!isNaN(window.document.forms[0].txtQuantity.value))
  {  
    window.document.forms[0].txtAllSum.value = window.document.forms[0].txtQuantity.value * window.document.forms[0].hiddenPrice.value;
    window.document.forms[0].txtAllSum1.value = window.document.forms[0].txtQuantity.value * window.document.forms[0].hiddenPrice1.value;
  }  
  else
    alert("רשום מספר לא במילים");

}
//================================================================
function CheckForNumbers(obj)
{
  if(isNaN(obj.value))
  {
    alert("נא להקיש ספרות");
    obj.select();
    obj.focus();
  }
}
//================================================================
function ShowByCategory(sitenum, sitename, status, street, number, city, zipcode, phone, fax, email, category, labnumber)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("showbycategory.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&labnumber=" + labnumber, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  else  
    window.open("showbycategory.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&labnumber=" + labnumber, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=780, height=450, left=10, top=100, resizable=yes, scrollbars=yes", true);
}
//================================================================
function ShowByCategoryTest(sitenum, sitename, status, street, number, city, zipcode, phone, fax, email, category)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("showbycategorytest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("showbycategorytest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=780, height=450, left=10, top=100, resizable=yes, scrollbars=yes", true);
}
//================================================================
function ShowByProductTest(sitenum, sitename, status, street, number, city, zipcode, phone, fax, email, category)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("showbyproducttest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("showbyproducttest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=780, height=450, left=10, top=100, resizable=yes, scrollbars=yes", true);
}
//================================================================
function ShowByStandartTest(sitenum, sitename, status, street, number, city, zipcode, phone, fax, email, category)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("showbystandarttest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("showbystandarttest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=780, height=450, left=10, top=100, resizable=yes, scrollbars=yes", true);
}
//================================================================
function ShowByProductStandartTest(sitenum, sitename, status, street, number, city, zipcode, phone, fax, email, product, standart)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("showbyproductstandarttest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + product + "&standart=" + standart, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("showbyproductstandarttest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + product + "&standart=" + standart, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=780, height=450, left=10, top=100, resizable=yes, scrollbars=yes", true);
}
//================================================================
function ShowByProductStandartCategoryTest(sitenum, sitename, status, street, number, city, zipcode, phone, fax, email, category, standart, product)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("ShowByProductStandartCategoryTest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&standart=" + standart + "&product=" + product, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("ShowByProductStandartCategoryTest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&standart=" + standart + "&product=" + product, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=780, height=450, left=10, top=100, resizable=yes, scrollbars=yes", true);
}
//================================================================
function ShowByStandartCategoryTest(sitenum, sitename, status, street, number, city, zipcode, phone, fax, email, category, standart)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("ShowByStandartCategoryTest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&standart=" + standart, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("ShowByStandartCategoryTest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&standart=" + standart, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=780, height=450, left=10, top=100, resizable=yes, scrollbars=yes", true);
}
//================================================================
function ShowByProductCategoryTest(sitenum, sitename, status, street, number, city, zipcode, phone, fax, email, category, product)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("ShowByProductCategoryTest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&product=" + product, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("ShowByProductCategoryTest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&product=" + product, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=780, height=450, left=10, top=100, resizable=yes, scrollbars=yes", true);
}
//================================================================
function ShowByProductSiteCategoryTest(sitenum, sitename, status, street, number, city, zipcode, phone, fax, email, category, product)
{
  var screenHeight = screen.availHeight;
  var screenWidth  = screen.availWidth;

  if(screenHeight > 600)
    window.open("ShowByProductCategoryTest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&product=" + product, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  else
    window.open("ShowByProductCategoryTest.asp?sitenum=" + sitenum + "&sitename=" + sitename + "&status=" + status + "&street=" + street + "&number=" + number + "&city=" + city + "&zipcode=" + zipcode + "&phone=" + phone + "&fax=" + fax + "&email=" + email + "&category=" + category + "&product=" + product, "ShowByCategory", "toolbar=no, status=no, menubar=no, width=780, height=450, left=10, top=100, resizable=yes, scrollbars=yes", true);
}
//================================================================
function DelTest(str)
{
  if(checkCount > 0)
  {
    switch(str)
    {  
      case "measure category" : if(window.confirm("Warning!!!\nDeleting category will delete all his subcategories.\nAre you sure?") == true)
                                  window.document.forms[0].submit();
                                break;
      case "test category" : if(window.confirm("Warning!!!\nDeleting category will delete all his subcategories.\nAre you sure?") == true)
                                  window.document.forms[0].submit();
                                break;
    }  
  }
  else
    window.document.forms[0].submit();
}
//================================================================
function CopyFrom(str)
{
  if(str == "calibration")  
  {
    window.open("CopyFromCalibration.asp", "CopyFrom", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  }  
  else
  {
    window.open("CopyFromTesting.asp", "CopyFrom", "toolbar=no, status=no, menubar=no, width=1000, height=500, left=10, top=100, resizable=yes, scrollbars=yes", true);
  }  
}
