// Cookie's name may be changed.
var CookieName = "tempFocus";

// Change number of seconds if needed.
var PageLoadTimeSeconds = 3;

// Replace alert(...) in function HandleNewFocus(), below, 
//    with your custom "'back' button was clicked" handling.
function HandleNewFocus()
{
	document.getElementById('Manufacturer').value="";
	//alert('It seems the "back" button was clicked.');
}

// No customizations required in the rest of this JavaScript.

var now = new Date();
var Milliseconds = parseInt(now.getTime() / 1000);
var CurrentCookie = new String();
var FocusLaunched = false;
var BackHandled = false;

function HandleCookie()
{
if(BackHandled) { return; }
BackHandled = true;
var beforemillis = parseInt(CurrentCookie);
if(beforemillis > 1) {
   var aftermillis = Milliseconds - beforemillis;
   if(aftermillis > PageLoadTimeSeconds) { HandleNewFocus(); }
	}
else { SetCookie('loaded'); }
}

function LoadFunctions()
{
CurrentCookie = GetCookie();
if(CurrentCookie == 'loaded') { return; }
HandleCookie();
SetCookie('loaded');
}

function Loaded() { LoadFunctions(); }

function Unloaded() { 
var again = new Date();
Milliseconds = parseInt(again.getTime() / 1000);
SetCookie(String(Milliseconds));
}

function Focused() {
if(FocusLaunched) { return; }
FocusLaunched = true;
LoadFunctions();
}

function SetCookie(v) {
CurrentCookie = v;
document.cookie = CookieName + '=' + v;
}

function GetCookie() {
var c_content = '';
if(document.cookie.length > 0) {
   var c_name = CookieName + '=';
   var c_begin = document.cookie.indexOf(c_name);
   var c_end = 0;
   if(c_begin > -1) {
      c_begin += c_name.length;
      c_end = document.cookie.indexOf(";",c_begin);
      if(c_end < c_begin) { c_end = document.cookie.length; }
      c_content = document.cookie.substring(c_begin,c_end);
      }
   }
return c_content;
}

window.onload = Loaded;
window.onunload = Unloaded;
window.onfocus = Focused;