/* Copyright, 2007, Aloha Personal Information Management, Dong-Wan Kang*/

function expandCollapse(id){
var aId = 'a_'+ id;	
   if(document.getElementById(id).className == 'hide'){
     document.getElementById(aId).innerHTML="<img src='images/minus.gif' align='left' border='0' width='19' height='19'>Hide details of this event";	        
     document.getElementById(id).className='show';
  } else{
     document.getElementById(id).className='hide';
     document.getElementById(aId).innerHTML="<img src='images/plus.gif' align='left' border='0' width='19' height='19'>Read more about this event";	          
  }
}
function Dollar (val) {  // force to valid dollar amount
	var str,pos,rnd=0;
	  if (val < .995) rnd = 1;  // for old Netscape browsers
	  str = escape (val*1.0 + 0.005001 + rnd);  // float, round, escape
	  pos = str.indexOf (".");
	  if (pos > 0) str = str.substring (rnd, pos + 3);
	  return str;
}
	
function SetShip (obj1) {  // record selected shipping option
	var j,obj,pos,tok,val,txt;
	var ary = new Array ();
	  obj = obj1.shp;          // refer to shipping select
	  pos = obj.selectedIndex; // get selection
	  if (pos == 0) {          // force a selection
		alert ("Please make a shipping selection.");
		return false;
	  }
	  obj1.handling.value = "0";
	  obj1.handling_cart.value = "0";
	  obj1.shipping.value = "0";
	  obj1.shipping2.value = "0";
	  val = obj.options[pos].value;   // selected value
	  txt = obj.options[pos].text;    // the text value
	  ary = val.split (" ");          // break apart
	  for (j=0; j<ary.length; j++) {  // look at all items
	// do 3-character tokens...
		if (ary[j].length < 4) continue;
		tok = ary[j].substring (0,3); // first 3 chars
		val = ary[j].substring (3);   // get data
		if (tok == "hn=")             // value for item handling
		  obj1.handling.value  = val;
		if (tok == "hc=")             // value for handling cart
		  obj1.handling_cart.value  = val;
		if (tok == "s1=")             // value for shipping
		  obj1.shipping.value  = val;
		if (tok == "s2=")             // value for shipping2
		  obj1.shipping2.value = val;
	  }
	  obj1.os0.value = txt;           // stuff the text into options field
}