// JavaScript Document © Copyright 1997-2008 Jeff Niebling - Winfield Applications
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.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 MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

var PDFdoc = null;

function GetPDFdoc(url) {
 if (PDFdoc != null && !PDFdoc.closed)
      PDFdoc.close();
   PDFdoc = window.open(url, "PDFdoc", "width=1000,height=800,left=2,top=2,toolbar=no,resizable=yes,scrollbars=auto,menubar=no,directory=no,status=no,location=no");
   PDFdoc.focus();
}

var VIDdoc = null;

function GetVIDdoc(url) {
 if (VIDdoc != null && !VIDdoc.closed)
      VIDdoc.close();
   VIDdoc = window.open(url, "VIDdoc", "width=640,height=610,left=2,top=2,toolbar=no,resizable=yes,scrollbars=yes,menubar=no,directory=no,status=no,location=no");
   VIDdoc.focus();
}

function go_pdf(myfile){
	var mypdf = myfile;
	window.open(mypdf,null,'toolbar=no,margin=0,padding=0,location=no,menubar=no,scrollbars=no,resizable=no,leftmargin=0,topmargin=0,marginwidth=0,marginheight=0,border=0');
}

var winNew = null;

function PicIt(sPicURL) {	//  © PicIt Copyright - Jeff Niebling, Winfield Applications *[TEST - NO CLOSE, AND USES POPUP "2"]
 if (winNew != null && !winNew.closed)
   winNew.close();
 winNew = window.open("popup2.htm?"+sPicURL,"winNew","resizable=0,height=525,width=525,left=5,top=5");
 winNew.focus();
}

var winNew2 = null;

function PicIt2(sPicURL) {	//  © PicIt2 Copyright - Jeff Niebling, Winfield Applications *[TEST - NO CLOSE, AND USES POPUP "2"]
 if (winNew2 != null && !winNew2.closed)
   winNew2.close();
 winNew2 = window.open("popup2.htm?"+sPicURL,"winNew2","resizable=0,height=426,width=575,left=15,top=15");
 winNew2.focus();
}

function PopupPic(sPicURL) {
	window.open( "popup.htm?"+sPicURL, "","resizable=0,height=426,width=570");
}

var PopupNew2 = null;

function PopupPic2(sPicURL) {	//  © PopupPic2 Copyright - Jeff Niebling, Winfield Applications *[uses popup.htm - fade works better than PicIt, also recycles window unlike PopupPic]
	if (PopupNew2 != null && !PopupNew2.closed)
		PopupNew2.close();
	PopupNew2 = window.open( "popup.htm?"+sPicURL, "PopupNew2","resizable=0,status=no,height=426,width=575,left=5,top=5");
	PopupNew2.focus();
}

var newWin = null; 

function popup(strURL, strType, strHeight, strWidth) { 
 if (newWin != null && !newWin.closed) 
   newWin.close(); 
 var strOptions=""; 
 if (strType=="console") 
   strOptions="toolbar=no,resizable=yes,menubar=yes,directory=no,location=no,fullscreen=no,scrollbars=yes,directories=no,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="fixed") 
   strOptions="status,height="+ 
     strHeight+",width="+strWidth; 
 if (strType=="elastic") 
   strOptions="toolbar,menubar,scrollbars,"+ 
     "resizable,location,height="+ 
     strHeight+",width="+strWidth; 
 newWin = window.open(strURL, 'newWin', strOptions); 
 newWin.focus(); 
}

function takeFocusBack() {
	window.focus();
}

function ChangeImages(node, imgpath, imgMain, imgPlusMinusPrefix, imgPlusMinus) {
	bSetMainImage = (imgMain != "")
	if (node.children.length > 0) {
		if (node.children.item(0).tagName == "IMG"){
			if (imgPlusMinus != "No") 
				node.children.item(0).src = imgpath + imgPlusMinusPrefix + imgPlusMinus + ".gif";
			else {	
				if (bSetMainImage) {
					node.children.item(0).src = imgpath + imgMain;
					bSetMainImage = false;
				}
			}
		}
	}	
	if (bSetMainImage && node.children.length > 1) {
		if (node.children.item(0).tagName == "INPUT" && node.children.item(1).tagName == "IMG") {
			node.children.item(1).src = imgpath + imgMain;
			bSetMainImage = false;
		}
	}	
	if (bSetMainImage) {
		nextNode = node.nextSibling;
		if (nextNode.tagName == "INPUT")
			nextNode = nextNode.nextSibling;
		if (nextNode.tagName == "IMG") 
			nextNode.src = imgpath + imgMain;
		else 
		if (nextNode.children.length > 0) {
			pos = 0;
			if (nextNode.children.item(0).tagName == "INPUT" && nextNode.children.length > 1)
				pos = 1;
			if (nextNode.children.item(pos).tagName == "IMG")
				nextNode.children.item(pos).src = imgpath + imgMain;
		}
	}
}

function ExpCol(node, imgpath, imgPlusMinus, imgCollapsed, imgExpanded, nodekey)
{
	// window.focus()
	if (node != null) {
		nextNode = node.nextSibling;
		bFinded = false;
		while (nextNode != null && bFinded == false) {
			if (nextNode.tagName == "DIV")
				bFinded = true;
			else
				nextNode = nextNode.nextSibling;
		}
		if (nextNode != null && bFinded) {
			if (nextNode.style.display == 'none') {
				nextNode.style.display = '';
				ChangeImages(node, imgpath, imgExpanded, 'Minus', imgPlusMinus);
			}
			else
			{
				nextNode.style.display = 'none';
				ChangeImages(node, imgpath, imgCollapsed, 'Plus', imgPlusMinus);
			}
		}
	}
}

function Preload(aPics) {
  var axPics = aPics.split(',')
  var aPre = new Array()
  for(i=0;i<axPics.length;i++) {
    aPre[i] = new Image()
	aPre[i].src = axPics[i]
	}
}
function fade(oSrc,sTgt) {
  var oTgt = new Image()
  oTgt.src = sTgt
  if(document.all) {
    oSrc.style.filter="blendTrans(duration=1.50)"
	oSrc.filters.blendTrans.Apply()
	}
	oSrc.src = oTgt.src
	if (document.all) {
      oSrc.filters.blendTrans.Play()
	}
}
function fadeIn() {
  oDiv.style.filter="blendTrans(duration=1)";
  oDiv.filters.blendTrans.apply();
  oDiv.style.visibility="visible";
  oDiv.filters.blendTrans.play();
}
function low(cur,which){
strength=(which==0)? 1 : 0.8
if (cur.style.MozOpacity)
cur.style.MozOpacity=strength
else if (cur.filters)
cur.filters.alpha.opacity=strength*100
}
function noSpam(sName,sLink) {
	var sDom = 'datafx.net';
	var sEcho = sName.replace(/[^0-9A-Za-z\._]*/g,'')+'@'+sDom;
	var sMail = sEcho;
	if(sLink!=null){ sEcho = sLink; }
	return('<a href=\"mailto:'+sMail+'\" title=\"'+sMail+'\">'+sEcho+'</a>');
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

