//Copyright Mydasoft Solutions Inc.

function addLoadEvent(func) {
	
	var oldonload = window.onload;
	
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function () {
			oldonload();
			func();
		}
	}
}

function loadIndexImg() {
	MM_preloadImages(
		'../images/ro_home.gif',
		'../images/ro_about.gif',
		'../images/ro_team.gif',
		'../images/ro_serv.gif',
		'../images/ro_test.gif',
		'../images/ro_cont.gif'
	);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function attachHandler() {
	if (!document.getElementById) return false;

	var children;
	var i;

	//Cater for rollover on the list-1 element
	var thisNode = document.getElementById("list-1");
	if (thisNode) {

		//locate the anchor element
		if (thisNode.hasChildNodes) {

			children = thisNode.childNodes;
			for (i = 0; i < children.length; i++) {
				if (children[i].nodeName == "A") {
					children[i].onmouseover=prepareList1;
					children[i].onmouseout=returnNode;
					children[i].onclick=noList1Click;
					i = children.length;
					break;
				}
			}
		}
	}

	//Cater for rollover on the list-2 element
	var thisNode = document.getElementById("list-2");
	if (thisNode) {

		//locate the anchor element
		if (thisNode.hasChildNodes) {

			children = thisNode.childNodes;
			for (i = 0; i < children.length; i++) {
				if (children[i].nodeName == "A") {
					children[i].onmouseover=prepareList2;
					children[i].onmouseout=returnNode;
					children[i].onclick=noList2Click;
					i = children.length;
					break;
				}
			}
		}
	}

	//Cater for rollover on the list-3 element
	var thisNode = document.getElementById("list-3");
	if (thisNode) {

		//locate the anchor element
		if (thisNode.hasChildNodes) {

			children = thisNode.childNodes;
			for (i = 0; i < children.length; i++) {
				if (children[i].nodeName == "A") {
					children[i].onmouseover=prepareList3;
					children[i].onmouseout=returnNode;
					children[i].onclick=noList3Click;
					i = children.length;
					break;
				}
			}
		}
	}

	//Cater for rollover on the list-4 element
	var thisNode = document.getElementById("list-4");
	if (thisNode) {

		//locate the anchor element
		if (thisNode.hasChildNodes) {

			children = thisNode.childNodes;
			for (i = 0; i < children.length; i++) {
				if (children[i].nodeName == "A") {
					children[i].onmouseover=prepareList4;
					children[i].onmouseout=returnNode;
					children[i].onclick=noList4Click;
					i = children.length;
					break;
				}
			}
		}
	}

	//Cater for rollover on the list-5 element
	var thisNode = document.getElementById("list-5");
	if (thisNode) {

		//locate the anchor element
		if (thisNode.hasChildNodes) {

			children = thisNode.childNodes;
			for (i = 0; i < children.length; i++) {
				if (children[i].nodeName == "A") {
					children[i].onmouseover=prepareList5;
					children[i].onmouseout=returnNode;
					children[i].onclick=noList5Click;
					i = children.length;
					break;
				}
			}
		}
	}

	//Cater for rollover on the list-6 element
	var thisNode = document.getElementById("list-6");
	if (thisNode) {

		//locate the anchor element
		if (thisNode.hasChildNodes) {

			children = thisNode.childNodes;
			for (i = 0; i < children.length; i++) {
				if (children[i].nodeName == "A") {
					children[i].onmouseover=prepareList6;
					children[i].onmouseout=returnNode;
					children[i].onclick=noList6Click;
					i = children.length;
					break;
				}
			}
		}
	}

	return true;
}

var list1Node = null;
var list2Node = null;
var list3Node = null;
var list4Node = null;
var list5Node = null;
var list6Node = null;
var replaceNode = null;

function prepareList1() {
	
	if (!document.createElement) return false;
	if (!document.createTextNode) return false;
	if (!document.getElementById) return false;
	
	//Find the existing table data element to be replaced
	if (!replaceNode) replaceNode = document.getElementById("display");
	if (!replaceNode) return false;
	
	if (!list1Node) {
		//Create the table data element and append the header items
		list1Node = document.createElement("td");
		list1Node.setAttribute("id", "display");
		
		//Create the header and add text
		if (!addListItem(list1Node, "Cross Dock Operations")) return false;
		if (!addListItem(list1Node, "81,000 sq. ft. in 2 Locations")) return false;
		if (!addListItem(list1Node, "Racking Capabilities")) return false;
		if (!addListItem(list1Node, "Storage")) return false;
	}
	
	//Replace the existing table data element
	replaceNode.parentNode.replaceChild(list1Node, replaceNode);
	
	return true;
}

function prepareList2() {
	
	if (!document.createElement) return false;
	if (!document.createTextNode) return false;
	if (!document.getElementById) return false;
	
	//Find the existing table data element to be replaced
	if (!replaceNode) replaceNode = document.getElementById("display");
	if (!replaceNode) return false;
	
	if (!list2Node) {
		//Create the table data element and append the header items
		list2Node = document.createElement("td");
		list2Node.setAttribute("id", "display");
		
		//Create the header and add text
		if (!addListItem(list2Node, "Assembly")) return false;
		if (!addListItem(list2Node, "Collation")) return false;
	}
	
	//Replace the existing table data element
	replaceNode.parentNode.replaceChild(list2Node, replaceNode);
	
	return true;
}

function prepareList3() {
	
	if (!document.createElement) return false;
	if (!document.createTextNode) return false;
	if (!document.getElementById) return false;
	
	//Find the existing table data element to be replaced
	if (!replaceNode) replaceNode = document.getElementById("display");
	if (!replaceNode) return false;
	
	if (!list3Node) {
		//Create the table data element and append the header items
		list3Node = document.createElement("td");
		list3Node.setAttribute("id", "display");
		
		//Create the header and add text
		if (!addListItem(list3Node, "List Creation")) return false;
		if (!addListItem(list3Node, "Cyclical Counts")) return false;
		if (!addListItem(list3Node, "Computerized Inventory Systems")) return false;
		if (!addListItem(list3Node, "Data Manipulation")) return false;
		if (!addListItem(list3Node, "Letter Setups")) return false;
	}
	
	//Replace the existing table data element
	replaceNode.parentNode.replaceChild(list3Node, replaceNode);
	
	return true;
}

function prepareList4() {
	
	if (!document.createElement) return false;
	if (!document.createTextNode) return false;
	if (!document.getElementById) return false;
	
	//Find the existing table data element to be replaced
	if (!replaceNode) replaceNode = document.getElementById("display");
	if (!replaceNode) return false;
	
	if (!list4Node) {
		//Create the table data element and append the header items
		list4Node = document.createElement("td");
		list4Node.setAttribute("id", "display");
		
		//Create the header and add text
		if (!addListItem(list4Node, "Shrink Wrapping")) return false;
		if (!addListItem(list4Node, "Polybagging")) return false;
	}
	
	//Replace the existing table data element
	replaceNode.parentNode.replaceChild(list4Node, replaceNode);
	
	return true;
}

function prepareList5() {
	
	if (!document.createElement) return false;
	if (!document.createTextNode) return false;
	if (!document.getElementById) return false;
	
	//Find the existing table data element to be replaced
	if (!replaceNode) replaceNode = document.getElementById("display");
	if (!replaceNode) return false;
	
	if (!list5Node) {
		//Create the table data element and append the header items
		list5Node = document.createElement("td");
		list5Node.setAttribute("id", "display");
		
		//Create the header and add text
		if (!addListItem(list5Node, "Catalogue Mailing")) return false;
		if (!addListItem(list5Node, "Letter Shop Folding")) return false;
		if (!addListItem(list5Node, "Letter Shop Insertion")) return false;
		if (!addListItem(list5Node, "Letter Shop Labelling")) return false;
		if (!addListItem(list5Node, "LCP 7 NDG Sort")) return false;
	}
	
	//Replace the existing table data element
	replaceNode.parentNode.replaceChild(list5Node, replaceNode);
	
	return true;
}

function prepareList6() {
	
	if (!document.createElement) return false;
	if (!document.createTextNode) return false;
	if (!document.getElementById) return false;
	
	//Find the existing table data element to be replaced
	if (!replaceNode) replaceNode = document.getElementById("display");
	if (!replaceNode) return false;
	
	if (!list6Node) {
		//Create the table data element and append the header items
		list6Node = document.createElement("td");
		list6Node.setAttribute("id", "display");
		
		//Create the header and add text
		if (!addListItem(list6Node, "Canada, USA & International")) return false;
		if (!addListItem(list6Node, "Ground, Air Freight & Sea Freight")) return false;
		if (!addListItem(list6Node, "Courier Online & Shipping Systems Information Access")) return false;
	}
	
	//Replace the existing table data element
	replaceNode.parentNode.replaceChild(list6Node, replaceNode);
	
	return true;
}

function addListItem(tdNode, txt) {
	
	if (!document.createElement) return false;
	if (!document.createTextNode) return false;
	
	//Create header element
	var hNode = document.createElement("h4");

	//Create text node & append to the header node
	var txtNode = document.createTextNode(txt);
	hNode.appendChild(txtNode);
	
	//Append list item node to td element
	tdNode.appendChild(hNode);
	
	return true;
}

function noList1Click() {

	if (list1Node) return false;
	return true;
}

function noList2Click() {

	if (list2Node) return false;
	return true;
}

function noList3Click() {

	if (list3Node) return false;
	return true;
}

function noList4Click() {

	if (list4Node) return false;
	return true;
}

function noList5Click() {

	if (list5Node) return false;
	return true;
}

function noList6Click() {

	if (list6Node) return false;
	return true;
}

function returnNode() {
	
	if (!document.getElementById) return false;

	//Find the existing table data element to be replaced
	var prevNode = document.getElementById("display");
	if (!prevNode) return false;
	
	//Replace the existing table data element
	prevNode.parentNode.replaceChild(replaceNode, prevNode);
	
	return true;
}

addLoadEvent(loadIndexImg);
addLoadEvent(attachHandler);
