	if(window.attachEvent){
		window.attachEvent("onload", loader);
	}else{
		window.captureEvents(Event.load);
		window.onload = loader;
	}
function loader()
{
	var imgId = nd_randomImage(img,'header');
	var txtId = nd_randomText(txt,'tagLine');
	document.ch = new imageChooser(img,'header','thumbs','imgPick','imgPickSel',imgId);
}

function clicker(e){
	if(e.target){
		alert(e.target.id)
	}else if(e.srcElement){
		alert(e.srcElement.id)
	}
}

function nd_randomNumber(min,max)
{
	//args: (2) - min, max;
	//args 1: number(minimum);
	//args 2: number(maximum);
	var rMin =  parseInt(min);
	var rMax =  parseInt(max);
	var rDiff = (rMax-rMin);
	var rVal  = (rDiff*Math.random()<rMin)
	?(rMin+rDiff*(Math.random()))
	:rMax*(Math.random());
	return Math.round(rVal)
}
	// build Image array
	var img = [];
	img[0] = '/images/headerBGGauge_01.jpg';
	img[1] = '/images/headerBGGauge_03.jpg';
	img[2] = '/images/headerBGGauge_04.jpg';
	img[3] = '/images/headerBGSkyler_01.jpg';
	img[4] = '/images/headerBGSkyler_02.jpg';
	img[5] = '/images/headerBGSkyler_03.jpg'
	img[6] = '/images/headerBGSkyler_04.jpg'
	img[7] = '/images/headerBGTricycle.jpg';

	// build Text array
	var txt = [];
	txt[0] = 'somewhere between the chaos of life and the beauty of existence is where I make my way';
	txt[1] = 'every second is a moment in the life of someone\'s experience';
	txt[2] = 'it\'s times like these when I wish I could be in this moment forever';
	txt[3] = 'Some of my greatest lessons I have learned by mistake';

function nd_randomImage(ary, nodeID, min, max)
{
	//args: (3) - imgID, min, max
	//args 1: string(id of image)
	//args 2: number(minimum)
	//args 3: number(maximum)
  //requires objRef(), randomNumber()
	
	// Image array bounds
	var imgLast = ary.length-1;
	var imgMin = (min && min >0)?imgMin:0;
	var imgMax = (imgMax && (max < imgLast)?max:imgLast);
	var imgRand = nd_randomNumber(imgMin,imgMax)
	objRef(nodeID).style.backgroundImage = 'url('+ary[imgRand]+')';
	
	return imgRand;
}
function nd_randomText(ary, nodeID, min, max)
{
	//args: (3) - nodeID, min, max
	//args 1: string(id of node)
	//args 2: number(minimum)
	//args 3: number(maximum)
  //requires objRef(), randomNumber()

	// Text array bounds
	var txtLast = ary.length-1;
	var txtMin = (min && min >0)?txtMin:0;
	var txtMax = (max && (max < txtLast)?max:txtLast);
	var txtRand = nd_randomNumber(txtMin,txtMax)
	objRef(nodeID).innerHTML = ary[txtRand];
	return txtRand;
}
function imageChooser(imgAry, imgHolder, ctlHolder, p_class, p_classSel,selId)
{

		aryLen = imgAry.length;
		for(var i=0;i<aryLen;i++)
		{
			curClass = (i==selId)?p_classSel:p_class;
			objRef(ctlHolder).innerHTML +="<span class=\""+curClass+"\" onclick=\"document.ch.choose("+i+")\">"+(i+1)+"</span>";
		}
this.choose = function(id)
	{
		
		//alert(imgAry[id])
		objRef(imgHolder).style.backgroundImage='url('+imgAry[id]+')';
		for(var i=0;i<aryLen;i++)
		{
			if(i == id)
			{
				objRef(ctlHolder).childNodes[i].className = p_classSel;
			}else{
				objRef(ctlHolder).childNodes[i].className = p_class;
			}
		}
	}
}

	//this.choose();
function objRef(){
// Args: (1) [string or obj ref] 
var args = objRef.arguments;
var obj=((typeof(args[0]) != 'object')?document.getElementById(args[0]):args[0]);
return obj;}

