function writeShockwave(source, xml)
{
	var content = '';
	content += '<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=10,0,0,0" height="100%" width="100%">';
	content += '<param name="src" value="'+source+'" />';
	content += '<param name="swURL" value="'+xml+'" />';
	content += '<param name="swStretchStyle" value="stage" />';
	content += '<param name="swRemote" value="swContextMenu=\'FALSE\'" />';
	content += '<param name="progress" value="false" />';
	content += '<param name="logo" value="false" />';
	content += '<embed type="application/x-director" pluginspage="http://www.macromedia.com/shockwave/download/" src="'+source+'" swurl="'+xml+'" swstretchstyle="stage" swremote="swContextMenu\'FALSE\'" progress="FALSE" logo="FALSE" height="100%" width="100%" />';
	content += '</object>';
	document.write(content);
}

function redirect(url)
{
 if(url!=null)
 {
  window.location = url;
 }
}

function number_format(number,decimals,dec_point,thousands_sep) 
{
 // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
 // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
 var i, j, kw, kd, km;
 if(isNaN(decimals = Math.abs(decimals))){decimals = 2;}
 if(dec_point==undefined){dec_point = ",";}
 if(thousands_sep == undefined ){thousands_sep = ".";}
 i = parseInt(number = (+number || 0).toFixed(decimals)) + "";
 if((j = i.length)>3){j = j % 3;}else{j = 0;}
 km = (j ? i.substr(0, j) + thousands_sep : "");
 kw = i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_sep);
 kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).slice(2) : "");
 return km + kw + kd;
}


function roundNumber(num, dec) 
{
 var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
 return result;
}

function getNode(id)
{
 if(id==null)return null;
 return document.getElementById(id);
}

function showElement(node,display,visibility,display_mode,visibility_mode)
{
 if(display==null)display = true;
 if(visibility==null)visibility = true;
 if(display_mode==null)display_mode = '';
 if(visibility_mode==null)visibility_mode = '';
 
 if(node)
 {
  if(display)
  node.style.display = '';
  if(visibility)
  node.style.visibility = '';
  
  return true;
 }
 else
 {
  return false;
 }
}

function hideElement(node,display,visibility)
{
 if(display==null)display = true;
 if(visibility==null)visibility = true;
 
 if(node)
 {
  if(display)
  node.style.display = 'none';
  if(visibility)
  node.style.visibility = 'hidden';
  return true;
 }
 return false;
}

function isElementVisible(node,display,visibility)
{
 if(display==null)display = true;
 if(visibility==null)visibility = true;

 if(node)
 {
  visible = false;
 
  if(display)
  {
   if(node.style.display == '')
   {
    visible = true;
   }
  }
  
  if(visibility)
  {
   if(node.style.visibility == '')
   {
    visible = true;
   }
  }
  
  return visible;
 }
 
 return true;
}

function getScrollY()
{
 var y = 0;

 if(navigator.appName != "Microsoft Internet Explorer")
 y = pageYOffset;
 else
 y = document.documentElement.scrollTop;
 
 return y;
}

function getNewPoint(x,y)
{
 if(x==null)x=0;
 if(y==null)y=0;

 var point = new Object();
 point.x = x;
 point.y = y;
 
 return point;
}

function getNewRectangle(x,y,width,height)
{
 if(x==null)x=0;
 if(y==null)y=0;
 if(width==null)width=0;
 if(height==null)height=0;

 var rect = new Object();
 
 rect.x = x;
 rect.y = y;
 
 rect.width = width;
 rect.height = height;
 
 rect.update = function()
 {
  this.middle_x = this.width / 2;
  this.middle_y = this.height / 2;
  
  this.left = this.x;
  this.top = this.y;
  this.right = this.x + this.width;
  this.bottom = this.y + this.height;
 
  this.center_x = (this.right - this.left) / 2;
  this.center_y = (this.bottom - this.top) / 2;
 }
 
 rect.update();
 return rect;
}

function getCenterPoint(outer,inner)
{
 if(outer)
 {
  if(inner)
  {  
   var point = getNewPoint();
   point.x = outer.center_x - inner.middle_x;
   point.y = outer.center_y - inner.middle_y;
   
   return point;
  }
 }
 return null;
}

function getPosition(node)
{
 if(node)
 {
  var point = getNewPoint();
  point.x = node.offsetLeft;
  point.y = node.offsetTop;
 
  return point;
 }
 return null;
}

function centerRectangleInRectangle(inner,outer)
{
 if(inner)
 {
  if(outer)
  {
   return getNewPoint((outer.center_x - inner.middle_x),(outer.center_y - inner.middle_y));  
  }
 }
 return null;
}

function centerElementInRectangle(node,rect)
{
 if(node)
 {
  if(rect)
  {   
   var node_rect = getElementRectangle(node);
   
   node.style.left = rect.center_x - (node_rect.middle_x) + 'px';
   node.style.top = rect.center_y - (node_rect.middle_y) + 'px';
   
   return true;
  }
 }
 return false;
}

function centerElementInElement(inner,outer)
{
 if(inner)
 {
  if(outer)
  {   
   var inner_rect = getElementRectangle(inner);
   var outer_rect = getElementRectangle(outer);
   
   inner.style.left = outer_rect.center_x - (inner_rect.middle_x) + 'px';
   inner.style.top = outer_rect.center_y - (inner_rect.middle_y) + 'px';
   
   return true;
  }
 }
 return false;
}

function resizeElement(node,rect)
{
 if(node)
 {
  if(rect)
  {
   node.style.left = rect.x + 'px';
   node.style.top = rect.y + 'px';

   node.style.width = rect.width + 'px';
   node.style.height = rect.height + 'px';
   
   return true;
  }
 }
 return false;
}

function getViewportRectangle()
{
 var rect = getNewRectangle();

 if(document.body)
 {
  rect.width = document.body.clientWidth;
  rect.height = document.body.clientHeight;
 } 
 else if(self.innerWidth)
 {
  rect.width = self.innerWidth;
  rect.height = self.innerHeight;
 }
 else if (document.documentElement && document.documentElement.clientWidth)
 {
  rect.width = document.documentElement.clientWidth;
  rect.height = document.documentElement.clientHeight;
 }
 
 rect.update();
 
 return rect;
}

function getDocumentRectangle()
{
 var rect = getViewportRectangle();
 
 var docHeight = 0;
 var docOffsetHeight = 0;

 if(typeof document.height != 'undefined') 
 {
  docHeight = document.height;
 }
 else if(document.compatMode && document.compatMode != 'BackCompat') 
 {
  docHeight = document.documentElement.scrollHeight;
 }
 else if(document.body && typeof document.body.scrollHeight != 'undefined') 
 {
  docHeight = document.body.scrollHeight;
 }
  
 if(document.documentElement.scrollHeight)
 {
  docOffsetHeight = document.documentElement.scrollHeight;
 }
 else
 {
  docOffsetHeight = document.body.offsetHeight;
 }  
 
 if(docHeight>docOffsetHeight)
 {
  rect.height = docHeight;
 }
 else
 {
  rect.height = docOffsetHeight;
 }
  
 rect.update();
 
 return rect;
}

function getElementRectangle(node)
{
 if(node)
 {
  var rect = getNewRectangle(node.offsetLeft,node.offsetTop,node.offsetWidth,node.offsetHeight);
  rect.update();
   
  return rect;
 }
 return null;
}

function moveNode(node,point)
{
 if(node)
 {
  if(point)
  {
   node.style.left = point.x + 'px';
   node.style.top = point.y + 'px';
   return true;
  }
 }
 return false;
}

