/*
	Copyright David Trewern Design         :: www.dtdesign.com ::
	Unauthorised modification / use is a criminal offence, and
	will be prosecuted to the fullest extent permitted by law.
	All Rights Reserved
*/

NAVarr = new Array("home", "whoweare", "whowehelped", "howtoapply", "contactus");
if (document.images)
{
	for (var NAVitem in NAVarr)
	{ 
		 for (var NAVicount=0; NAVicount < 2; NAVicount++)
		 { 
				eval("b" + NAVarr[NAVitem] + NAVicount + " = new Image()");
				eval("b" + NAVarr[NAVitem] + NAVicount + ".src = 'assets/menu_swap_" + NAVarr[NAVitem] + "-" + NAVicount + ".gif'");
		 } 
	} 
}

function BturnOn(imageName)
{
	if (document.images)
	{
		var imageNumber = "";
		if (arguments.length > 1) imageNumber = arguments[1];
		document [imageName + imageNumber].src = eval("b" + imageName + "1.src");
	}
}

function BturnOff(imageName)
{
	if (document.images)
	{
		var imageNumber = "";
		if (arguments.length > 1) imageNumber = arguments[1];
		document [imageName + imageNumber].src = eval("b" + imageName + "0.src");
	}
}

function BturnOnInput(obj,imageName)
{
	if (obj.src)
	{
		obj.src = eval("b" + imageName + "1.src");
	}
}

function BturnOffInput(obj,imageName)
{
	if (obj.src)
	{
		obj.src = eval("b" + imageName + "0.src");
	}
}

function imgPopup(path)
{
	if (path)
	{
		window.open("utils_imagepopup.aspx?path=" + path, "popup", "width=400, height=300, toolbar=no, status=no, scrollbars=yes, resizable=yes");
	}
}

function ddRedirect(dd)
{
	if (dd.options[dd.selectedIndex].value != "") self.location = dd.options[dd.selectedIndex].value;
}

function resizeWindow(layoutAdjustmentW, layoutAdjustmentH)
{
	if ((document.images) && (document.theimage) && (document.theimage.width))
	{

		var imageW = document.theimage.width;
		var imageH = document.theimage.height;

		var screenW = screen.availWidth;
		var screenH = screen.availHeight;

		var resizeToScreen = false;

		if (imageW <= screenW)
		{
			resizeW = imageW;
		}
		else
		{
			resizeW = screenW;
			resizeToScreen = true;
		}

		if (imageH <= screenH)
		{
			resizeH = imageH;
		}
		else
		{
			resizeH = screenH;
			resizeToScreen = true;
		}

		var userAgent = navigator.userAgent;

		//Windows Adjustments
		if (userAgent.indexOf("Windows") != -1)
		{
			if (userAgent.indexOf("MSIE 5") != -1)
			{
				resizeW += 29;
				resizeH += 38;

				if (resizeToScreen)
				{
					resizeW -= 29;
				}
			}
			if (userAgent.indexOf("MSIE 6") != -1)
			{
				resizeW += 31;
				resizeH += 61;
			}
			if (userAgent.indexOf("Firefox") != -1)
			{
				resizeW += 8;
				resizeH += 56;

				if (resizeToScreen)
				{
					resizeW -= 8;
				}
			}
			if (userAgent.indexOf("Netscape/7") != -1) {
				resizeW += 8;
				resizeH += 36;

				if (resizeToScreen)
				{
					resizeW -= 8;
				}
			}
		}

		//Mac Adjustments
		if (userAgent.indexOf("Mac") != -1)
		{
			if (userAgent.indexOf("Safari") != -1)
			{
				resizeW += 0;
				resizeH += 23;
			}
			if (userAgent.indexOf("MSIE 5") != -1)
			{
				resizeW += 0;
				resizeH += 0;
			}
			if (userAgent.indexOf("Firefox") != -1)
			{
				resizeW += 0;
				resizeH += 18;
			}
			if (userAgent.indexOf("Netscape/7") != -1)
			{
				resizeW += 0;
				resizeH += 2;
			}
		}

		if (!isNaN(layoutAdjustmentW))
		{
			resizeW += layoutAdjustmentW;
		}
		if (!isNaN(layoutAdjustmentH))
		{
			resizeH += layoutAdjustmentH;
		}

		if (resizeToScreen)
		{
			window.moveTo(0,0);
		}
		window.resizeTo(resizeW, resizeH);

	}
}