

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v;}
}


// SWAP IMAGE FUNCTION for MinInfo
// (C) 2005 Panic, Inc. / Cabel Sasser
//
// Cross-fade between the two images, and swap out the thumbnail with the highlighted thumbnail

function swapImage(divID, imageID, imageToSwap) {

  globalDivID = divID;
  globalImageID = imageID;

  if (document.getElementById(imageID).src.indexOf(eval(imageToSwap+".src")) == -1) {

  	// Set the background image to the currently displaying image
        // This is now done on HTML render and when fade is complete
  	// document.getElementById(divID).style.backgroundImage = "url(" + document.getElementById(imageID).src + ")";
  
  	// Set the top image to invisible
  	setOpacity(0, imageID);

  	// Set the top image to the target image
  	document.getElementById(imageID).src = eval(imageToSwap+".src");
    
  	// Slowly fade in the top image back to visible
  	fadeElementSetup(imageID, 0, 100, 10);

  } else {

	 // alert("Already Set");

  }
}

// FADE ITEM function
// (C) 2005 Panic, Inc.
//
// Ex: href="javascript:fadeElementSetup('testimg',100,0,10)"
// Because we can't accruately get the opacity of an item (it's always zero),
// we must force a start and an end (it can't be computed on the fly).
// So, call this as a normal function.
//
// Pass opacity values from 1 - 100.

function fadeElementSetup(theID, fdStart, fdEnd, fdSteps) {
  fadeSteps = fdSteps;
  fadeCurrent = 0;
  fadeAmount = (fdStart - fdEnd) / fadeSteps;
  fadeTimer = setInterval("fadeElement('"+theID+"')", 50);
}

function fadeElementSetup2(fadeID, fdStart, fdEnd, fdSteps, hideID) {
	MM_showHideLayers(fadeID,'','show');
	setOpacity(0, fadeID);
	nextZ ++;
	document.getElementById(fadeID).style.zIndex = nextZ;
  fadeSteps = fdSteps;
  fadeCurrent = 0;
  fadeAmount = (fdStart - fdEnd) / fadeSteps;
  fadeTimer = setInterval("fadeElement2('"+fadeID+"','"+hideID+"')", 50);
}

function fadeElement(theID) {
  fadeCurrent++;
  // Set the opacity depending on if we're adding or subtracting (pos or neg)
  if (fadeAmount < 0) {
    setOpacity(Math.abs(fadeCurrent * fadeAmount), theID);
  } else {
    setOpacity(100 - (fadeCurrent * fadeAmount), theID);
  }
  if (fadeCurrent == fadeSteps) {
    // We're done, so clear
    clearInterval(fadeTimer);

    // Here's "mininfo" specific code, that sets the background to be prepared for the next fade
    // Set the background image to the currently displaying image
    document.getElementById(globalDivID).style.backgroundImage = "url(" + document.getElementById(globalImageID).src + ")";

  }
}

function fadeElement2(fadeID, hideID) {
  fadeCurrent++;
  // Set the opacity depending on if we're adding or subtracting (pos or neg)
  if (fadeAmount < 0) {
    setOpacity(Math.abs(fadeCurrent * fadeAmount), fadeID);
    setOpacity(100 - Math.abs(fadeCurrent * fadeAmount), hideID);
  } else {
    setOpacity(Math.abs(fadeCurrent * fadeAmount), hideID);
    setOpacity(100 - (fadeCurrent * fadeAmount), fadeID);
  }
  if (fadeCurrent == fadeSteps) {
    // We're done, so clear
//   	alert(fadeID+"  "+hideID);
    clearInterval(fadeTimer);
//    MM_showHideLayers(hideID,'','hide');
  }
}

function setOpacity(opacity, theID) { 

  var object = document.getElementById(theID).style;
  // If it's 100, set it to 99 for Firefox.

  if (navigator.userAgent.indexOf("Firefox") != -1) {
    if (opacity == 100) { opacity = 99.999; } // This is majorly retarded
  }

  // Multi-browser opacity setting

  object.filter = "alpha(opacity=" + opacity + ")"; // IE/Win
  object.KhtmlOpacity = (opacity / 100);            // Safari 1.1 or lower, Konqueror
  object.MozOpacity = (opacity / 100);              // Older Mozilla+Firefox
  object.opacity = (opacity / 100);                 // Safari 1.2, Firefox+Mozilla
}

// Cycle through images //(c)Peter Pedaci

function fadeIn(num) {
	if (num < 0) {
		for (i=0;i<=layerNum;i++) {
		  if (i < 10) {layer = "txt0"+i;}
			else {layer = "txt"+i;}
			setOpacity(0,layer);
			MM_showHideLayers(layer,'','hide');
		}
	}	else {
		if (num != 0) {
			MM_showHideLayers('lang','','hide');
		}
		for (i=0;i<=layerNum;i++) {
		  if (i < 10) {layer = "txt0"+i;}
			else {layer = "txt"+i;}
			if (i != num) {
				setOpacity(0,layer);
				MM_showHideLayers(layer,'','hide');
			}
		}
		if (num < 10) {layer = "txt0"+num;}
		else {layer = "txt"+num;}
		MM_showHideLayers(layer,'','show');
		txtin = setTimeout("fadeElementSetup('"+layer+"',0,100,20)", 800);
	}
}

function slideshow(){
   img = "image"+imgact;
   swapImage('mainDiv', 'blendDiv', img);
   if (imgact < noi) {imgact++;}
   else {imgact = 1;}
}

function slideshow2(){
   layerFade = "Div"+imgact;
   layerHide = (imgact != 1) ? "Div"+(imgact-1) : "Div"+noi;
   fadeElementSetup2(layerFade,0,100,20,layerHide);
   imgact = (imgact < noi) ? imgact+1 : 1;
}

function startShow() {
   show = setInterval(slideshow, 2500);
}

function startShowText() {
   show = setInterval(slideshow2, 2500);
}

