
//rollovers on work pages
//function workRolls() {
//	xImgRollSetup('../img/','-on','.png','drop-next','drop-back');
//	xImgRollSetup('../img/work/','-on','.png','pop-prev','pop-next','pop-close');
//}

//function showPop(id) {
//	e = xGetElementById(id);
//	if (e) {
//		xShow(e);
//	}
//}

//function hidePop(id) {
//	e = xGetElementById(id);
//	if (e) {
//		xHide(e);
//	}
//}


////code for services and work interior drop downs
//var myImagePath = 'img/';

//function xImgMenu(path, ovrSuffix, fileExt, triggerId, menuId, mouseMargin, openEvent, offsetX, offsetY)
//{
//  var isOpen = false;
//  var hasShadow = false;
//  var trg = xGetElementById(triggerId);
//  var mnu = xGetElementById(menuId);
//  if (trg && mnu) {
//    xAddEventListener(trg, openEvent, onOpen, false);
//  }
//  function onOpen()
//  {
//    if (!isOpen) {
//	  trg.src=path + triggerId + ovrSuffix + fileExt;
//      xMoveTo(mnu, xPageX(trg)+offsetX, xPageY(trg)+ offsetY + xHeight(trg));
//	  xDisplay(mnu,'block');
//      if (!hasShadow) {
//	  	 applyDropShadow(mnu,'../img/');
//		 hasShadow = true;
//	  }
//	  xShow(mnu);
//      xAddEventListener(document, 'mousemove', onMousemove, false);
//      isOpen = true;
//    }
//  }
//  function onMousemove(ev)
//  {
//    var e = new xEvent(ev);
//    if (!xHasPoint(mnu, e.pageX, e.pageY, -mouseMargin) &&
//        !xHasPoint(trg, e.pageX, e.pageY, -mouseMargin))
//    {
//      xHide(mnu);
//      xRemoveEventListener(document, 'mousemove', onMousemove, false);
//	  trg.src=path + triggerId + fileExt;
//      isOpen = false;
//    }
//  }
//} // end xMenu1


////highlight code for clients page
//function highlightClass(myClass,myColor) {
//	var myListItems = xGetElementsByClassName(myClass,null,'LI');
//	
//	for(i=0; i<myListItems.length; i++) {
//		myListItems[i].style.backgroundColor = myColor;
//	}

//}

////setup reverse highlight code by putting events on all LIs in the appropriate ULs
//function setupHighlightServices() {
//	var myLists = xGetElementsByClassName('service-list',null,'UL');
//	var myListItems;
//	for(i=0; i<myLists.length; i++) {
//		myListItems = xGetElementsByTagName('LI',myLists[i]);
//		for(j=0; j<myListItems.length; j++) {
//			myListItems[j].onmouseover=highlightServices;
//			myListItems[j].onmouseout=unHighlightServices;
//		}
//	}
//}

//function unHighlightServices() {
//	this.style.backgroundColor = '';
//	setClassOnServices(this,'');
//}

////reverse highlight code for clients page
////depends on ids being named after the classes
//function highlightServices() {
//	this.style.backgroundColor = '#EAEAEA';
//	setClassOnServices(this,'on');
//}

//function setClassOnServices(myLI,myClassName) {
//	var myClasses = myLI.className;
//	var myClassList = myClasses.split(" ");
//	var myService;
//	if (myClassList.length > 0) {
//		if (myClassList[0] != '') {
//			for(i=0; i<myClassList.length; i++) {
//				myService = xGetElementById(myClassList[i]);
//				myService.className = myClassName;
//			}
//		}
//	}
//}

////absolutely position drop shadows on all shadow classes
//function applyDropShadows() {
//	myBoxes = xGetElementsByClassName('shadow',null);

//	for(i=0; i<myBoxes.length; i++) {
//		applyDropShadow(myBoxes[i],'../img/shadow/');
//	}
//}

////code to absolutely position drop shadows
//function applyDropShadow(e,imgPath) {
//	//todo:
//	//dont set negative heights (ie when something set to display:none)
//	//fix when applied to borders
//	//get to work with fenster?
//	e=xGetElementById(e);
//	var x = xPageX(e);
//	var y = xPageY(e);
//	width = xWidth(e);
//	height = xHeight(e);
//	
//	//where are we appending
//	if (e.hasChildNodes()) {
//		e2 = e;
//		positioning = xGetComputedStyle(e2,'position');
//		if (positioning=='relative'||positioning=='absolute') {	
//			x=0;
//			y=0;
//		}
//	} else {
//		e2 = document.body;
//	}
//	
//	zind = xGetComputedStyle(e2,'z-index');
//	
//	if (zind > 0) {
//		zind = zind+1;
//	} else {
//		zind = 1;
//	}
//	
//	
//	//add corners
//	topRightCorner = xCreateElement('IMG');
//	topRightCorner.style.position = 'absolute';
//	topRightCorner.style.zindex = zind;
//	topRightCorner.src = imgPath+'drop-tr.png';
//	topRightCorner.className = 'alpha';
//	
//	bottomRightCorner = xCreateElement('IMG');
//	bottomRightCorner.style.position = 'absolute';
//	bottomRightCorner.style.zindex = zind;
//	bottomRightCorner.src = imgPath+'drop-br.png';
//	bottomRightCorner.className = 'alpha';
//	
//	bottomLeftCorner = xCreateElement('IMG');
//	bottomLeftCorner.style.position = 'absolute';
//	bottomLeftCorner.style.zindex = zind;
//	bottomLeftCorner.src = imgPath+'drop-bl.png';
//	bottomLeftCorner.className = 'alpha';
//	
//	xAppendChild(e2, topRightCorner);
//	xAppendChild(e2, bottomRightCorner);
//	xAppendChild(e2, bottomLeftCorner);

//	//async load images and then get the numbers that way?
//	//rightBgOffset = topRightCorner.style.height;
//	//rightBgWidth = topRightCorner.style.width;
//	//bottomBgOffset = bottomLeftCorner.style.width;
//	//bottomBgHeight = bottomLeftCorner.style.height;
//	rightBgOffset = 10;
//	rightBgWidth = 5;
//	bottomBgOffset = 10;
//	bottomBgHeight = 5;

//	//create bottom and right shadows
//	rightShadow = xCreateElement('DIV');
//	rightShadow.className = 'shadow-right';
//	rightShadow.style.width=rightBgWidth+'px';
//	rightShadow.style.height=(height-rightBgOffset)+'px';
//	rightShadow.style.zindex = zind;
//	rightShadow.innerHTML = '&nbsp;';
//	
//	bottomShadow = xCreateElement('DIV');
//	bottomShadow.className = 'shadow-bottom';
//	bottomShadow.style.width=(width-bottomBgOffset)+'px';
//	bottomShadow.style.height=bottomBgHeight+'px';
//	bottomShadow.style.zindex = zind;
//	bottomShadow.innerHTML = '&nbsp;';
//	
//	xAppendChild(e2, rightShadow);
//	xAppendChild(e2, bottomShadow);
//	
//	//position everything
//	xMoveTo(rightShadow,x+width,y+rightBgOffset);
//	xMoveTo(bottomShadow,x+bottomBgOffset,y+height);
//	xMoveTo(topRightCorner,x+width,y);
//	xMoveTo(bottomRightCorner,x+width,y+height);
//	xMoveTo(bottomLeftCorner,x,y+height);
//	
//}

////set heights of all column ids passed to equal the one with the max height
//function xMatchHeights() {
//	var curMaxHeight = 0;
//	for (var i=0; i<arguments.length; ++i) {
//		curHeight = xHeight(xGetElementById(arguments[i]));
//		if (curHeight>curMaxHeight) {
//			curMaxHeight = curHeight;
//		}
//	}
//	if (curMaxHeight>0) {
//		for (var i=0; i<arguments.length; ++i) {
//			xHeight(xGetElementById(arguments[i]),curMaxHeight);
//		}
//	}
//}

////used for news article rollovers
//function addListRolls(myListId,myHoverClass,ignoreClass) {
////add hover class to list, ignoring the passed on state
//	myUL = xGetElementById(myListId);
//	myLIs = xGetElementsByTagName('LI',myUL);
//	for(i=0; i<myLIs.length; i++) {
//		if (myLIs[i].className != ignoreClass) {
//			//this doesn't seem to work in IE
//			//xAddEventListener(myLIs[i],'mouseover',onMouseOver);
//			//xAddEventListener(myLIs[i],'mouseout',onMouseOut);
//			myLIs[i].onmouseover = onMouseOver;
//			myLIs[i].onmouseout = onMouseOut;
//		}
//	}
//	function onMouseOver() {
//		this.className = myHoverClass;
//	}
//	function onMouseOut() {
//		this.className = '';
//	}
//}

////setup scoller for homepage
//function setupHomepageScroll() {
//	new xSimpleScroll('scrollbar',7,125,'scrollbutton',7,22,'news','newsContent');
//}

////simple scroller function
//function xSimpleScroll(sliderId, sliderWidth, sliderHeight , thumbId, thumbWidth, thumbHeight, containerId, contentId ) {
//  
//  var s = xGetElementById(sliderId);
//  xResizeTo(s, sliderWidth, sliderHeight);
//  var lc = xGetElementById(containerId);
//  // Removed positioning, moved it into home.css - Nick A
//  // xMoveTo(s, xPageX(lc) + xWidth(lc) - xWidth(s)+14, xPageY(lc));
//  xShow(s);
//  var t = xGetElementById(thumbId);

//  xResizeTo(t, thumbWidth, thumbHeight);
//  // xMoveTo(t, 0, 0);
//  xShow(t);
//  
//  
//  t.xContent = xGetElementById(contentId)
//  
//  //usable space on scrollbar
//  t.xDivisor = sliderHeight - thumbHeight;
//  //# pixels of content hidden
//  t.xHidden = xHeight(xParent(t.xContent)) - xHeight(t.xContent); 

//  xEnableDrag(t, null, thumbOnDrag, null);
//  
//}
//function thumbOnDrag(e, mdx, mdy) {
//  var newY = xTop(e) + mdy;
//  if (newY >= 0 && newY <= xHeight(xParent(e)) - xHeight(e)) {
//	//move thumb
//	xTop(e, xTop(e) + mdy);
//	//% from top
//	thumbPerFromTop = xTop(e)/e.xDivisor;
//	//figure out wanted top of inner div
//	moveContentTo = Math.round(e.xHidden*thumbPerFromTop);
//	//move contentn
//	xTop(e.xContent,moveContentTo);
//	
//  }
//}

//// functions used in case studies
//function prev() {
//	if (currentPic==1) {
//		newPic = numThumbs;
//	} else {
//		newPic = currentPic-1;
//	}
//	setThumb(newPic);
//}
//function next() {
//	if (currentPic==numThumbs) {
//		newPic = 1;
//	} else {
//		newPic = currentPic+1;
//	}
//	setThumb(newPic);
//}

//function xAddClass(e, c)
//{
//  if ((e=xGetElementById(e))!=null) {
//    var s = '';
//    if (e.className.length && e.className.charAt(e.className.length - 1) != ' ') {
//      s = ' ';
//    }
//    if (!xHasClass(e, c)) {
//      e.className += s + c;
//      return true;
//    }
//  }
//  return false;
//}
//function xRemoveClass(e, c)
//{
//  if(!(e=xGetElementById(e))) return false;
//  e.className = e.className.replace(new RegExp("(^|\\s)"+c+"(\\s|$)",'g'),
//    function(str, p1, p2) { return (p1 == ' ' && p2 == ' ') ? ' ' : ''; }
//  );
//  return true;
//}
//function xHasClass(e, c)
//{
//  e = xGetElementById(e);
//  if (!e || e.className=='') return false;
//  var re = new RegExp("(^|\\s)"+c+"(\\s|$)");
//  return re.test(e.className);
//}

//function setThumb(x) {
//	//first unhighlight current thumb
//	cursquare = xGetElementById('thumb'+currentPic);
//	//cursquare.src = '../img/work/thumb.gif';
//	
//	newsquare = xGetElementById('thumb'+x);
//	xAddClass(newsquare, "active");
//	xRemoveClass(cursquare, "active");
//	//newsquare.src = '../img/work/thumb-on.gif';
//	
//	mythumb = xGetElementById('thumb');
//	mythumb.src = clientFolder+'work-thumb-'+x+'.jpg';
//	currentPic = x;
//}
function setPop(x) {
	myenlarge = xGetElementById('enlarge');
	myenlarge.src = clientFolder+x+'_Large.jpg';
	currentPop = x;
}

function setActive() {
document.getElementById('pageLink_1').className ='active';
document.getElementById('sort33').value ='1';

document.getElementById('left_arrow').style.display = 'none';
document.getElementById('left_arrow2').style.display = '';


}






function nextPop22() {
//document.getElementById('sort33').value ='1';
	prr = 1;
	if (currentPop==numPops) {
		newPop = 1;
		alert('newPop = 1;');
	} else {
		newPop = currentPop+1;
		alert('newPop = currentPop+1;');
	}
	setPop2(newPop);
	
}

function setPop2(x) {

	myenlarge = xGetElementById2('img_small');
	myenlarge.src = clientFolder+x+'.jpg';
	currentPop = x;

	numb = document.getElementById('pageLink_'+x);
	numb.className ='active';

	if (prr==1)
	{

		pr=x-1;
		if(pr>0){
		numb2 = document.getElementById('pageLink_'+pr);
		numb2.className ='';
		} 
		
		if(currentPop==1&&pr==0){
			var i=1;
			for(i=1;i<=5;i++){
				numb2 = document.getElementById('pageLink_'+i);
					if(numb2 ){
						numb2.className ='';
					}
			}
		document.getElementById('pageLink_1').className ='active';
		} 

	prr==0;
	
	}
	
		
}


function setPop3(x) {

	myenlarge = xGetElementById2('img_small');
	myenlarge.src = clientFolder+x+'.jpg';
	currentPop = x;

	numb = document.getElementById('pageLink_'+x);
	numb.className ='active';

	

	if (nrr==1)
	{
		
		//alert('x='+x);
		var nr=x+1;
		if(nr>0){
		numb2 = document.getElementById('pageLink_'+nr);
		numb2.className ='';
		} 
	
		if(x>1)
		{
		document.getElementById('pageLink_1').className ='';
		}

		if(x>0)
		{
		
		} else {
		
		alert('  currentPop =');
		}

		

	nrr==0;
	
	}

		
}




function prevPop22() {
	nrr = 1;
	if (currentPop==1) {
		newPop = numPops;
	} else {
		newPop = currentPop-1;
	}
	setPop3(newPop);
}


 function xGetElementById2(e)
 {
    if(typeof(e)!='string') 
    {
        return e;
     }
    if(document.getElementById) 
        e=document.getElementById(e);
    else 
        if(document.all) 
            e=document.all[e];
         else e=null;
    return e;
 }
 


function enlarge() 
{
	var myPop = xGetElementById('overlayEnlarged');
	xShow(myPop);
}




function nextPop() {
	if (currentPop==numPops) {
		newPop = 1;
	} else {
		newPop = currentPop+1;
	}
	setPop(newPop);
}
function prevPop() {
	if (currentPop==1) {
		newPop = numPops;
	} else {
		newPop = currentPop-1;
	}
	setPop(newPop);
}


function xDef()
 {
    for(var i=0; i<arguments.length; ++i)
    {
        if(typeof(arguments[i])=='undefined') 
            return false;
    }
    return true;
 }
 
 function xGetElementById(e)
 {
    if(typeof(e)!='string') 
    {
        return e;
     }
    if(document.getElementById) 
        e=document.getElementById(e);
    else 
        if(document.all) 
            e=document.all[e];
         else e=null;
    return e;
 }
 
 function xVisibility(e, bShow)
 {
    if(!(e=xGetElementById(e))) 
        return null;
    if(e.style && xDef(e.style.visibility)) 
    {
        if (xDef(bShow)) 
            e.style.visibility = bShow ? 'visible' : 'hidden';
        return e.style.visibility;
    }
    return null;
 }
 
 function xShow(e) 
 {
    return xVisibility(e,1);
 }

function enlarge() 
{
	var myPop = xGetElementById('overlayEnlarged');
	xShow(myPop);
}




function xHide(e)
{
    return xVisibility(e,0);
}


function closeenlarge() {
	currentPop = 1;
	var myPop = xGetElementById('overlayEnlarged');
	xHide(myPop);
	setPop(1);
	//document.getElementById('sort33').value = 1;
	var current_x = parseInt(document.getElementById('sort33').value, 10);

	for(i=1;i<=totalPages;i++){
			numb2 = document.getElementById('pageLink_'+i);
					if(numb2){
						numb2.className ='';
					}
			}
	numb = document.getElementById('pageLink_1');
	numb.className ='active';
	document.getElementById('right_arrow').style.display = 'block';
	document.getElementById('left_arrow2').style.display = 'block';
	document.getElementById('left_arrow').style.display = 'none';

	var imgh = myPageImages2[(0)];
	//document.getElementById('img_small').scr = imgh.src;
		document.getElementById('img_small').src = imgh.src;

//alert(document.getElementById('img_small').src);
}

