// JavaScript Document
// One of these boolean variables will be
// set to true based on the browser name

var its_ie = false
var its_ns = false
var its_opera = false
var its_webtv = false
var its_compatible = false

// One of these boolean variables will be set to 
// true based on the Internet Explorer version

var its_ie2 = false
var its_ie3 = false
var its_ie4 = false
var its_ie5 = false
var its_ie55 = false
var its_ie6 = false
var its_ie4plus = false
var its_ie5plus = false
var its_ie55plus = false
var its_ie6plus = false
var its_ie6minus = false

// One of these boolean variables will be set to 
// true based on the Netscape version
var its_ns2 = false
var its_ns3 = false
var its_ns4 = false
var its_ns6 = false
var its_ns3plus = false
var its_ns4plus = false
var its_ns6plus = false

// One of these boolean variables will be
// set to true based on the operating system
var its_win31 = false
var its_win95 = false
var its_win98 = false
var its_winme = false
var its_winnt = false
var its_win2000 = false
var its_winxp = false
var its_windows = false
var its_win32 = false
var its_mac68k = false
var its_macppc = false
var its_macos = false
var its_linux = false
var its_other_os = false

// This will be true of the browser supports some kind of DHTML
var dhtml_ok = false

// Let's work with lowercase letters to keep things simple
var user_agent = navigator.userAgent.toLowerCase()

// BROWSER NAME

// Use indexOf() to examine the userAgent string
// for telltale signs of the browser name

if (user_agent.indexOf("opera") != -1) { its_opera = true }
else if (user_agent.indexOf("webtv") != -1) { its_webtv = true }
else if (user_agent.indexOf("msie") != -1) { its_ie = true }
else if (user_agent.indexOf("mozilla") != -1) {

    // For "moziila", we need to rule out some other possibilities, first
    if ((user_agent.indexOf("compatible") == -1) && 
        (user_agent.indexOf("spoofer") == -1) && 
        (user_agent.indexOf("hotjava") == -1)) {
        its_ns = true
    }
    else { its_compatible = true }
}

// BROWSER VERSION

var major_version = parseInt(navigator.appVersion)
var full_version = parseFloat(navigator.appVersion)
var ie_start = user_agent.indexOf("msie")

if (ie_start != -1) {
    var version_string = user_agent.substring(ie_start + 5)
    major_version = parseInt(version_string)
    full_version = parseFloat(version_string)
}

// INTERNET EXPLORER
if (its_ie || its_webtv) {
    if (major_version < 3) { its_ie2 = true }
    else if (major_version == 3) { its_ie3 = true }
    else if (major_version == 4) { its_ie4 = true }
    else if (major_version == 5) { its_ie5 = true }
    else if (full_version == 5.5) { its_ie55 = true }
    else if (major_version == 6) { its_ie6 = true }

    if (major_version >= 4) { its_ie4plus = true }
    if (major_version >= 5) { its_ie5plus = true }
    if (full_version >= 5.5) { its_ie55plus = true }
    if (major_version >= 6) { its_ie6plus = true }
	if (major_version <= 6) { its_ie6minus = true }
}

// NETSCAPE
if (its_ns) {
    if (major_version < 3) { its_ns2 = true }
    else if (major_version < 4) { its_ns3 = true }
    else if (major_version == 4) { its_ns4 = true }
    else if (major_version == 5) { its_ns6 = true }

    if (major_version >= 3) { its_ns3plus = true }
    if (major_version >= 4) { its_ns4plus = true }
    if (major_version >= 5) { its_ns6plus = true }
}

// OPERATING SYSTEM

// Use indexOf() to examine the userAgent string
// for telltale signs of the operating system

// WINDOWS 3.1
if ((user_agent.indexOf("windows 3.1") != -1) || 
    (user_agent.indexOf("win16") != -1) ||
    (user_agent.indexOf("16bit") != -1) ||
    (user_agent.indexOf("16-bit") != -1)) { its_win31 = true }

// WINDOWS 95
else if ((user_agent.indexOf("windows 95") != -1) || 
         (user_agent.indexOf("win95") != -1)) { its_win95 = true }

// WINDOWS ME
if (user_agent.indexOf("win 9x 4.90") != -1) { its_winme = true }

// WINDOWS 98
else if ((user_agent.indexOf("windows 98") != -1) || 
         (user_agent.indexOf("win98") != -1)) { its_win98 = true }

// WINDOWS XP
else if ((user_agent.indexOf("windows nt 5.1") != -1) || 
         (user_agent.indexOf("winnt 5.1") != -1)) { its_winxp = true }

// WINDOWS 2000
else if ((user_agent.indexOf("windows nt 5.0") != -1) || 
         (user_agent.indexOf("winnt 5.0") != -1)) { its_win2000 = true }

// WINDOWS NT
else if ((user_agent.indexOf("windows nt") != -1) || 
         (user_agent.indexOf("winnt") != -1)) { its_winnt = true }

// MAC 680x0
else if ((user_agent.indexOf("mac") != -1) && 
        ((user_agent.indexOf("68K") != -1) || 
         (user_agent.indexOf("68000") != -1))) { its_mac68k = true }

// MAC PowerPC
else if ((user_agent.indexOf("mac") != -1) && 
        ((user_agent.indexOf("ppc") != -1) || 
         (user_agent.indexOf("powerpc") != -1))) { its_macppc = true }

// LINUX
else if (user_agent.indexOf("linux") != -1) { its_linux = true }

// OTHER OS
else { its_other_os = true }

// PLATFORM

// Use the operating system booleans to
// determine the general platform

// MAC OS
if (its_mac68k || its_macppc) { its_macos = true}

// 32-BIT WINDOWS
if (its_win95 || its_win98 || its_winme || its_winnt || its_win2000 || its_winxp) {its_win32 = true}

// WINDOWS
if (its_win31 || its_win32) {its_windows = true}

// DHTML SUPPORT
if (document.getElementById || document.all || document.layers) {
    dhtml_ok = true
} 


function gotoGallery()
	{
	window.scrollBy(0,155);
	}

function findjs()
{
	alert ('HERE')
}

function setMidPhoto(picsrc,bigPicHref,width,height)
{
	var imgLink = document.getElementById("midsize")
	imgLink.src = picsrc
	document.getElementById("midImageHRef").href = 'javascript:openBigPicWin(\'' + bigPicHref + '\',' + width + ',' + height + ');'
}	

function photoDetails(picsrc,desc,dim,price)
{
	var imgLink = document.getElementById("bigpic")
	imgLink.src = picsrc	
	document.getElementById("pictitle").innerHTML = desc
	document.getElementById("dimId").innerHTML = dim
	document.getElementById("priceId").innerHTML = price
}	

function photoDetails2(picsrc,bigPicHref,desc,dim)
{
	var imgLink = document.getElementById("bigpic")
	imgLink.src = picsrc
	
	document.getElementById("hrefid").href = 'javascript:openBigPicWin(\'' + bigPicHref + '\');';
	document.getElementById("pictitle").innerHTML = desc
	document.getElementById("dimId").innerHTML = dim
}	

function photoDetails2A(picsrc,bigPicHref,width,height,desc,dim)
{
	var imgLink = document.getElementById("bigpic")
	imgLink.src = picsrc
	
	document.getElementById("hrefid").href = 'javascript:openBigPicWin(\'' + bigPicHref + '\',' + width + ',' + height + ');';
	document.getElementById("pictitle").innerHTML = desc
	document.getElementById("dimId").innerHTML = dim
	if (dim.length > 3)
		{
		document.getElementById("hdnih").innerHTML = "Height does not include handle."
		}
	else
		{
		document.getElementById("hdnih").innerHTML = "&nbsp;"
		}
}	
function photoDetails2B(picsrc,bigPicHref,width,height,desc)
{
	var imgLink = document.getElementById("bigpic")
	imgLink.src = picsrc
	
	document.getElementById("hrefid").href = 'javascript:openBigPicWin(\'' + bigPicHref + '\',' + width + ',' + height + ');';
	document.getElementById("pictitle").innerHTML = desc

}	

function photoDetails3(picsrc,desc)
{
	var imgLink = document.getElementById("bigpic")
	imgLink.src = picsrc	
	document.getElementById("pictitle").innerHTML = desc
}

function photoDetails4(picsrc,bigPicHref,desc)
{
	var imgLink = document.getElementById("bigpic")
	imgLink.src = picsrc
	
	document.getElementById("hrefid").href = 'javascript:openBigPicWin(\'' + bigPicHref + '\');';
	document.getElementById("pictitle").innerHTML = desc
}	


function openBigPicWin(bigImage,imgWidth,imgHeight) 
	{
	/* Get the file to display from the src connected with the bigpic id tag */		
/* 	var photoLink = document.getElementById("bigpic")	
 	var URL = 'showimage.html?' + photoLink.src
	*/

	var URL = 'showimage.html?' + bigImage + ',' + imgWidth + ',' + imgHeight
	
 	var wdh = 0
 	var hgt = 0
 	var scrollbrs = 'no'
 	var resize = 'no'
	tb = "no"   //toolbars
	mb = "no"   //menubars
	st = "no"   //status

	if(resize != 'yes' && resize != 'no') 
		re =  "yes";
	else
		re = resize;

	if(scrollbrs != 'yes' && scrollbrs != 'no') 
		sb =  "yes";
	else
		sb = scrollbrs;

/*  Settings for a 465 x 465 photo */
/*	var h = Math.round(screen.availHeight * .7);
	var w = Math.round(screen.availWidth * .7);
	var winl = Math.round(screen.availHeight * .19);
	var wint = Math.round(screen.availWidth * .12);
	*/
	
/*  Settings for a 500 x 500 window/photo */
/*	var winl = Math.round(screen.availHeight * .12);
	var wint = Math.round(screen.availWidth * .07);
*/	
	
	if ((its_ie) && (its_ie6minus))
		{
		var h = Math.round(screen.availHeight * .95);
		var w = Math.round(screen.availWidth * .8);
		var amt = screen.availWidth - (screen.availWidth * .8);
		var winl = Math.round(amt/2);
		var wint = 10;		}
	else
		{
		var h = Math.round(screen.availHeight * .95);
		var w = Math.round(screen.availWidth * .8);
		var amt = screen.availWidth - (screen.availWidth * .8);
		var winl = Math.round(amt/2);
		var wint = 10;		
		}
		
	strWindow = "width="+w+",height="+h+",top="+wint+",left="+winl;
	strWindow = strWindow+",toolbar="+tb+",menubar="+mb+",scrollbars="+sb;
	strWindow = strWindow+",status="+st+",resizable="+re;
	
	aWindow = window.open(URL,"newwindow",strWindow);
		
	}
function showEmailResponse() 
	{

	var URL = 'emailresponse.html'
	
 	var wdh = 0
 	var hgt = 0
 	var sb = 'no'
 	var re = 'no'
	tb = "no"   //toolbars
	mb = "no"   //menubars
	st = "no"   //status
	
	if ((its_ie) && (its_ie6minus))
		{
		var h = Math.round(screen.availHeight * .2);
		var w = Math.round(screen.availWidth * .1);
		var amt = screen.availWidth - (screen.availWidth * .1);
		var winl = Math.round(amt/2);
		var wint = 10;		}
	else
		{
		var h = Math.round(screen.availHeight * .2);
		var w = Math.round(screen.availWidth * .1);
		var amt = screen.availWidth - (screen.availWidth * .1);
		var winl = Math.round(amt/2);
		var wint = 10;		
		}
		
	strWindow = "width="+w+",height="+h+",top="+wint+",left="+winl;
	strWindow = strWindow+",toolbar="+tb+",menubar="+mb+",scrollbars="+sb;
	strWindow = strWindow+",status="+st+",resizable="+re;
	
	aWindow = window.open(URL,"newwindow",strWindow);
		
	}
	
	

/*function keypress_Quantity(event_object)
	{
	
	if (document.all)
		//This code intended for IE 4 & later
		{
		if (event.keyCode > 47 && event.keyCode < 58)			
			return;			
		else
			return false;
		}
	else if (document.getElementById)
		//This code intended for Netscape 6 & later
		{
		if (key_event.which > 47 && key_event.which < 58)			
			return;			
		else
			return false;
		}
	else if (document.layers)
		//This code intended for Netscape 4
		{
		if (key_event.which > 47 && key_event.which < 58)			
			return;			
		else
			return false;
		}
	}
*/

/*function keypress_Quantity(e)
	{
	
	if (document.all)
		{
		status = parseInt(String.fromCharCode(e.keyCode));	
		if ((status >= 0) && (status <= 9))		
			return true;
		else
			return false;
		}
	else if (document.getElementById)
		{
		status = parseInt(String.fromCharCode(e.which));	
		if ((status >= 0) && (status <= 9))		
			return true;
		else
			return false;
		}
	else if (document.layers)
		{
		status = parseInt(String.fromCharCode(e.which));
		if ((status >= 0) && (status <= 9))		
			return true;
		else
			return false;
		}
	}*/

function openSomeOptions(prodName,prodNum,optionName) 
	{
	/* Get the file to display from the src connected with the bigpic id tag */		
/* 	var photoLink = document.getElementById("bigpic")	
 	var URL = 'showimage.html?' + photoLink.src
	*/

	var URL = 'showoptions.php?option=';
 	var wdh = 0
 	var hgt = 0
 	var scrollbrs = 'yes'
 	var resize = 'yes'
	tb = "no"   //toolbars
	mb = "no"   //menubars
	st = "no"   //status

	if(resize != 'yes' && resize != 'no') 
		re =  "yes";
	else
		re = resize;

	if(scrollbrs != 'yes' && scrollbrs != 'no') 
		sb =  "yes";
	else
		sb = scrollbrs;

/*  Settings for a 465 x 465 photo */
/*	var h = Math.round(screen.availHeight * .7);
	var w = Math.round(screen.availWidth * .7);
	var winl = Math.round(screen.availHeight * .19);
	var wint = Math.round(screen.availWidth * .12);
	*/
	
/*  Settings for a 500 x 500 window/photo */
/*	var winl = Math.round(screen.availHeight * .12);
	var wint = Math.round(screen.availWidth * .07);
*/	
	
	if ((its_ie) && (its_ie6minus))
		{
		var h = Math.round(screen.availHeight * .6);
		var w = Math.round(screen.availWidth * .7);
		var amt = screen.availWidth - (screen.availWidth * .7);
		var winl = Math.round(amt/2);
		var wint = 5;
/*		var h = 500;
		var w = 330;
		var winl = 0;
		var wint = 0;*/
		/*URL = URL + '*productName=' + prodName + '*productNum='+ prodNum + '*attributeid=' + optionNum + '*width=' + w + '*height=' + h + '*attributeName=' + optionName;*/
		URL = URL + '*productName=' + prodName + '*productNum=' + prodNum + '*width=' + w + '*height=' + h + '*attributeName=' + optionName;
		}
	else
		{
		var h = Math.round(screen.availHeight * .6);
		var w = Math.round(screen.availWidth * .7);
		var amt = screen.availWidth - (screen.availWidth * .7);
		var winl = Math.round(amt/2);
		var wint = 5;
/*		var h = 500;
		var w = 330;
		var winl = 0;
		var wint = 0;*/
		URL = URL + '*productName=' + prodName + '*productNum=' + prodNum + '*width=' + w + '*height=' + h + '*attributeName=' + optionName;
		}
		

	strWindow = "width="+w+",height="+h+",top="+wint+",left="+winl;
	strWindow = strWindow+",toolbar="+tb+",menubar="+mb+",scrollbars="+sb;
	strWindow = strWindow+",status="+st+",resizable="+re;
	
	aWindow = window.open(URL,"newwindow",strWindow);
		
	}
function openSomeOptions2(optionName) 
	{
/*	alert("START" + optionName);*/
	var URL = 'attributelists.php?option=';
 	var wdh = 0
 	var hgt = 0
 	var scrollbrs = 'yes'
 	var resize = 'yes'
	tb = "no"   //toolbars
	mb = "no"   //menubars
	st = "no"   //status

	if(resize != 'yes' && resize != 'no') 
		re =  "yes";
	else
		re = resize;

	if(scrollbrs != 'yes' && scrollbrs != 'no') 
		sb =  "yes";
	else
		sb = scrollbrs;

	if ((its_ie) && (its_ie6minus))
		{
		var h = Math.round(screen.availHeight * .6);
		var w = Math.round(screen.availWidth * .7);
		var amt = screen.availWidth - (screen.availWidth * .7);
		var winl = Math.round(amt/2);
		var wint = 5;
		URL = URL + 'optionName';
		}
	else
		{
		var h = Math.round(screen.availHeight * .6);
		var w = Math.round(screen.availWidth * .7);
		var amt = screen.availWidth - (screen.availWidth * .7);
		var winl = Math.round(amt/2);
		var wint = 5;
		URL = URL + optionName;
		}
		

	strWindow = "width="+w+",height="+h+",top="+wint+",left="+winl;
	strWindow = strWindow+",toolbar="+tb+",menubar="+mb+",scrollbars="+sb;
	strWindow = strWindow+",status="+st+",resizable="+re;
	
	aWindow = window.open(URL,"newwindow",strWindow);
		
	}
function openInfoPage(infoPage) 
	{
 	var wdh = 0
 	var hgt = 0
 	var scrollbrs = 'yes'
 	var resize = 'yes'
	tb = "no"   //toolbars
	mb = "no"   //menubars
	st = "no"   //status

	if(resize != 'yes' && resize != 'no') 
		re =  "yes";
	else
		re = resize;

	if(scrollbrs != 'yes' && scrollbrs != 'no') 
		sb =  "yes";
	else
		sb = scrollbrs;

	if ((its_ie) && (its_ie6minus))
		{
		var h = Math.round(screen.availHeight * .6);
		var w = Math.round(screen.availWidth * .8);
		var amt = screen.availWidth - (screen.availWidth * .8);
		var winl = Math.round(amt/2);
		var wint = 5;
		}
	else
		{
		var h = Math.round(screen.availHeight * .6);
		var w = Math.round(screen.availWidth * .8);
		var amt = screen.availWidth - (screen.availWidth * .8);
		var winl = Math.round(amt/2);
		var wint = 5;
		}
	strWindow = "width="+w+",height="+h+",top="+wint+",left="+winl;
	strWindow = strWindow+",toolbar="+tb+",menubar="+mb+",scrollbars="+sb;
	strWindow = strWindow+",status="+st+",resizable="+re;
	aWindow = window.open(infoPage,"newwindow",strWindow);
	}
function setbg()
{
/*PUT THIS IN BODY TAG -  <body onload="setbg()">*/	
document.getElementById('navID').style.backgroundColor = "#FFFFFF";
}

function keypress_NumOnly(event_object)
	{
	if (document.all)
		//This code intended for IE 4 & later
		{
		if (event.keyCode > 47 && event.keyCode < 58)			
			return;			
		else
			{
			if (event.keyCode == 46) 	
				return true;
			else
				return false;
			}
		}
	else if (document.getElementById)
		//This code intended for Netscape 6 & later
		{
		if (event.keyCode > 47 && event.keyCode < 58)			
			{
			return true;
			}
		else
			{
			if (event.keyCode == 46) 	
				return true;
			else
				{
				return false;
				}
			}
		
		
		if (key_event.which > 47 && key_event.which < 58)
			{
			return true;			
			}
		else
			{
			if (key_event.which == 46)
				{
				return true;
				}
			else
				{
				return false;
				}
			}
		}
	else if (document.layers)
		//This code intended for Netscape 4
		{
		if (key_event.which > 47 && key_event.which < 58)			
			return;			
		else
			{
			if (key_event.which == 46) 	
				return true;
			else
				return false;
			}
		}
	}

function getScrollPos() 
{
/*	alert("Start getScroll")
	alert("TOP = " + document.getElementById("attrListBox").scrollTop)*/
/*	var fieldLink = document.getElementById("fieldHold")
	fieldLink.value = document.getElementById("attrListBox").scrollTop*/
	document.getElementById("fieldHold").value = document.getElementById("attrListBox").scrollTop
/*	alert("fieldHold = " + document.getElementById("fieldHold").value)*/
}
function setScrollPos(scrollPos) 
{
/*	alert("Start setScroll")
	alert("Parm in = " + scrollPos)*/
	document.getElementById("attrListBox").scrollTop = scrollPos
}
function setEmailFields(obj1)
{
	alert("Start setEmailFields");
	var els = obj1.elements; 
	for(i=0; i<els.length; i++) 
		{
		if (els[i].name == "emailnameIN")
			obj1.emailnameOUT.value = els[i].value;
		if (els[i].name == "emailmessageIN")
			obj1.emailmessageOUT.value = els[i].value;	
		}		
}

	
	
	/*document.all[4].name*/
	
	/*var x=document.getElementsByTagName("input");
  	alert(x.length);
	var x=document.getElementsByTagName("select");
  	alert(x.length);
	var x=document.getElementsByTagName("textarea");
  	alert(x.length);*/
	
	/*var attForm = document.attributeform;*/
	
		/*if (els[i].name == "attributeNeck Size")
				{
				var neckSize = els[i].value;
				if (neckSize.length == 0)
					{
					alert("Please enter the circumference of your dog's neck in inches.");
					return false;
					}
				}*/

function keypress_Quantity(frmObj)
{
if (document.frmObj.itemquan.value.length == 0) 
      {
      alert("Please enter a Quantity.");
      } 
else if (chkNumeric(document.frmObj.itemquan.value) == false) 
      {
      alert("Quantity entered is NOT a number.");
      }	
}
	
function chkNumeric(strString)
   //  check for valid numeric strings	
   {
   /*var strValidChars = "0123456789.-";*/
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;
 
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function setPPFields(obj1,catname,itemprice,percost,formcnt)
{
	
	thisoptform = "optionsform" + formcnt;
	thisattform = "attform" + formcnt;
			
	var holdPerCost = 0;
	var totAddCost = 0;
	var perText = "";
	var allAttributes = "";
	var allAttNoAmp = "";
	
	var x=document.getElementById(thisattform);
	for (var i=0;i<x.elements.length;i++)
  		{
		/*htmlName = document.getElementById(thisattform).elements[i].name;
		htmlValue = document.getElementById(thisattform).elements[i].value;*/
		htmlName = x.elements[i].name;
		htmlValue = x.elements[i].value;
		attribute = htmlName.substr(0,9);
		if (attribute == "attribute")
			{
			var hold = htmlValue;
			attrName = 	htmlName.substr(9,(htmlName.length - 9))
			/*alert("attrName = " + attrName);*/
			/*attributes that are select tags may contain option tags that have additional costs              These tags were marked with *AC* in the last 4 characters of the html name attribute. Check the selected field to determine if customer selected option from dropdown which contains an additional cost in its value attribute.*/
			addCostMarker = htmlName.substr((htmlName.length - 4),4)
			if (addCostMarker == "*AC*")
				{
				var selIndex = x.elements[i].selectedIndex;
				var idObj = document.getElementById(htmlName);
				/*alert(idObj.options[selIndex].text);
				alert(idObj.options[selIndex].value);*/
				if (idObj.options[selIndex].value > 0)
					{
					/*Remove *AC* marker*/
					attrName = 	attrName.substr(0,(attrName.length - 4))
					allAttributes +=  "&" + attrName;
					allAttributes += "=$" + idObj.options[selIndex].value;
					allAttNoAmp += " " + attrName;
					allAttNoAmp += "=$" + idObj.options[selIndex].value;
					totAddCost = totAddCost + idObj.options[selIndex].value;
					}
				}
			else
			if (hold.length > 0)	
				{
				allAttributes +=  "&" + attrName;
				allAttributes += "=" + htmlValue;
				allAttNoAmp += " " + attrName;
				allAttNoAmp += "=" + htmlValue;
				}
			}

		if (htmlName == "quantity")
			{
			var quan = htmlValue;
			if (quan.length == 0)
				{
				alert("Please enter a quantity.");
				return false;
				}
			else
			if (htmlValue == 0)
				{
				alert("Please enter a quantity.");
				return false;
				}
			else
			if (chkNumeric(htmlValue) == false) 
		      	{
		      	alert("Quantity entered is not a number.");
				return false;
		      	}
			else
				{
				htmlValue = parseInt(quan);
				}
			}
			
		if (htmlName == "attributePersonalization")
			{
			perText = htmlValue;
			}			
		}

/*	Remove leading spaces from personalization*/
	while (perText.substring(0,1) == ' ') 
        perText = perText.substring(1, perText.length);

	/*Item has additional cost for personalization*/
	if ((perText.length > 0) || (totAddCost > 0))
		{
		var x=document.getElementById(thisoptform);
		var totCost = 0;
		if (perText.length > 0) 
			{
			totCost = parseFloat(itemprice) + parseFloat(percost) + parseFloat(totAddCost);	
			}
		else
			{
			totCost = parseFloat(itemprice) + parseFloat(totAddCost);	
			}

		for (var i=0;i<x.elements.length;i++)
			{
			if (document.getElementById(thisoptform).elements[i].name == "amount")
				{
				document.getElementById(thisoptform).elements[i].value = totCost;
				if (perText.length > 0)
					{
					allAttributes += "&Personalization Cost = $" + percost;	
					allAttNoAmp += " Personalization Cost = $" + percost;
					}
				}
			
			if (document.getElementById(thisoptform).elements[i].name == "quantity")
				{
				document.getElementById(thisoptform).elements[i].value = quan;
				}		
			}
		}
	

	var x=document.getElementById(thisoptform);
	for (var i=0;i<x.elements.length;i++)
		{
		if (document.getElementById(thisoptform).elements[i].name == "quantity")
			{
			document.getElementById(thisoptform).elements[i].value = quan;
			}		
		}
		
	/* Set PayPal variables */
	obj1.on0.value = "Buyer Options";
	allAttNoAmp = "BaseItemPrice=$" + itemprice + allAttNoAmp;
	obj1.os0.value = allAttNoAmp;
	allAttributes = "&BaseItemPrice=$" + itemprice + allAttributes;
	obj1.custom.value = allAttributes;
	
	
/*	obj1.on1.value = " ";
	obj1.os1.value = " ";*/

}

function changeImage(direction,maxPhotos) 
	{
	maxPhotos = maxPhotos - 1; //One less than the actual number of images.
	which_image_loaded += direction;
	if (which_image_loaded < 0)
	  	which_image_loaded = maxPhotos; 
	if (which_image_loaded > maxPhotos)
		which_image_loaded = 0;
	if (document.images)
		{
		document.getElementById("galleryTitle").innerText = titles[which_image_loaded];
		document.getElementById("galleryTitle").textContent = titles[which_image_loaded];
		document.galleryPhoto.src = photos[which_image_loaded];
		document.getElementById("galleryCount").innerText = (which_image_loaded + 1) + " of " +
		 (maxPhotos + 1);
		document.getElementById("galleryCount").textContent = (which_image_loaded + 1) + " of " +
		 (maxPhotos + 1);
		 
		 anchorText = 'Javascript:openBigPicWin(\'' +
			bigPhoto[which_image_loaded] +
			'\',\'' +
			photoW[which_image_loaded] +
			'\',\'' +
			photoH[which_image_loaded] +
			'\')'
		document.getElementById("bigPicAnchor").href = anchorText;
/*		document.botFrame.src = "images/galleryframe_05.png";*/
		}
	else
		{
		var imgLink = document.getElementById("galleryPhoto");
/*		imgLink.src = photos[which_image_loaded];*/
		}	
	}
function showThumbNail(index,maxPhotos)
{
	index = index - 1
	maxPhotos = maxPhotos - 1;
	which_image_loaded = index
	document.getElementById("galleryTitle").innerText = titles[index];
		document.getElementById("galleryTitle").textContent = titles[index];
		document.galleryPhoto.src = photos[index];
		document.getElementById("galleryCount").innerText = (index + 1) + " of " +
		 (maxPhotos + 1);
		document.getElementById("galleryCount").textContent = (index + 1) + " of " +
		 (maxPhotos + 1);
	
	anchorText = 'Javascript:openBigPicWin(\'' +
			bigPhoto[index] +
			'\',\'' +
			photoW[index] +
			'\',\'' +
			photoH[index] +
			'\')'
	document.getElementById("bigPicAnchor").href = anchorText;
}
function openGalleryWin() 
	{	
 	var photoLink = document.getElementById("photoid")
 	var URL = 'HOTFShowImage.htm?' + photoLink.src
 	var wdh = 0
 	var hgt = 0
 	var scrollbrs = 'no'
 	var resize = 'no'
	tb = "no"   //toolbars
	mb = "no"   //menubars
	st = "no"   //status

	if(resize != 'yes' && resize != 'no') 
		re =  "yes";
	else
		re = resize;

	if(scrollbrs != 'yes' && scrollbrs != 'no') 
		sb =  "yes";
	else
		sb = scrollbrs;

	var h = Math.round(screen.availHeight * .85);
	var w = Math.round(screen.availWidth * .9);
	var winl = Math.round(screen.availHeight * .05);
	var wint = Math.round(screen.availWidth * .05);
	
	/*Alternate method of setting window size. Set window size to match width/height of photo */
	var holdString = new String(photoLink.src);
	var intPos = holdString.indexOf("W.",0);
	if (intPos > 0)
		{		
		winl = 0; 
		wint = 0;
		var winl = Math.round(screen.availHeight * .2);
		var wint = Math.round(screen.availWidth * .08);
		var w = 726;
		var h = 541;
		}
	else
		{
		winl = 0; 
		wint = 0;
		var winl = Math.round(screen.availHeight * .2);
		var wint = Math.round(screen.availWidth * .08);
		var w = 450;
		var h = 550;
		}	
	
		
	strWindow = "width="+w+",height="+h+",top="+wint+",left="+winl;
	strWindow = strWindow+",toolbar="+tb+",menubar="+mb+",scrollbars="+sb;
	strWindow = strWindow+",status="+st+",resizable="+re;
	
	aWindow = window.open(URL,"newwindow",strWindow);
	/*
	aWindow.location = URL;  //required for early netscape versions
	if (aWindow.opener == null) aWindow.opener = window; // make sure the new window can use 'opener' to access this parent
	aWindow.opener.name = "opener"; // this is so action commands can use opener as a target object
	if (parseInt(navigator.appVersion) >= 4) { aWindow.window.focus(); }
	*/
	}



