browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);

if (browser_name == "Netscape" && browser_version >= 3.0) { roll = 'true'; }
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { roll = 'true'; }
else { roll = 'false'; }

function over(img,ref) { if (roll == 'true') { document.images[img].src = ref; } }
function out(img,ref)  { if (roll == 'true') { document.images[img].src = ref; } }


function preloadImg(file){
  image = new Image();
  image.src = file;
}

function rol_img() {
//preloadImg('img/menu/what_is_f-a-g_on.jpg');
}


function HideShow (par,t) {
var lay=document.getElementById(par);

if (t==0) { lay.style.visibility="visible";}
if (t==1) { lay.style.visibility="hidden"; }

}

function selectModel (td,color,colorf) {
arrayOfStrings = td.split("|");
for (var i = 0; i < arrayOfStrings.length; i++) {
	document.getElementById(arrayOfStrings[i]).style.background=color; 
	document.getElementById(arrayOfStrings[i]).style.color=colorf;
	}
}

function menu (td,p,color,colorf,img)
{
if (p==1) {
document.getElementById(td).style.color=colorf;
document.getElementById(td).style.fontSize=img;
}
if (p==2) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat right'; 
document.getElementById(td).style.color=colorf; 
}
if (p==3) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat center'; 
document.getElementById(td).style.color=colorf; 
document.getElementById(td).style.textDecoration="underline"; 
}

}
function menuIns (td,p,color,colorf,img)
{
if (p==1) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat left'; 
//document.getElementById(td).style.color=colorf;
//document.getElementById(td).style.textDecoration="underline"; 
}
if (p==2) {
document.getElementById(td).style.background=color+' url(img/'+img+') no-repeat center top'; 
//document.getElementById(td).style.color=colorf;
document.getElementById(td).style.textDecoration="none"; 
}

}

function menuImg (td,p,color,colorf)
{
if (p==1) {
document.getElementById(td).style.backgroundImage='url(img/'+color+')'; 
document.getElementById(td).style.color=colorf;
}
if (p==2) {
document.getElementById(td).style.backgroundImage='url(img/'+color+')';
document.getElementById(td).style.color=colorf; 
}

}

function add_click (url,target) {
if (url) {
//alert("Debug:"+url);
//alert("Debug:"+target);
if (target=="_parent") {
parent.location.href=url;
}
if (target=="_blank") {
window.open(url);
}
if (target=="_self") {
location.href=url;
}
if (target=="_top") {
top.location.href=url;
}
}//end if !url
}

function checkEmpty(field, errStr)
{
	if (field)
	{
		if (field.length && field.name == null)
		{
			var execFlag = false;
	
			for(var i = 0; i < field.length; i++)
			{
				execFlag |= checkEmpty(field[i], '');
				if (execFlag) break;
			}
			if (!execFlag) alert(errStr);
	
			return execFlag;
		}
		switch (field.type)
		{
			case "checkbox":
			case "radio":
				if (!field.checked)
				{
					if (errStr.length) alert(errStr);
					field.focus();
					return false;
				}
				break;
			default:
				if (field.value == '')
				{
					if (errStr.length) alert(errStr);
					if (field.type != 'hidden')
						field.focus();
					return false;
				}
				break;
		}
	}
	return true;
}

function compareValidator(field1, field2, errStr)
{
	if (field1 && field2)
	{
		if (field1.value != field2.value)
		{
			alert(errStr);
			field2.focus();
			return false;
		}
	}
	return true;
}

function nav(_form, url, newWindow)
{
	if (_form)
	{
		_form.action = url;
		if (newWindow)
			_form.target = '_blank';
		else
			_form.target = '';
	}
}

function NoPic(_image)
{
	_image.src = "img/nopic.jpg"
}