
switch (strSection) {
	case 'extranet':
		var sectionCSS = '/common/portfolio.css';
		var bkgrdOffsetX = -90;
		var bkgrdOffsetY = -100;
		var sectionTitle = 'EXTRANET';
		var strBackground = '/images/portfolio-bkgrd.jpg';
		var strBarBackground = '/images/portfolio-bar-bkgrd.jpg';
		break;
	case 'services':
		var sectionCSS = '/common/services.css';
		var bkgrdOffsetX = -81;
		var bkgrdOffsetY = -101;
		var sectionTitle = 'SERVICES';
		var strBackground = '/images/services-bkgrd.jpg';
		var strBarBackground = '/images/services-bar-bkgrd.jpg';
		break;
	case 'portfolio':
		var sectionCSS = '/common/portfolio.css';
		var bkgrdOffsetX = -90;
		var bkgrdOffsetY = -100;
		var sectionTitle = 'PORTFOLIO';
		var strBackground = '/images/portfolio-bkgrd.jpg';
		var strBarBackground = '/images/portfolio-bar-bkgrd.jpg';
		break;
	case 'about':
		var sectionCSS = '/common/about.css';
		var bkgrdOffsetX = -87;
		var bkgrdOffsetY = -98;
		var sectionTitle = 'ABOUT';
		var strBackground = '/images/about-bkgrd.jpg';
		var strBarBackground = '/images/about-bar-bkgrd.jpg';
		break;
	default:
		strSection = 'home'
		var bkgrdOffsetX = -92;
		var bkgrdOffsetY = -136;
		var sectionTitle = '';
		var strBackground = '/images/home-bkgrd.jpg';
		var strBarBackground = '/images/home-bar-bkgrd.jpg';
}

//if (browserDetect('browser')=='Internet Explorer') {
//	document.write('<style type="text/css"><!--');
//	document.write('@import url("../common/askomil-ie.css")');
//	document.write('--></style>');
//}

setActiveStyleSheet('Normal');
window.onload=pageOnload;
//window.onunload=storePreferredStyleSheet;
window.onresize=resizePage;

function pageOnload() {
	var strStyleCookie = readCookie("style");
	var strStyleTitle = strStyleCookie ? strStyleCookie : "";
	switch (strStyleTitle) {
		case 'Low':
			changeStyle('Low');
			break;
		case 'Normal':
			changeStyle('Normal');
			break;
		default:
			if (ClientDimensions('width')<600) {
				changeStyle('Low');
			}
			else {
				changeStyle('Normal');
			}
	}
	initPage();
}

function resizePage() {
	positionBackground('sectionBar',bkgrdOffsetX,bkgrdOffsetY);
}

function setStyle(style) {
	switch (style) {
		case 'Low':
			changeStyle('Low');
			storePreferredStyleSheet();
			break;
		default:
			changeStyle('Normal');
			storePreferredStyleSheet();
	}
}

function changeStyle(style) {
	switch (style) {
		case 'Low':
			document.getElementById("styleSpec").innerHTML = 'high-spec';
			document.getElementById("styleSpec").title = 'Switch to high-spec stylesheet - requires JavaScript';
			document.getElementById("styleSpec").href = "javascript:setStyle('Normal')";
			document.body.style.backgroundImage = "";
			document.getElementById("sectionBar").style.backgroundImage = "none";
			setActiveStyleSheet('Low');
			break;
		default:
			if (strSection=='home') {
				document.getElementById("sectionBar").className = "homeBar";
				document.getElementById("sectionTitle").className = "homeTitle";
				document.getElementById("sectionSub").className = "homeSub";
			}
			document.getElementById("styleSpec").innerHTML = 'low-spec';
			document.getElementById("styleSpec").title = 'Switch to low-spec stylesheet - requires JavaScript';
			document.getElementById("styleSpec").href = "javascript:setStyle('Low')";
			document.body.style.backgroundImage = "url("+strBackground+")";
			document.getElementById("sectionBar").style.backgroundImage = "url("+strBarBackground+")";
			document.getElementById("sectionTitle").innerHTML = '<h3>' + sectionTitle + '</h3>';
			setActiveStyleSheet('Normal');
	}
	resizePage();
}

// this function returns the x, y position
// works in IE and Mozilla.
function getElementPosition(element){
		var x=0,y=0;
		while (element!=null){
				 x+=element.offsetLeft-element.scrollLeft;
				 y+=element.offsetTop-element.scrollTop;
				 element=element.offsetParent;
		}
		return {x:x,y:y};
}
// Browser compatible element getter
function getElement(id){
		if (document.all)
				 return document.all[id];
		if (document.getElementById(id))
				 return document.getElementById(id);
		
		return null;
}
// generic display function
function findElement(id){
		// Get the element by its id
		element = getElement(id);
		// make sure that the element was found
		if (! element) return;
		// get the object that will contain the x,y coordinates
		position = getElementPosition(element);
		// display the coordinates
		alert('x: ' + position.x + '\n\ny: ' + position.y);
}

function positionBackground(elementName,xOffset,yOffset) {
	var objBar = getElement(elementName);
	var strPos = String(getElementPosition(objBar).x + xOffset) + 'px ' + String(getElementPosition(objBar).y + yOffset) + 'px';
	document.body.style.backgroundPosition = strPos;
}


// Stylesheet functions /////////////////////////////////////////////////

function setActiveStyleSheet(title) {
  var i, a, main;
	for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function storePreferredStyleSheet() {
  var title = getActiveStyleSheet();
  createCookie("style", title, 30);
}


// Cookie functions ///////////////////////////////////////////////////////////////

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function hasClassName(el, name) {

  var i, list;

  if (el.className) {
		list = el.className.split(" ");
  	for (i = 0; i < list.length; i++)
  	  if (list[i] == name)
  	    return true;
	}
  return false;
}

function getContainerWith(node, tagName, className) {

  // Starting with the given node, find the nearest containing element
  // with the specified tag name and style class.

  while (node != null) {
    if (node.tagName != null && node.tagName == tagName &&
        hasClassName(node, className))
      return node;
    node = node.parentNode;
  }

  return node;
}

function panelAction(node) {
	var panelState = 'closed';
	var header = node.parentNode;
	var container = header.parentNode;
	for(var i=0;i < container.childNodes.length;i++) {
		if ((container.childNodes[i].tagName=='UL') || (container.childNodes[i].tagName=='DIV')) {
			if (container.childNodes[i].style.display != 'none') {
				MM_swapImage(node.id,'','images/icon-node-expand.gif',0);
				node.alt = '[expand]';
				container.childNodes[i].style.display = 'none';
			}
			else {
				MM_swapImage(node.id,'','images/icon-node-collapse.gif',0);
				node.alt = '[collapse]';
				container.childNodes[i].style.display = 'block';
			}
		}
	}
}

function displayContentOption(container,searchClass,showDiv) {
	var contentDiv = document.getElementById(container);
	for(var i=0;i < contentDiv.childNodes.length;i++) {
		if (hasClassName(contentDiv.childNodes[i], searchClass)) {
			contentDiv.childNodes[i].style.display = 'none';
		}
	}
	if (document.getElementById(showDiv)) document.getElementById(showDiv).style.display = 'block';
	if (browserDetect('browser')!='Internet Explorer') {
//		element.blur();
	}
}

// Browser detect script -------------------------------------------------
var detect = navigator.userAgent.toLowerCase();
var thestring;
function browserDetect(attribute) {
	var OS,browser,version,total;
	
	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else if (!checkIt('compatible'))
	{
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";
	
	if (!version) version = detect.charAt(place + thestring.length);
	
	if (!OS)
	{
		if (checkIt('linux')) OS = "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac"
		else if (checkIt('win')) OS = "Windows"
		else OS = "an unknown operating system";
	}
	switch ( attribute ) {
		case 'OS': return OS;
		case 'version':  return version;
		default:  return browser;
	}
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}


// Find window width --------------------------------------------------------
function ClientDimensions(dimension) {
	var clientWidth, clientHeight;
	if (self.innerHeight) // all except Explorer
	{
		clientWidth = self.innerWidth;
		clientHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		clientWidth = document.documentElement.clientWidth;
		clientHeight = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		clientWidth = document.body.clientWidth;
		clientHeight = document.body.clientHeight;
	}
	switch (dimension) {
		case 'height':
			return clientHeight;
			break;
		case 'width':
			return clientWidth;
			break;
		default:
			return clientWidth + ',' + clientHeight;
	}
}

