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_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_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.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 LinkWindow(Link) {
  if (window.event) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
	var width, height;
	try {
		width = Math.ceil(screen.width/2);
		height = Math.ceil(screen.height*0.6);
	}
	catch (error) {
		width = 600;
		height = 400;
	}
  if (width < 600) { width = 600; }
  if (height < 400) { height = 400; }
	var left, top;
	try {
		left = Math.ceil(screen.width/4);
		top = Math.ceil(screen.height*0.1);
	}
	catch (error) {
		left = 100;
		top = 100;
	}
  if (typeof(oTarget) != "undefined") {
    oTarget.close();
  }
  var time = (new Date()).getTime();
  oTarget = window.open(Link, "Additional" + time, "height="+height+",width="+width+",scrollbars=1,left="+left+",top="+top);
  oTarget.focus();
  return false;
};

function OpenWindow(Link) {
  if (window.event) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
	var width, height;
	try {
		width = Math.ceil(screen.width/1.3);
		height = Math.ceil(screen.height - 100);
	}
	catch (error) {
		width = 600;
		height = 400;
	}
  if (width < 600) { width = 600; }
  if (height < 400) { height = 400; }
	var left, top;
	try {
		left = Math.ceil(screen.width/6);
		top = Math.ceil(screen.height*0.01);
	}
	catch (error) {
		left = 100;
		top = 100;
	}
  if (typeof(oTarget) != "undefined") {
    oTarget.close();
  }
  var time = (new Date()).getTime();
  oTarget = window.open(Link, "Additional1" + time, "height="+height+",width="+width+",scrollbars=1,left="+left+",top="+top);
  oTarget.focus();
  return false;
};

function fixFlash()
{
/*	var objects = document.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++)
	{
		objects[i].outerHTML = objects[i].outerHTML;
	}*/
//	FixDivHeight();
}

function FixDivHeight()
{

  var width = document.getElementById("scrollDiv").offsetWidth-10; // right padding in FF = 10
  var offset = 230;
  var height = document.body.offsetHeight - offset;
  if (height < 500) {
    height = 500;
  }
  var margin = parseInt(document.getElementById("scrollDiv").parentNode.style.paddingLeft);
  var offsetWidth = 360 + margin;
  var width = document.body.offsetWidth - offsetWidth;
  if (width < 500) {
    width = 500;
  }
/*
  document.getElementById("scrollDiv").style.height = height+"px";
  document.getElementById("scrollDiv").parentNode.style.height = 25+document.getElementById("scrollDiv").offsetHeight+"px";
  document.getElementById("scrollDiv").style.position = "absolute";
  document.getElementById("scrollDiv").style.width = width+"px";
 */
  window.onresize = function()
  {
	  var offset = 230;
	  var height = document.body.offsetHeight - offset;
	  if (height < 500) {
	    height = 500;
	  }
  var margin = parseInt(document.getElementById("scrollDiv").parentNode.style.paddingLeft);
  var offsetWidth = 360 + margin;
  var width = document.body.offsetWidth - offsetWidth;
  if (width < 500) {
    width = 500;
  }
/*
	  document.getElementById("scrollDiv").style.height = height+"px";
	  document.getElementById("scrollDiv").parentNode.style.height = 25+document.getElementById("scrollDiv").offsetHeight+"px";
	  document.getElementById("scrollDiv").style.width = width+"px";*/
  }

}



function GetAbsolutePos(el)
{
	var SL = 0, ST = 0;
	var is_div = /^div$/i.test(el.tagName);
	if (is_div && el.scrollLeft)
		SL = el.scrollLeft;
	if (is_div && el.scrollTop)
		ST = el.scrollTop;
	var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
	if (el.offsetParent)
	{
		var tmp = GetAbsolutePos(el.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}
	return r;
}

function LiveWindow(link, name)
{
	if (! window.focus)
	{
		return true;
	}
	var href;
	if (typeof(mylink) == 'string')
	{
		href = link;
	}
	else
	{
		href = link.href;
	}
	window.open(href, name, 'width=480,height=550,scrollbars=yes');
	return false;
}

function ImageOver1(image)
{
	var needSrc = image.src.replace(/_mo/, "");
	needSrc = needSrc.replace(/(\.jpg)/, "_mo$1");
	if (image.src != needSrc)
		image.src = needSrc;
}

function ImageOut1(image)
{
	var needSrc = image.src.replace(/_mo/, "");
	if (image.src != needSrc)
		image.src = needSrc;
}

