var isNS = (document.layers) ? true : false;
var isNS6 = (document.getElementById && !document.all) ? true : false;
var isIE = (document.all) ? true : false;
var isIE5 = (isIE) ? ((navigator.userAgent.indexOf('MSIE 5') > 0) ? true : false) : false;

var Submitted = false;
var lnk = new Array(6);
lnk[0] = 'index.html';
lnk[1] = 'equipe.html';
lnk[2] = 'produtos.html';
lnk[3] = 'beneficios.html';
lnk[4] = 'showroom.html';
lnk[5] = 'cases.html';
lnk[6] = 'faleconosco.html';

function JSPopUp(url,name,w,h,x,y,scroll){
	window.open(url, name, 'width='+w+',height='+h+',left='+x+',top='+y+',scrollbars='+scroll+',toolbar=no,location=no,directories=no,status=no,menubar=no,resizeable=no,copyhistory=no');
}

function JSClose(){
	window.close();
}

function GoTo(field){
	eval('document.flyfrm.' + field + '.focus();');
}

function SndFrm(){
	if(Submitted == false && !IsLocked()){
		Submitted = true;
	return(true);
	}
return(false);
}

function Delay(func, time){
	return(setTimeout(func, (time * 1000)));
}

function findObj(n, d){
  var p, i, x;
	if(!d)
		d = document;
	if((p = n.indexOf("?")) > 0 && parent.frames.length){
    d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
  if(!(x = d[n]) && d.all)
		x = d.all[n];
	for(i = 0; !x && i < d.forms.length; i++)
		x = d.forms[i][n];
  for(i = 0; !x && d.layers && i < d.layers.length; i++)
		x = findObj(n, d.layers[i].document);
return(x);
}

function ShowHide(){
  var i, v, obj, args = ShowHide.arguments;
  for(i = 0; i < args.length; i += 2)
		if((obj = findObj(args[i])) != null){
			v = args[i+1];
	    if(obj.style){
				obj = obj.style;
				v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v;
			}
	    obj.visibility = v;
		}
}

function JumpTo(choice, id){
	var current = new String(window.location);
	if(current.indexOf(lnk[choice].replace('..','')) < 0)
		window.location = lnk[choice] + '?id=' + id;
}

function SetChoice(get){
	var current = new String(window.location);
	for(choice = 0; choice < lnk.length; choice++)
		if(current.indexOf(lnk[choice].replace('..','')) >= 0){
			if(get)
				return(choice + 1);
			document.FlyMenu.elements[0].options[(choice + 1)].selected = true;
		return;
		}
}

function ChgImg(ImgName, Status){
	ImgName.src = 'imgs/btn_' + ImgName.name + (Status ? '_on' : '_off') + '.gif';
}
