function viewItem ( cid )
	{
	document.formViewItem.itemid.value = cid ;
	document.formViewItem.submit() ;

	return true ;
	}

function contextReponse( docResponse )
	{
	tipHeading = document.getElementById ( "div-menu-right-column-heading" ) ;
	tipBody = document.getElementById ( "popup1" ) ;

	retrievedHeading = docResponse.getElementById ( "div_context_heading" ) ;
	retrievedDesc = docResponse.getElementById ( "div_context_response" ) ;

	/*
	don't use heading for popup tip
	if ( retrievedHeading )
		{
		tipHeading.innerHTML = retrievedHeading.innerHTML ;
		}
	*/
	if ( tipBody )
		{
		tipBody.innerHTML = retrievedDesc.innerHTML ;
		}
	if ( objPopUp )
		{
		objPopUp.style.visibility = 'visible';
		}
	}

function onActionAmazonSearch(formCalling)
	{						
	document.theAmazonSearchForm.action	="http://www.amazon.com/gp/search?ie=UTF8&keywords=" + document.theAmazonSearchForm.textAmazonBookSearch.value + "&tag=germposthist-20&index=books&linkCode=ur2&camp=1789&creative=9325" ;
	document.theAmazonSearchForm.target ="_AmazonWindow" ;
	document.theAmazonSearchForm.submit() ;
	}

function displayCartTotals( docResponse )
	{
	cartTotal = document.getElementById ( "cart_running_total_div" ) ;

	retrievedTotal = docResponse.getElementById ( "cart_running_total_div" ) ;

	if ( cartTotal && retrievedTotal )
		{
		cartTotal.innerHTML = retrievedTotal.innerHTML ;
		}
	}

function EvalSound(soundobj) {
  var thissound= eval("document."+soundobj);
  thissound.Play();
}

/*
on item mouseover
*/
function onItemMO( cid )
	{
	itemform = document.getElementById ( "viewitem-form" ) ;
	document.theContextForm.cid.value = cid ;
	document.theContextForm.caller.value = "searchviewpage.php" ;

	var URL = "/php/itemcontext.php?cid=" + cid +"&" + "caller=searchviewpage.php&" ;

	callToServer( URL ) ;
	}


var objPopUp = null;

function popUp(cid) 
	{
	onItemMO( cid ) ;
	sobjid = 'ttl' + cid ;
	// alert( 'event id = ' + sobjid ) ;
	objPopTrig = document.getElementById(sobjid);
	objPopUp = document.getElementById( "popup1" );
	xypos = findPos(objPopTrig)  ;

	xPos = xypos[0]+140;
	yPos = xypos[1]+10;

	objPopUp.style.left = xPos + 'px' ;
	objPopUp.style.top = yPos + 'px' ;
	}

function popHide() {
	objPopUp.style.visibility = 'hidden';
	objPopUp = null;
}


function findPos(obj) 
	{
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
	}

function buildQueryString(theFormName) {
  theForm = document.forms[theFormName];
  var qs = ''
  for (e=0;e<theForm.elements.length;e++) {
    if (theForm.elements[e].name!='') {
      qs+=(qs=='')?'?':'&'
      qs+=theForm.elements[e].name+'='
	    +escape(theForm.elements[e].value)
      }
    }
  return qs
}

