// JavaScript Document

<!--//--><![CDATA[//><!--
/* IE 7 Drop Menu Fix */
sfHover = function() {
	//Navigation Drop Menu
	var sfEls = document.getElementById("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"), "");
		}
	}
	//Catalog Viewer and other table cells
	var sfElTDs = document.getElementById("catalogCatViewBlock").getElementsByTagName("td");
	for (var j=0; j<sfElTDs.length; j++) {
		sfElTDs[j].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfElTDs[j].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]>
//author: Colin Cole -- cmcole@jamestower.com

//This will remove the start value when the user clicks into the textbox
function onFocusDeleteText(control)
{
	if(control.value != "" && control.value == control.getAttribute("startvalue")) {
		control.value = "";
		if (has(control,"dataclass")){
			if (control.className)
				control.className = control.getAttribute("dataclass");
			else
				control.setAttribute("class", control.getAttribute("dataclass"));
		}
	}	
}

//This will set it back to the start value, if the person didn't enter any data (happens when user leaves textbox)
function onBlurTextReplace(control)
{
	if(control.value == "") {
		control.value = control.getAttribute("startvalue");
		if (has(control,"emptyclass")){
			if (control.className)
				control.className = control.getAttribute("emptyclass");
			else
				control.setAttribute("class", control.getAttribute("emptyclass"));
		}
	}
}

//Firefox vs. IE --> checking to see if you actually want there to be styles.
function has(control,child){
  return ((control.hasAttribute && control.hasAttribute(child) ) || control.getAttribute(child));
}
/*Show Hid Div Tags*/
function showDiv(d) {
    if (document.getElementById) {
       var curDiv = document.getElementById(d);
       curDiv.style.display = "block";
  }
}
function hideDiv(e) {
    if (document.getElementById) {
       var cuDiv = document.getElementById(e);
       cuDiv.style.display = "none";
  }
}
/*-Change the source of the main image-*/
function changeImg(im,toChange) {
 if (document.getElementById) {
  var mainImg = document.getElementById(toChange);
  var cImg = 'http://www.itselementary.com/images/'+im;
  mainImg.src=cImg;
 } 
}
/*-Zoom into the current image being viewed-*/
function fnViewLargeImg() {
	if (document.getElementById) {
		var nURL=document.getElementById('mainPrdtImg');
  		imgURL=nURL.src;
	}
	day2 = new Date();
	//id2 = day2.getTime();
	id2 = "Viewer";
	thisWin = eval("page" + id2 + " = window.open(imgURL, '" + id2 + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=540,height=680,left = 100,top = 10');");
	var tmp = thisWin.document;
	tmp.write('<center><img src="http://www.itselementary.com/images/Itselementary_viewerlogo.jpg" alt="Andersons Its Elementary" border="0" /><br /><img src="'+imgURL+'" onError="this.src=\'http://www.itselementary.com/images/noImg.jpg\'" /><p /><a href="javascript: this.close();" style="border:0px;"><img src="http://www.itselementary.com/images/closeImgBtn.jpg" alt="Close Window" border="0" /></a></center>');
	tmp.close();
}
/*--Show the Stock Graphics List*/
   function GfxList() {
     showList=window.open("/stock_gfx_list.cfm", "Stock Graphics List", "width=750,height=650,toolbar=no,menubar=no,status=no,resizable=no,scrollbars=no,screenX=10,screenY=10,left=10,top=10");
     showList.focus();
     return false;
   }