function handleError() {
	return true;
}

//show a larger version of an image
function showLarger(theID, theImage, theObj) {
	if (document.images) {
		document[theID].src = theImage;
		if (theObj.width > 600) document[theID].width = 600
		  else document[theID].width = theObj.width;

	}
}


//show the next photo in the array
function showPhoto3() {
	showArrayLargePhotoandText(3 , 'photo500','text500','','');
}

//show the next photo in the array
function showNextPhoto(thisNum) {
	//alert ("get next from " + thisNum);
	if (thisNum < (Photos2.length-1))
	{
		var newNum = thisNum + 1;
		currPos = newNum;
		showArrayLargePhotoandText(newNum , 'photo500','text500','','');
	}
}

//show the previous photo in the array
function showPrevPhoto(thisNum) {
	if (thisNum > 1 )
	{
		//alert ("get prev from " + thisNum);
		var newNum = thisNum - 1;
		currPos = newNum;
		showArrayLargePhotoandText(newNum , 'photo500','text500','','');
	}
}


//show a larger version of an image
function showArrayLargePhotoandText(thisPos, photoID, textID, titleID, priceID) {
	//alert ("starting showArray for " + thisPos + ", " + photoID + ", " + textID);
	//alert ("src = " + Captions[thisPos]);

	//thisPhoto = Photos[thisPos];
	//alert ("photo src = " + thisPhoto);
	//alert ("currPos = " + currPos);
	if (document.images) {
		//alert ("change photo for " + thisPos);
		var tph = document.getElementById(photoID);
		//alert ("found old photo" );
		tph.setAttribute('src', Photos2[thisPos]); 
		//alert ("reset the src value");
		/*
		if (Photos[thisPos].width > 600) 
		   {document[photoID].width = 600}
		 else 
		    {document[photoID].width = Photos[thisPos].width}
		    */
		/*
		if (Photos2[thisPos].width > 600) 
		   {document[photoID].width = 600}
		 else 
		    {document[photoID].width = Photos2[thisPos].width}
		 */   
	  }
	currPos = thisPos;
	//alert ("new currPos = " + currPos);
	var ta = document.getElementById(textID).firstChild;
	ta.data = "[" + thisPos + " of " + Photos2.length + "] " + Captions[thisPos];
    var ti = document.getElementById(titleID).firstChild;
	ti.data = Titles[thisPos];
    var tp = document.getElementById(priceID).firstChild;
	tp.data = Prices[thisPos];
	
}



//get values instead of keys values : 
	function getVals(o) {
	   var accumulator = [];    
	   for (var propertyName in o) 
	    {
	          arr.push(o[propertyName]);  
    	}    
    return accumulator;
    }
   
   
//show a larger version of an image and text with embedded HTML
function showLargePhotoandHTMLText(theID, theImage, theObj, textID, theText) {
	if (document.images) {
		document[theID].src = theImage;
		if (theObj.width > 600) document[theID].width = 600
		  else document[theID].width = theObj.width; 
	var ta = document.getElementById(textID);
	ta.innerHTML = theText;
	document.getElementById("hiddenarea").style.visibility = "visible";

	}
	
}

//show a medium version of an image and text with embedded HTML
function showMedPhotoandHTMLText(theID, theImage, theObj, textID, theText) {
	if (document.images) {
		document[theID].src = theImage;
		if (theObj.width > 500) document[theID].width = 500
		  else document[theID].width = theObj.width; 
	var ta = document.getElementById(textID);
	ta.innerHTML = theText;
	document.getElementById("hiddenarea").style.visibility = "visible";

	}
	
}

//ask user to confirm their age
function checkAge(yr, mo, da)  {
yrvalue = yr.options[yr.selectedIndex].text;
movalue = mo.options[mo.selectedIndex].text;
davalue = da.options[da.selectedIndex].text;
targetyear = today.year.value - 21;
alert ("targetyear = " + targetyear);
if (yrvalue > "1986")
   {alert ("you are not over 21.  Sorry");
    return false;
    }
 else  {
     alert ("values for date passed is:" + yrvalue +  ", " + movalue + ", " + davalue);
     var newurl = "http://nancynorland.com/drv/ourwines.html";
     //alert ("resetting location to " + newurl);
     window.location.href="http://nancynorland.com/drv/ourwines.html";
     return true;
     }
}


function validatesignup() {
//required fields = username,email,phone
var errlist = "";
if (mainform.username.value=='') errlist = errlist + "name, ";
if (mainform.email.value=='') errlist = errlist + "email, ";
if (mainform.phone.value=='') errlist = errlist + "phone, ";
if (errlist != "") {
alert('The following fields are required: ' + errlist + '. Please fill them and submit this form again.');
event.returnValue=false;
return false;
}
return true
}

function openNewWindow(filename, high, wide)
{
  winref = window.open(filename, "newwin1", "fullscreen=no,toolbar=yes,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width="+wide+",height="+high+",left=50,top=50");
  winref.focus();
}

function openNewWindow2(filename, high, wide)
{
  winref = window.open(filename, "newwin1", "fullscreen=no,toolbar=yes,status=no,menubar=no,scrollbars=yes,resizable=yes,directories=no,location=no,width="+wide+",height="+high+",left=50,top=50");
  winref.focus();
  return false;
}

