//pop-up

function go_link(page,width,height){
        if ((width < 1000) && (height < 1000)){
                window.open(page,"go_link", "toolbar=no,scrollbars=yes,width=" + width + ",height=" + height + ",resizable=yes")
        }
}

function go_link_noscroll(page,width,height){
        if ((width < 1000) && (height < 1000)){
                window.open(page,"go_link_noscroll", "toolbar=no,scrollbars=no,width=" + width + ",height=" + height + ",resizable=no")
        }
}

function imghighlight(whichimg) {
	var imgsrc = new String(whichimg.src);
	imgsrc = imgsrc.replace(new RegExp('_off\.','g'),'_on\.');
	whichimg.src = imgsrc;
}

function imgnohighlight(whichimg) {
	var imgsrc = new String(whichimg.src);
	imgsrc = imgsrc.replace(new RegExp('_on\.','g'),'_off\.');
	whichimg.src = imgsrc;
}

/****************************************************************
pop-up window functionality
*****************************************************************/
window.onerror=null;
var win = null;

function newWindow(mypage, myname, w, h, scroll) {
closePopWin();
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',noresize';
win = window.open(mypage, myname, winprops);
}

function closePopWin() {
     if(win != null) {
          if(!win.closed) {
              win.close();
              win = null;
          } else {
              win = null;
          }
     }
}
/****************************************************************
pop-up window functionality
*****************************************************************/


/****************************************************************
rollover show/hide - for RockShox Technology, Truvativ icons (downhill, road, etc.)
*****************************************************************/
function show(object,thisRef) {
	if(((thisRef!=undefined)&&(thisRef.className!='technology_off')) || (thisRef==undefined)) {
		if (document.getElementById) {
			document.getElementById(object).style.display = 'block';
		}
		else if (document.layers && document.layers[object]) {
			document.layers[object].display = 'block';
		}
		else if (document.all) {
			document.all[object].style.display = 'block';
		}
	}
}

function hide(object) {
  if (document.getElementById) {
    document.getElementById(object).style.display = 'none';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].display = 'none';
  }
  else if (document.all) {
    document.all[object].style.display = 'none';
  }
}


/****************************************************************
on click show/hide - for RockShox view largers
*****************************************************************/
var state = 'none';
function showhide(layer_ref) {
	if (state == 'block') {
		state = 'none';
	}
	else {
		state = 'block';
	}
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.display = state");
	}
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].display = state;
	}
	if (document.getElementById && !document.all) {
		maxwell_smart = document.getElementById(layer_ref);
		maxwell_smart.style.display = state;
	}
}

/****************************************************************
MooFX support for detail overlay/popups
*****************************************************************/

function fadeUp( id ) {
	if($('pageMiddleContainer')) {
		var allLargers = document.getElementsByClassName('viewLarger','pageMiddleContainer');
		allLargers.each(
			function(el) {
				if(el!=$(id)) el.style.display = 'none';
			}
		);
	} // if
	thisOpacity = new fx.Opacity(id);
	thisOpacity.setOpacity(0);
	$(id).style.display = 'block';
	thisOpacity.custom(0,1);
} // function..fadeUp

function fadeDown( id ) {
	thisOpacity = new fx.Opacity(id, { oncomplete : function() {$(id).style.display = 'none'}  });
	thisOpacity.custom(1,0);
} // function..fadeDown
