<!--

var remember = new Array();
var remember2 = new Array();
var checkIt;

var on = 0;

var DHTML = (document.getElementById || document.all || document.layers);

function show(name,lvl,obj)
{
	if (!DHTML) return;
	//checkUserInput();
	if (remember[lvl] && remember[lvl] == name) return;
	if (remember[lvl])
	{
		closeAll(lvl);
	}
	if (name)
	{
		var x = getObj(name);
		x.visibility = 'visible';
	}
	remember[lvl] = name;
	if (obj.parentNode) y = obj.parentNode;
	else if (obj.parentElement) y = obj.parentElement;
	else return;
	if (y.className) return;
	y.className = 'over';
	if (remember2[lvl]) remember2[lvl].className = '';
	remember2[lvl] = y;
}

function closeAll(lvl)
{
	for (i=remember.length - 1;i>=lvl;i--)
	{
		if (remember[i]) //IE4 Mac
		{
			var x = getObj(remember[i]);
			x.visibility = 'hidden';
		}
		remember[i] = null;
		if (remember2[i])
		{
			remember2[i].className = '';
			remember2[i] = null;
		}
	}
}

function checkStatus() 
{
	setTimeout('checkStatusDelay(1)',250);
}

function checkStatusDelay()
{
	if (!on) {
		if (checkIt) clearTimeout(checkIt);
		checkIt = setTimeout('closeAll(1)',1);
	}
}

function getObj(name)
{
  if (document.getElementById)
  {
    return document.getElementById(name).style;
  }
  else if (document.all)
  {
    return document.all[name].style;
  }
  else if (document.layers)
  {
    return document.layers[name];
  }
  else return false;
}

function Cookie(document, name, days, path, domain, secure)
{
	this.$document = document;
	this.$name = name;
	if(days)
	{
		this.$expiration = new Date((new Date()).getTime() + days * 86400000);
	}
	else
	{
		this.$expiration = null;
	}
	if(path)
	{
		this.$path = path;
	}
	else
	{
		this.$path = null;
	}
	if(domain)
	{
		this.$domain = domain;
	}
	else
	{
		this.$domain = null;
	}
	if(secure)
	{
		this.$secure = true;
	}
	else
	{
		this.$secure = false;
	}
}

Cookie.prototype.save = function()
{
	var cookieval = "";
	for(var prop in this)
	{
		if((prop.charAt(0) == '$') || ((typeof this[prop]) == 'function'))
		{
			continue;
		}
		if(cookieval != "")
		{
			cookieval += '&';
		}
		cookieval += prop + ':' + escape(this[prop]);
	}
	var cookie = this.$name + '=' + cookieval;
	if(this.$expiration)
	{
		cookie += '; expires=' + this.$expiration.toGMTString();
	}
	if(this.$path)
	{
		cookie += '; path=' + this.$path;
	}
	if(this.$domain)
	{
		cookie += '; domain=' + this.$domain;
	}
	if(this.$secure)
	{
		cookie += '; secure';
	}
	this.$document.cookie = cookie;
}

Cookie.prototype.load = function()
{
	var allcookies = this.$document.cookie;
	if(allcookies == "")
	{
		return false;
	}
	var start = allcookies.indexOf(this.$name + '=');
	if(start == -1)
	{
		return false;
	}
	start += this.$name.length + 1;
	var end = allcookies.indexOf(';', start);
	if(end == -1)
	{
		end = allcookies.length;
	}
	var cookieval = allcookies.substring(start, end);
	var a = cookieval.split('&');
	for(var i = 0; i < a.length; i++)
	{
		a[i] = a[i].split(':');
	}
	for(var i = 0; i < a.length; i++)
	{
		this[a[i][0]] = unescape(a[i][1]);
	}
	return true;
}

Cookie.prototype.remove = function()
{
	var cookie;
	cookie = this.$name + '=';
	if(this.$path)
	{
		cookie += '; path=' + this.$path;
	}
	if(this.$domain)
	{
		cookie += '; domain=' + this.$domain;
	}
	cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';
	this.$document.cookie = cookie;
}
// uncomment this code for testing or you won't redirect to the pdf form every time.
       var cookie = new Cookie(document, "MavTechGlobalPDF");
       cookie.remove();

        function displayPDF(pdf)
        {
                var cookie = new Cookie(document, "MavTechGlobalPDF");
                
                if(!cookie.load() || !cookie.pdfOK)
                {
                        window.open('../pdfForm.asp?doc=' + pdf, 'pdfForm', 'width=400,height=550');
                }
                else
                {
                        window.open('../pdf/' + pdf);
                }
        }
// -->
