/* Page Load Event Modifier */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}
/* IE Suckerfish Initialization */
sfHover = function() {
	var sfEls = document.getElementById("main-nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
/* Image Rollover Initialization Function */
var arrRollovers = new Array();
function initRollovers() {
	var arrAnchors = document.getElementsByTagName("a");
	for (var i=0; i<arrAnchors.length; i++) {
		if (arrAnchors[i].className.indexOf("rollover")!=-1) {
			arrAnchors[i].imgObj = arrAnchors[i].getElementsByTagName("img")[0];
			arrAnchors[i].strOff = arrAnchors[i].imgObj.src;
			arrAnchors[i].strOn = arrAnchors[i].imgObj.src.replace("-0.","-1.");
			arrAnchors[i].imgOn = new Image();
			arrAnchors[i].imgOn.src = arrAnchors[i].strOn;
			arrAnchors[i].onmouseover = function() { this.imgObj.src = this.strOn; }
			arrAnchors[i].onmouseout = function() { this.imgObj.src = this.strOff; }
		}
	}
}
addLoadEvent(function() {
  initRollovers();
});
if(typeof jQuery == 'function'){
$(document).ready(function() {
	$("div.blue-content-box").each(function(i) {
		$(this).wrapInner("<div class=\"bg-bottom-left\"></div>");
		$(this).wrapInner("<div class=\"bg-bottom-right\"></div>");
		$(this).wrapInner("<div class=\"bg-left\"></div>");
		$(this).after("<div class=\"clearboth\">&nbsp;</div>");
	});
	$("div.blue-box-title").each(function(i) {
		$(this).wrapInner("<div class=\"title-bg-left\"></div>");
		$(this).wrapInner("<div class=\"title-bg-right\"></div>");
	});
	$("div.cart-info").after("<div class=\"clearboth\">&nbsp;</div>");
	$("table.cart-table tr:first").addClass("first-row");
	$("table.cart-table tr:last").addClass("last-row");
});
}

function chooserSwitch(vPos) {
var imgPointer = document.getElementById('thumbs');
var txtTitleTop = document.getElementById('title-top');
var txtDetailTop = document.getElementById('detail-top');
var txtTitleMiddle = document.getElementById('title-middle');
var txtDetailMiddle = document.getElementById('detail-middle');
var txtTitleBottom = document.getElementById('title-bottom');
var txtDetailBottom = document.getElementById('detail-bottom');
var imgMain = document.getElementById('mainImage');
switch(vPos)
    {
        case 'top':
			strFlippityFlop = 'top';
            imgPointer.style.backgroundPosition = '145px 30px';
            imgMain.className = 'image-top';
            txtTitleMiddle.style.display = 'none';
            txtDetailMiddle.style.display = 'none';
            txtTitleBottom.style.display = 'none';
            txtDetailBottom.style.display = 'none';
            txtTitleTop.style.display = 'block';
            txtDetailTop.style.display = 'block';
            break;
        case 'middle':
			strFlippityFlop = 'middle';
            imgPointer.style.backgroundPosition = '145px 140px';
            imgMain.className = 'image-middle';
            txtTitleTop.style.display = 'none';
            txtDetailTop.style.display = 'none';
            txtTitleBottom.style.display = 'none';
            txtDetailBottom.style.display = 'none';
            txtTitleMiddle.style.display = 'block';
            txtDetailMiddle.style.display = 'block';
            break;
        case 'bottom':
			strFlippityFlop = 'bottom';
            imgPointer.style.backgroundPosition = '145px 250px';
            imgMain.className = 'image-bottom';
            txtTitleTop.style.display = 'none';
            txtDetailTop.style.display = 'none';
            txtTitleMiddle.style.display = 'none';
            txtDetailMiddle.style.display = 'none';
            txtTitleBottom.style.display = 'block';
            txtDetailBottom.style.display = 'block';
            break;
    }
}

function flippityFlop() {
	switch(strFlippityFlop)
		{
			case 'top':
				strFlippityFlop = 'middle';
				break;
			case 'middle':
				strFlippityFlop = 'bottom';
				break;
			case 'bottom':
				strFlippityFlop = 'top';
				break;
		}
	chooserSwitch(strFlippityFlop);
}