var homeOn 				= new Image();
var homeOff	 			= new Image();
var newsOn 				= new Image();
var newsOff 			= new Image();
var projectsOn 			= new Image();
var projectsOff 		= new Image();
var healthOn 			= new Image();
var healthOff 			= new Image();
var contactOn 			= new Image();
var contactOff 			= new Image();

function SwapIMG(imageName, image, imagePath)
{
	if (image.src == '')
	{
		image.src = imagePath;
	}
	document.images[imageName].src = image.src;
}

function IsValidDate(pDate)
{
	dobRegxp = new RegExp('^([0-9]){2}(\\/|-){1}([0-9]){2}(\\/|-)([0-9]){4}$');
	if (dobRegxp.test(pDate) != true)
	{
		alert('The Date needs to be entered in the following format dd/mm/yy');
		return false;
	}
	else
	{
		return true;
	}
}

function validateArticle(pForm)
{
	var bValid = true;

	if (pForm.ArticleDate.value == '')
	{
		alert('You must enter an Article Date.');
		bValid = false;
	}
	else
	{
		bValid = IsValidDate(pForm.ArticleDate.value);
	}
	
	if ((bValid) && (pForm.ArticleTitle.value == ''))
	{
		alert('You must enter an Article Title.');
		bValid = false;
	}	
	
	return bValid;	
}

function validateProject(pForm)
{
	var bValid = true;

	if (pForm.Sub_Sector.value == '')
	{
		alert('You must choose a Sector.');
		bValid = false;
	}
	
	if ((bValid) && (pForm.ProjectName.value == ''))
	{
		alert('You must enter a Project Name.');
		bValid = false;
	}	
		
	if ((bValid) && (pForm.Client.value == ''))
	{
		alert('You must enter a Client.');
		bValid = false;
	}	
	
	if ((bValid) && (pForm.Consultant.value == ''))
	{
		alert('You must enter a Consultant.');
		bValid = false;
	}	
	
	if ((bValid) && (pForm.ProjectValue.value == ''))
	{
		alert('You must enter a Project Value.');
		bValid = false;
	}		
	return bValid;	
}

function validateEnquiry(pForm)
{
	var bValid = true;

	if (pForm.Title.value == '')
	{
		alert('You must enter a Title.');
		bValid = false;
	}
	
	if ((bValid) && (pForm.Firstname.value == ''))
	{
		alert('You must enter a First Name.');
		bValid = false;
	}	
		
	if ((bValid) && (pForm.Surname.value == ''))
	{
		alert('You must enter a Surname.');
		bValid = false;
	}	
	
	if ((bValid) && (pForm.Company.value == ''))
	{
		alert('You must enter a Company.');
		bValid = false;
	}	
	
	if ((bValid) && (pForm.Telephone.value == ''))
	{
		alert('You must enter a Telephone Number.');
		bValid = false;
	}		

	if ((bValid) && (pForm.Email.value == ''))
	{
		alert('You must enter an Email Address.');
		bValid = false;
	}		

	if ((bValid) && (pForm.Question.value == ''))
	{
		alert('You must enter a Question.');
		bValid = false;
	}		

	return bValid;	
}

function winPop(pageToLoad, winName, width, height, center, scroll, control)
{
    xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center))
    {
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + ","
    + "height=" + height + ","
    + "location=0,"
    + "menubar=0,"
    + "resizable=" + control + ","
    + "scrollbars="+scroll+", "
    + "status=1,"
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only

    window.open(pageToLoad,winName,args );
}

/******************/
var loaded = 0;
var TimeOutNum = 0;
loaded = 0;
var arrMenus = new Array();

arrMenus[0] = 'menuContact';

function show(idname)
{
  	ns4 = (document.layers) ? 1:0;
  	ie4 = (document.all) ? 1:0;

  	if(!ns4)
  	{
		if (document.getElementById)
		{
		  var bxNM = document.getElementById(idname);
		  bxNM.style.visibility = "visible";
		}
		else if (ns4)
		{
		  document[idname].visibility = "show";
		}
		else if (ie4)
		{
		  document.all[idname].style.visibility = "visible";
		}
	}
}

function hide(idname)
{
	ns4 = (document.layers) ? 1:0;
	ie4 = (document.all) ? 1:0;

	if(!ns4)
	{
		if (document.getElementById)
		{
		  var bxNM = document.getElementById(idname);
		  bxNM.style.visibility = "hidden";
		}
		else if (ns4)
		{
		  document[idname].visibility = "hide";
		}
		else if (ie4)
		{
		  document.all[idname].style.visibility = "hidden";
		}
	}
};

function hideAll()
{
	var ii;
	clearTimeout(TimeOutNum);
	
	for (ii in arrMenus)
	{
		hide(arrMenus[ii]);
	}
};

function SetTimer()
{
	TimeOutNum = setTimeout("hideAll();",600);
};
