/*
	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", "solutions", "practice", "protection", "support", "about", "login", "contact");
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/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 popup(url)
{
	if (url)
	{
		window.open(url, "popup", "width=400, height=300, toolbar=no, status=no, scrollbars=no, resizable=no");
	}
}

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);

	}
}



function showHide(obj, state)
{

	if (state == "show")
	{
		document.getElementById(obj).style.display = 'block';
	}
	else
	{
		document.getElementById(obj).style.display = 'none';
	}
	
}



function hidedivsbyclass(classname)
{

	if (document.getElementsByTagName)
	{
		var divs = document.getElementsByTagName("DIV");

		var divsfound = false;

		for (i = 0; i < divs.length; i++)
		{
			if (divs[i].className == classname)
			{
				divs[i].style.display = "none";
				divsfound = true;
			}
		}

		if (divsfound)
		{
			var links = document.getElementsByTagName("A");

			for (i = 0; i < links.length; i++)
			{
				if (links[i].className == classname + "_link")
				{
					links[i].style.display = "block";

					links[i].onclick = function()
					{
						toggle(this.rel);
						return false;
					}
				}
			}
		}
	}
}





function toggle(obj) {

	if (document.getElementById)
	{
		el = document.getElementById(obj);

		if (el != null)
		{
			if (el.style.display == "" || el.style.display == "block")
			{
				el.style.display = "none";
			}
			else
			{
				el.style.display = "block";
			}
		}
	}

}





// Inserts print button via javascript
function print_page_home() {
	document.write('<div class="print"><a href="#" onClick="window.print(); return false">Print Page</a></div>');					
}
function print_page() {
	document.write('<div class="print print2"><a href="#" onClick="window.print(); return false">Print Page</a></div>');					
}

// Inserts expand button
/* function expand1() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc1'); return false;">Expand</a></div>');
}
function expand2() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc2'); return false;">Expand</a></div>');
}
function expand3() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc3'); return false;">Expand</a></div>');
}
function expand4() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc4'); return false;">Expand</a></div>');
}
function expand5() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc5'); return false;">Expand</a></div>');
}
function expand6() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc6'); return false;">Expand</a></div>');
}
function expand7() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc7'); return false;">Expand</a></div>');
}
function expand8() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc8'); return false;">Expand</a></div>');
}
function expand9() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc9'); return false;">Expand</a></div>');
}
function expand10() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc10'); return false;">Expand</a></div>');
}
function expand11() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc11'); return false;">Expand</a></div>');
}
function expand12() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc12'); return false;">Expand</a></div>');
}
function expand13() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc13'); return false;">Expand</a></div>');
}
function expand14() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc14'); return false;">Expand</a></div>');
}
function expand15() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc15'); return false;">Expand</a></div>');
}
function expand16() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc16'); return false;">Expand</a></div>');
}
function expand17() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc17'); return false;">Expand</a></div>');
}
function expand18() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc18'); return false;">Expand</a></div>');
}
function expand19() {
	document.write('<div class="action"><a href="#" onclick="toggleShow('desc19'); return false;">Expand</a></div>');
} */