//function flashfix() {
//	theObjects = document.getElementsByTagName("object");
//	for (var i = 0; i < theObjects.length; i++) {
//		theObjects[i].outerHTML = theObjects[i].outerHTML;
//	}
//} 

//addLoadEvent(flashfix);

function gotoURL(url){
	window.location.assign(url);
}

function changeColor(event, color){
	event = event || window.event;
	var button = event.target || event.srcElement;

	button.style.backgroundColor = color;
	button.style.fontWeight = "bolder";
	button.style.color = "#31659C";
	button.style.textDecoration = "underline";
}

function changeColorBack(event, color){
	event = event || window.event;
	var button = event.target || event.srcElement;

	button.style.backgroundColor = color;
	button.style.fontWeight = "bold";
	button.style.fontSize = "13px";
	button.style.color = "#000000";
	button.style.textDecoration = "none";

}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function insertAfter(newElement,targetElement) {
  var parent = targetElement.parentNode;
  if (parent.lastChild == targetElement) {
    parent.appendChild(newElement);
  } else {
    parent.insertBefore(newElement,targetElement.nextSibling);
  }
}

function addClass(element,value) {
  if (!element.className) {
    element.className = value;
  } else {
    newClassName = element.className;
    newClassName+= " ";
    newClassName+= value;
    element.className = newClassName;
  }
}

function highlightPage() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("navigation")) return false;
  var nav = document.getElementById("navigation");
  var links = nav.getElementsByTagName("a");
  for (var i=0; i<links.length; i++) {
    var linkurl = links[i].getAttribute("href");
    var currenturl = window.location.href;
    if (currenturl.indexOf(linkurl) != -1) {
      links[i].className = "here";
      var linktext = links[i].lastChild.nodeValue.toLowerCase();
      document.body.setAttribute("id",linktext);
    }
  }
}

function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function startBlink() {
	if (document.all)
		setInterval("doBlink()",500)
}

function doBlink() {
	var blink = document.all.tags("BLINK")
	for (var i=0; i<blink.length; i++)
		blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : "" 
}






var shoppingSidebar =0;
/*
if(alertSize() >= 1436){//1440
	//expand width to fit three item columns
	writeCSS(1419,3);
}else 
*/
if(alertSize() >= 1276){//1280
	//expand width to fit two item columns
	writeCSS(1259,2);
	shoppingSidebar = 2
}else{//1024
	//do nothing
	var style="";
	style +="<style>\
	#hsi2{\
		display:none;\
	}\
</style>";
	document.write(style);
	shoppingSidebar = 1;
}

function writeCSS(width,cols){
	var style="";
	style += "<style>";
	style += "#MainContainer{width:"+width+"px !important;}";
	
	switch(cols){
	case 2:
		style += ".fib{\
			float:left;\
			width:50%;\
		}\
		#othersidebar{\
			width:508px !important;\
		}\
		"
		break;
	case 1:
		style += ".fib{\
			float:left;\
		}\
		.hsi2{\
			display:none;\
		}"
		break;
	default:
		break;
	}
	style += "</style>";
	document.write(style);
}

function alertSize() {
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    return window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    return document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    return document.body.clientWidth;
  }
  return 0;
}