

  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  //@@@@@  showRolloverText
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  function showRolloverText(rolloverText) {
	  
	  // set the rollover text
	  var t = getDiv("rolloverText");
	  
	  t.innerHtml = rolloverText;
	
  }
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  //@@@@@  getTweenStraight
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  function getTweenStraight (from, to, size) {
	  tween = new Array();
	  increment = (to - from)/size;
		  for (i=0; i<size; i++) {
			 tween.push(Math.round(from + (increment*i)));
			 
		  }
	  return tween;
  }
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  //@@@@@  tween with ease out and overshoot
  //@@@@@  based on sine wave shape
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  function getTween (from, to, numSteps, final, reversed) {
	  
	  
	  tween = new Array();
	  
	  // final the part of the sine wave where the end of the tween will be (in degrees)
	  
	  final = final *  (Math.PI/180);
	  
	  change = to - from;
	  scaleFactor = change/Math.sin(final);
	  int = final/numSteps; // the change in degrees per step
	  
		  for (i=0; i<=numSteps; i++) {
			  var thisStep = from+(Math.sin(int*i)*scaleFactor);
			 tween.push(Math.round(thisStep));
			 
		  }
		
	  if(reversed == 1) {
		  tween.reverse();
		  //alert(tween);
	  }
	
		
	  return tween;
  }
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  //@@@@@  crossbrowser getDiv
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    function getDiv (divname) {
	  
	  var elem;
	  
       if ( document.getElementById ) { // this is the way the standards work
         elem = document.getElementById( divname );
       } else if( document.all ) { // this is the way old msie versions work
         elem = document.all[divname];
       } else if( document.layers ) { // this is the way nn4 works
         elem = document.layers[divname];
	   }
	   
	   //alert(divname+elem);

	   return elem;
	  
  }
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  //@@@@@  getElementNum accepts an int and returns 
  //@@@@@  that element from the supplied div
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  function getElementNum (div_to_search, element_num) {
	  
		  var node_list = div_to_search.childNodes;
		  var cur_element_num = -1;
		  // search each node in the list to see if it is an element
		  for(var i = 0; i < node_list.length ;  i++) {
			  // if it is and element increment the element counter
			  if (node_list[i].nodeType == 1) {
				  cur_element_num++;
				  // if this is the element we are looking for return it
				  if (cur_element_num == element_num) {
					  return node_list[i];
				  }
			  }
		  }
		   // if it wasnt found (ie the div does not have that many elements return fals
		  return false;
   
  }
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  //@@@@@  preloads the images from the preloaded ajax pages
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  var img_preload_src_list = new Array();
  var img_preload_list = new Array();
  function preloadAjaxImages (section) {
	  for (var k =0 ; k<sections.s_names.length ; k++) {
		s_name = sections.s_names[k];
		  // figure out how to extract image src strings
		  img_preload_src_list = img_preload_src_list.concat(getImageList(sections[s_name]['html']));
	  }
	  
	  for (var k =0 ; k<img_preload_src_list.length ; k++) {
		  //trace(img_preload_list[k]);
		  var img = new Image();
		  img.src = img_preload_src_list[k];
		  img_preload_list.push(img);
		  
	  }
	  
  }
  
  
  // returns an array with the src string of all the images which are in the html
  // if an image is in the html more than once it is only in the array once
  function getImageList(html_string) {
	      var img_src_list = new Array();
		  var img_divided = html_string.split('<img ');
		  for (i = 1; i<img_divided.length; i++) {
			  str = img_divided[i];
			  var src_att = str.toLowerCase().search('src');
			  var opening_quote1 = str.indexOf("'",src_att);
			  var opening_quote2 = str.indexOf('"',src_att);
			  if (opening_quote1 < opening_quote2 && opening_quote1 != -1) {
				  var oq = opening_quote1;
				  var cq = str.indexOf('"',opening_quote1+1);
			  } else if (opening_quote2 != -1) {
				  var oq = opening_quote2;
				  var cq = str.indexOf('"',opening_quote2+1);
			  } else {
				  var oq = -1;
				  var cq = -1;
			  }
			  
			  if (oq != -1 && cq != -1) {
                 src = str.substring(oq+1,cq);
				 if (!inArray(img_src_list, src)) {
				   img_src_list.push(src);
			     }
			  }
		  }
		  return img_src_list;
  }
  
  
  function inArray(array, value) {
    var in_array = false;
	for (var i=0; i<array.length; i++) {
	  if (array[i] == value) {
		  inarray = true;
		  break;
	  }
	}
	return in_array;
  }
  
  
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  //@@@@@  executes the supplied javascript when the section has preloaded the html
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  var waitingInt = null; // only wait to do one action at a time
  function doWhenSectionLoaded (section, js) {
	  
  	  if (sections[section]['html'] == "") {
	    if (waitingInt != null) {
		  clearInterval(waitingInt); 
		}
		waitingInt = setInterval("dwsl('"+section+"','"+js+"')", 100); // keep checking if loaded
		showLoading();
	  } else {
  	    if (sections[section]['html'] != "") {
  	    
  	        trace("doing "+js);
  	    
  	    
            eval(js);
	    }
	  }

  }
  
  function dwsl (section, js) {
  	if (sections[section]['html'] != "") {
        eval(js);
		hideLoading();
		clearInterval(waitingInt); 
	}
  }
  
  
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  //@@@@@  executes the supplied javascript when the folio object has initialised
  //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  function doWhenFolioLoaded (js) {
  	if (folio_obj != null) {
        eval(js);
	} else {
		setTimeout("doWhenFolioLoaded('"+js+"')", 100); // keep checking if loaded
	}
  }

