﻿// JScript File

function Mid(str, start, len)
{
// Make sure start and len are within proper bounds
    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
          iEnd = iLen;
    else
          iEnd = start + len;
    return String(str).substring(start,iEnd);
}
function InStr(strSearch, charSearchFor)
{
            for (i=0; i < strSearch.length; i++)
            {
                  if (charSearchFor == Mid(strSearch, i, 1))
                  {
                        return i;
                  }
            }
            return -1;
}

function confirmNewsletter(txtEmail)
{
  var Email = document.getElementById(txtEmail);
  
  if( Email.value == "" )
  {
		alert( "בבקשה הכנס כתובת אמייל" );
		Email.focus();
		return false;
  }

  if( Email.value.indexOf("@") == -1 )
  {
		alert( "כתובת האמייל שהזנת איננה חוקית" );
		Email.focus();
		return false;
  }  
  
  return true;

}

function ConfirmContactUs(txtName, txtPhone, txtEmail, txtText)
{
  var Email = document.getElementById(txtEmail);
  var Name = document.getElementById(txtName);
  var Phone = document.getElementById(txtPhone);
  var Text = document.getElementById(txtText);
  
  if (Name.value == "")
  {
		alert( "הכנס בבקשה את שמך!!!" );
		Name.focus();
		return false;
  }    
  if (Phone.value == "")
  {
		alert( "הכנס בבקשה את מספר הטלפון שלך!!!" );
		Phone.focus();
		return false;
  }    
  if( Email.value == "" )
  {
		alert( "בבקשה הכנס כתובת אמייל" );
		Email.focus();
		return false;
  }

  if( Email.value.indexOf("@") == -1 )
  {
		alert( "כתובת האמייל שהזנת איננה חוקית" );
		Email.focus();
		return false;
  }    
  if (Text.value == "")
  {
		alert( "הכנס בבקשה את הטקסט!!!" );
		Text.focus();
		return false;
  }        
  
  return true;

}

function confirmEmail(txtEmail)
{
  var Email = document.getElementById(txtEmail);
  
  if( Email.value == "" )
  {
		alert( "בבקשה הכנס כתובת אמייל" );
		Email.focus();
		return false;
  }

  if( Email.value.indexOf("@") == -1 )
  {
		alert( "כתובת האמייל שהזנת איננה חוקית" );
		Email.focus();
		return false;
  }  
  
  return true;

}

//var url = document.location.href

//if (url.indexOf("~") == -1) {
//document.location = geo + vanity + sl + page


