<!--
// get cookies
/* This script was written by lems1 (lemsx1@hotmail.com) for paramount office products. 
If you want to was any or all parts of this scripts, please keep this note with it. Thanx */
// to get cookies

    // "Internal" function to return the decoded value of a cookie

    function getCookieVal (offset) {
      var endstr = document.cookie.indexOf (";", offset);
      if (endstr == -1)
        endstr = document.cookie.length;
      return unescape(document.cookie.substring(offset, endstr));
    }
    
    
    //  Function to return the value of the cookie specified by "name".
    //    name - String object containing the cookie name.
    //    returns - String object containing the cookie value, or null if
    //      the cookie does not exist.


    function GetCookie (name) {
      var arg = name + "=";
      var alen = arg.length;
      var clen = document.cookie.length;
      var i = 0;
      while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
          return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break; 
      }

// I change the funct to return zero

      return 0;
    }

    //  Function to delete a cookie. (Sets expiration date to current date/time)
    //    name - String object containing the cookie name
    //
    function DeleteCookie (name) {
      var exp = new Date();
      exp.setTime (exp.getTime() - 1);  // This cookie is history
      var cval = GetCookie (name);
      document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
    }
    
    //
    //  Function to create or update a cookie.
    //    name - String object object containing the cookie name.
    //    value - String object containing the cookie value.  May contain
    //      any valid string characters.
    //    [expires] - Date object containing the expiration data of the cookie.  If
    //      omitted or null, expires the cookie at the end of the current session.
    //    [path] - String object indicating the path for which the cookie is valid.
    //      If omitted or null, uses the path of the calling document.
    //    [domain] - String object indicating the domain for which the cookie is
    //      valid.  If omitted or null, uses the domain of the calling document.
    //    [secure] - Boolean (true/false) value indicating whether cookie
    // transmission
    //      requires a secure channel (HTTPS).  
    //
    //  The first two parameters are required.  The others, if supplied, must
    //  be passed in the order listed above.  To omit an unused optional field,
    //  use null as a place holder.  For example, to call SetCookie using name,
    //  value and path, you would code:
    //
    //      SetCookie ("myCookieName", "myCookieValue", null, "/");
    //
    //  Note that trailing omitted parameters do not require a placeholder.
    //
    //  To set a secure cookie for path "/myPath", that expires after the
    //  current session, you might code:
    //
    //      SetCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
    //
    function SetCookie (name, value) {
      var argv = SetCookie.arguments;
      var argc = SetCookie.arguments.length;
      var expires = (argc > 2) ? argv[2] : null;
      var path = (argc > 3) ? argv[3] : null;
      var domain = (argc > 4) ? argv[4] : null;
      var secure = (argc > 5) ? argv[5] : false;
      document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
    }

/* Global variables. Check for cookies first; if not cookies found, then 
 give the variables a value of Zero */

var thisCookie = ((document.cookie != "") && (document.cookie != null));
// paramount office products = pop
//company
var popCom = (thisCookie) ? (GetCookie('popCom') != null) ? GetCookie('popCom') : 0 : 0;
// address
var popAdd = (thisCookie) ? (GetCookie('popAdd') != null) ? GetCookie('popAdd') : 0 : 0;
var popCit = (thisCookie) ? (GetCookie('popCit') != null) ? GetCookie('popCit') : 0 : 0;
var popSta = (thisCookie) ? (GetCookie('popSta') != null) ? GetCookie('popSta') : 0 : 0;
var popZip = (thisCookie) ? (GetCookie('popZip') != null) ? GetCookie('popZip') : 0 : 0;
// tel
var popTel = (thisCookie) ? (GetCookie('popTel') != null) ? GetCookie('popTel') : 0 : 0;
var popTel2 = (thisCookie) ? (GetCookie('popTel2') != null) ? GetCookie('popTel2') : 0 : 0;
var popTel3 = (thisCookie) ? (GetCookie('popTel3') != null) ? GetCookie('popTel3') : 0 : 0;

function quickChek(mform) {
	
  if (mform.txtName.value == '') {
    alert('You must enter your first name');
    return false;
  }
  if (mform.txtLastname.value == '') {
    alert('You must enter your last name');
    return false;
  }
	if (mform.txtCompanyname_r.value == '') {
		alert('You must enter a company name first');
		return false;
	}
	if (mform.txtAddress_r.value == '') {
		alert('You must enter a valid address first');
		return false;
	}
  if (mform.txtCity_r.value == '') {
    alert('You must enter a valid city first');
    return false;
  }
  if (mform.optState_r.value == '0') {
    alert('You must choose a valid state first');
    return false;
  }
  if (mform.txtZip_r.value == '') {
    alert('You must enter a valid zip code first');
    return false;
  }
  if (mform.txtZip_r.value < 9) {
    alert('You must enter a valid zip code first');
    return false;
  }
  if (isNaN(mform.txtZip_r.value)) {
    alert('You must enter a valid zip code first: Value must be a number');
    return false;
  }
	if (mform.txtTelephone_r.value == '') {
		alert('You must enter a valid phone number first: Area code');
		return false;
	}
	if (isNaN(mform.txtTelephone_r.value)) {
		alert('You must enter a valid phone number first: Value must be a number');
		return false;
	}
	if (mform.txtTelephone_r.value.length < 3) {
		alert('You must enter a valid phone number first: (212) 555-1234');
		return false;
	}
	if (mform.txtTelephone2_r.value == '') {
		alert('You must enter a valid phone number first');
		return false;
	}
	if (isNaN(mform.txtTelephone2_r.value)) {
		alert('You must enter a valid phone number first: Value must be a number');
		return false;
	}
	if (mform.txtTelephone2_r.value.length < 3) {
		alert('You must enter a valid phone number first: (212) 555-1234');
		return false;
	}
	if (mform.txtTelephone3_r.value == '') {
		alert('You must enter a valid phone number first');
		return false;
	}
	if (isNaN(mform.txtTelephone3_r.value)) {
		alert('You must enter a valid phone number first: Value must be a number');
		return false;
	}
	if (mform.txtTelephone3_r.value.length < 4) {
		alert('You must enter a valid phone number first: (212) 555-1234');
		return false;
	}
	// fax number is not required, but if provided, double check
	if ((mform.txtFaxPfx.value !="") || (mform.txtFaxPfx2.value !="") || (mform.txtFaxPfx3.value !="")) {	
	if (isNaN(mform.txtFaxPfx.value)) {
		alert('You must enter a valid fax number first: Value must be a number');
		return false;
	}
	if (mform.txtFaxPfx.value.length < 3) {
		alert('You must enter a valid fax number first: (212) 555-1234');
		return false;
	}
	if (isNaN(mform.txtFaxPfx2.value)) {
		alert('You must enter a valid fax number first: Value must be a number');
		return false;
	}
	if (mform.txtFaxPfx2.value.length < 3) {
		alert('You must enter a valid fax number first: (212) 555-1234');
		return false;
	}
	if (isNaN(mform.txtFaxPfx3.value)) {
		alert('You must enter a valid fax number first: Value must be a number');
		return false;
	}
	if (mform.txtFaxPfx3.value.length < 4) {
		alert('You must enter a valid fax number first: (212) 555-1234');
		return false;
	}
	} // end if fax
		
	// nothing seems to be wrong
	// SetCookie (name, value, expires, path);
	// expires?
	var year = new Date();
	year.setTime(year.getTime() + (365 + 24 + 60 * 60 * 1000));
	SetCookie('popCom',mform.txtCompanyname_r.value,year,'/');
	SetCookie('popAdd',mform.txtAddress_r.value,year,'/');
	SetCookie('popCit',mform.txtCity_r.value,year,'/');
	SetCookie('popSta',mform.optState_r.value,year,'/');
	SetCookie('popZip',mform.txtZip_r.value,year,'/');
	SetCookie('popTel',mform.txtTelephone_r.value,year,'/');
	SetCookie('popTel2',mform.txtTelephone2_r.value,year,'/');
	SetCookie('popTel3',mform.txtTelephone3_r.value,year,'/');
	return true;
}
// -->

