// JavaScript Document
function hoverButton(){
	
	$(".hoverbutton").hover(			   
      function () {
		var imgName = $(this).attr("src");
		imgName =  imgName.substr(7, imgName.length-15);
		
        $(this).attr({ 
		src:  "images/" + imgName + "-on.jpg"
		});

      }, 
      function () {
		var imgName = $(this).attr("src");
		imgName =  imgName.substr(7, imgName.length-14);  
        $(this).attr({ 
		src: "images/" + imgName + "-off.jpg"
		});
      }
    );
}
var emailAddress = new Array();
emailAddress[0] = "sendemail,email,info,simplygreatjerky,com";
function isDefined(property) {
  return (typeof property != 'undefined');
}
function escramble(whoto) {
	
	//ensure user agent can do DOM
    var linkText;
	if ((isDefined(document.getElementById)) && (isDefined(document.createElement)))
	{
	//loop through email addresses
	  try {
   	    for (var i=0;i<emailAddress.length;i++) {
			//put data in array
	  	  var x = emailAddress[i].split(',');
		//grab the email span element
		  var element = document.getElementById(x[0]);
		  var theLink;
		//create the actual link
		 if (whoto) {
		   theLink = "mailto:" + whoto + "@" + x[3] + "." + x[4];	 
		 }
		 else {
		   theLink = "mailto:" + x[2] + "@" + x[3] + "." + x[4];
		 }
		//build node for email link
		  emailLink = document.createElement("a");
		  emailLink.href = theLink;
		  
		 //use span so IE 6 doesn't show mailto
		  var linkSpan = emailLink.appendChild(document.createElement("span"));
		  linkText = x[1];
		  if (x[1] == "email")
		  {
			  if (whoto) {
				 linkText = whoto + "@" + x[3] + "." + x[4]; 
			  }
			  else {
			    linkText = x[2] + "@" + x[3] + "." + x[4];
			  }
		  }
		  linkSpan.appendChild(document.createTextNode(linkText));
       
		//replace it!
		  element.parentNode.replaceChild(emailLink, element)
		 

	    }
	  }
		catch(err) {
			
		}
	}
}
function expandImage(imgLoc, imgHeight) {
	if (!imgHeight) {
		imgHeight = 650;
	}
	var largeImage = $(imgLoc).attr("rel");
	 var bigWin = window.open("","bigWin","width=535, height=" +imgHeight+", toolbar=no, status=no, menubar=no, resizable=no");
	 bigWin.document.open();
     bigWin.document.write('<link href="styles.css" rel="stylesheet" type="text/css"/><link href="styles-expand.css" rel="stylesheet" type="text/css"/></head>');
     bigWin.document.write("<body>");
     bigWin.document.write('<p><img  src="images/zoom/' + largeImage + '" alt="expanded image"/></p>');
	//bigWin.document.write('<img  src="' + imgLoc + '" alt="' + imgDesc + '" title="' + imgDesc + '"><br/>');
     bigWin.document.write('<a href="#" onclick="window.close();return false;">click to close</a></body></html>');
     bigWin.focus();
}
