function getCookie(name){
var cname = name + "=";
  var dc = document.cookie;
  if (dc.length > 0) {
    begin = dc.indexOf(cname);
    if (begin != -1) {
      begin += cname.length;
      end = dc.indexOf(";", begin);
      if (end == -1) end = dc.length;
        return unescape(dc.substring(begin, end));
    }
  }
  return null;
}

function windowOpener(file) {
    window.open (file, "win2","scrollbars=yes,width=650,height=680, resizable=yes");
}


function setCookie(name, value, expires, path, domain, secure) {
  document.cookie = name + "=" + escape(value) +
 ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
  ((path == null) ? "" : "; path=" + path) +
  ((domain == null) ? "" : "; domain=" + domain) +
  ((secure == null) ? "" : "; secure");

}

function delCookie(name) {
   document.cookie = name + "=" +"; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function DoLogon(language) {
  us=document.who.user.value;
  pw=document.who.psw.value;
  setCookie('BOLF0001',us,null,'/');
  setCookie('BOLF0002',pw,null,'/');
  setCookie('BOLF0004',language,null,'/');
  parent.location = "logon?language="+language;
}

function DoLogonC(language) {
  us=document.who.user.value;
  pw=document.who.psw.value;
  top.Customer=us;
//  setCookie('BOL00001',us,null,'/');
  setCookie('BOL00002',pw,null,'/');
  setCookie('BOL00004',language,null,'/');
  document.who.submit;
}

function SetLanguage(language) {
  setCookie('BOLF0004',language,null,'/');
  if (language=="it") varL=""; else varL="e";
  top.content.location = "/suppliers/page."+varL+".htm";
}

function GoToOrder(ordnum) {
  newloc ="/scripts/wgate/c001/!?~language="+getCookie('BOL00004')+"&VBCOM-VBELN="+ordnum+"&~OkCode=LGON&LOGIN-LOGIN_USER="+getCookie('BOL00001')+"&LOGIN-PASSWORD="+getCookie('BOL00002');
  parent.parent.location.replace(newloc);
}


