/* default scripts for all pages */
	
	// set img src to filename
	function set_image(id, filename) {
      if (document.images[id])
         document.images[id].src = filename;
   }
   
	// find object by id in a frame
	// n = id , (optional) d = frame document object
   function find_object(n, d) {
		var p,i,x;
		if(!d) d=document;
		if ( (p=n.indexOf("?")) > 0 && parent.frames.length) {
			d = parent.frames[n.substring(p+1)].document;
			n = n.substring(0,p);
		}
		
		// find n in .all
		if (!(x=d[n]) && d.all ) 
	  		x=d.all[n];
	  	
	  	// find n in forms
	  	for (i=0; !x && i<d.forms.length;i++)
	  		x=d.forms[i][n];
	  	
	  	// find n in layers
	  	for(i=0; !x && d.layers && i<d.layers.length ;i++)
	  		x=find_object(n,d.layers[i].document);
	  
	   // find n by getElementById
	  	if(!x && document.getElementById)
	  		x=document.getElementById(n);
	  	
	  	return x;
	}
	
	// Calculate the left position of the element, relative to the body.
	function GetElementLeft(element) {
	
		var left = 0; 
		while (element) {
			left	  += element.offsetLeft;
			element	= element.offsetParent;
		}
		return left;
	}
	
	
	// Calculate the top position of the element, relative to the body.
	function GetElementTop(element) {
	
		var top = 0; 
		while (element) {
			top	  += element.offsetTop;
			element	= element.offsetParent;
		}
		return top;	
	}

   // dumpv in javascript
   function dumpv( object ) {
      var i;
      var s='';
      for ( i in object ) {
         s += i + ": " + object[i] + "\n";
      }
      alert(s);
   }
   
   // open a simple popup window
   function openPopup( href ) {
      window.open(href,'','statusbar=no,width=600,height=400,menubar=no,toolbar=no,scrollbars=yes');
      return false;
   }