<!-- Copyright: Fusion Advertising & Design (UK) Ltd. 2002 -->
<!-- www.fusion-advertising.co.uk -->
<!-- Author: Mark Rowlands, MB 08/08/2002 -->

function popup(url, name, height, width, scrollbars)
{
	// Scrollbars { 0 = no scroll bars; 1 = Have scrollbars }
	var new_window;
	var centred_x = (screen.width / 2) - (width / 2);
	var centred_y = (screen.height / 2) - (height / 2);

	new_window = window.open(url, name, "directories=no,fullscreen=no,Venue=no,menubar=no,resizable=no,status=no,toolbar=no,height=" + height + ",width=" + width + ",left=" + centred_x + ",screenX=" + centred_x + ",top=" + centred_y + ",screenY=" + centred_y + ",scrollbars=" + scrollbars);
	new_window.focus();
}

function setFocus(id){
var st = document.getElementById(id);
st.focus();
}

<!-- Author: Macromedia Inc, -->

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  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);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function formatNumber( num, decimalPlaces, decimalPoint, thousandsPoint )
{
// Converts a number into a string with the specified formatting
	var strng = "", s1;
	var i = num;
	
	if( decimalPlaces == null )
		decimalPlaces = 2;
		
	if( decimalPoint == null )
		decimalPoint = ".";
		
	if( thousandsPoint == null )
		thousandsPoint = ",";
	
	var decPow = Math.pow( 10, decimalPlaces );
	
	i *= decPow;
	i = Math.abs( Math.round( i ) );

	if( decimalPlaces > 0 )
	{
		strng += decimalPoint;
		s1 = ( i + decPow ).toString();
		i /= decPow;
		strng += s1.substring( s1.length - decimalPlaces, s1.length );
		i = Math.floor( i );
	}
	
	while( Math.floor( i ) >= 1000 )
	{
		s1 = Math.floor( i ).toString();
		strng = thousands_point + s1.substring( s1.length - 3, s1.length ) + strng;
		i /= 1000;
	}
		
	strng = ( num < 0 ? -1 : 1 ) * Math.floor( i ) + strng;
	
	return( strng );
}
//  End -->

function cls_th(th) {
	th.value="";
}

function key_num()	{
	if ((event.keyCode < 48 || event.keyCode > 57))	{
		event.returnValue = false;
		return false;
	}
	else return true;
}

function goToLocation(loc) {
	window.location=loc;
}

function setFocus(field) {
	un = document.getElementById(field);
	un.focus();
}

function dialog(filter, w, h, scroll, winname) {
	var s = scroll == "undefined" ? 0 : scroll;
	var wname = winname == "undefined" ? "" : winname;
	openwindow("index.php?page=" + filter, wname, w, h, s);
}

function dialog_pic(filter, w, h, scroll, winname) {
	var s = scroll == "undefined" ? 0 : scroll;
	var wname = winname == "undefined" ? "" : winname;
	openwindow(filter, wname, w, h, s);
}

function openwindow(url, where, sizeX, sizeY, scrollbar) {
    if (document.all) var xMax = screen.width, yMax = screen.height;
    else
      if (document.layers) var xMax = window.outerWidth, yMax = window.outerHeight;
      else var xMax = 800, yMax=600;
    var xOffset = (xMax - sizeX)/2, yOffset = (yMax - sizeY)/2;
    if (yOffset > 30) yOffset = yOffset - 30;
    else yOffset = 0;
    resolveit = 'width=' + sizeX + ', height=' + sizeY + ', directories=0, hotkeys=0, location=0, menubar=0, resizable=1, screenX='+ xOffset +', screenY=' + yOffset +', scrollbars=' + scrollbar +', status=0, toolbar=0, left=' + xOffset +', top=' + yOffset;
    nWin = window.open(url, where, resolveit);
    nWin.focus();
}
