
//------image preload------i//
function preImages() { 
  var doc=document; 
  if(doc.images){ 
  	if(!doc.mo_p) doc.mo_p=new Array();
    var i,j=doc.mo_p.length,a=preImages.arguments; 
	for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){
		doc.mo_p[j]=new Image; doc.mo_p[j++].src=a[i];
		}
	}
}

//------swap images functions------//
function swpImgRest() {
  var i,x,a=document.mo_sr; 
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function findObj(n, doc) {
  var p,i,x;  if(!doc) doc=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    doc=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=doc[n])&&doc.all) x=doc.all[n]; 
  for (i=0;!x&&i<doc.forms.length;i++) x=doc.forms[i][n];
  for(i=0;!x&&doc.layers&&i<doc.layers.length;i++) x=findObj(n,doc.layers[i].document);
  if(!x && doc.getElementById) x=doc.getElementById(n); return x;
}

function swpImage() { 
  var i,j=0,x,a=swpImage.arguments; 
  document.mo_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
  if ((x=findObj(a[i]))!=null){document.mo_sr[j++]=x; 
  if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var newWin;

function openWindow1(theURL,w,h){
	if (newWin && newWin.closed == false){
		newWin.close();
	}
	var param = "width=" + w + ",height=" + h + ",top=0,left=0,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no";
	newWin = window.open(theURL,"mapwin",param);
	newWin.focus();
}

function openWindow2(theURL,w,h){
	if (newWin && newWin.closed == false){
		newWin.close();
	}
	var param = "width=" + w + ",height=" + h + ",top=0,left=0,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,directories=no";
	newWin = window.open(theURL,"mapwin",param);
	newWin.focus();
}


