var menu, splash, startStop, Ajax=false;
var curHot=0, hotInterval, pauseHot;


var arrx = new Array();
var arr = new Array();
arrx[0] = "images/menu.png";
arrx[1] = "images/menu2.png";
arrx[2] = "images/menu3.png";
arrx[3] = "images/menu4.png";
/*arrx[4] = "images/menu5.png";*/
var images = new Array;

for(var k=0; k<arrx.length; k++){
	images[k] = new Image();
	images[k].src = arrx[k];
	images.onload = function(){}	
}

function ajaxRequest(){
	Ajax = false;
	try{
       Ajax = new XMLHttpRequest();
	}catch(ee){
       try{
               Ajax = new ActiveXObject("Msxml.XMLHTTP");        
       }catch(e){
	   		try{
               Ajax = new ActiveXObject("Msxml.XMLHTTP");        
       		}catch(e){
               try{
                       Ajax = new ActiveXObject("Microsoft.XMLHTTP");                
               }catch(E){
			   	Ajax = false;
               }
       		}
	   }
	 }		
}

function hotStop(){
	clearInterval(hotInterval);
}

function hotStart(){
	montaHot();
}

window.addEventListener?window.addEventListener("load",so_init,false):window.attachEvent("onload",so_init);

var d=document, imgs = new Array(), zInterval = null, pause=false, cOpacity=1.00, nOpacity=0;//current=2,
var menu, nIndex, fadeInterval, backCourse=false;

function so_init() {	
	if(!d.getElementById || !d.createElement)return;	
	imgs = d.getElementById("splash").getElementsByTagName("img");
	for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
	imgs[current].style.display = "block";
	imgs[current].xOpacity = .99;
	
	var images = new Array();
	
	
	//setTimeout(so_xfade,5000);
	nIndex = current;
	iniCross();
}

function so_xfade() {
		
	if(!backCourse)
		nIndex = imgs[current+1]?current+1:0;	
		
	cOpacity-=.10; 
	nOpacity+=.10;
	
	imgs[nIndex].style.display = "block";
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;
	
	ImgOpacity(imgs[current]); 
	ImgOpacity(imgs[nIndex]);
	if(cOpacity<=0) {
		imgs[current].style.display = "none";		
		current = nIndex;
		cOpacity = 1.00;
		nOpacity = 0;
		backCourse = false;
		clearInterval(fadeInterval);
		iniCross('');
	} else {
		fadeInterval = setTimeout(so_xfade,2);	
	}	
	
}

function ImgOpacity(IMGobj) {
		if(IMGobj.xOpacity>1.00) {
			IMGobj.xOpacity = 1.00;
			return;
		}
		IMGobj.style.opacity = IMGobj.xOpacity;
		IMGobj.style.MozOpacity = IMGobj.xOpacity;
		IMGobj.style.filter = "alpha(opacity=" + (IMGobj.xOpacity*100) + ")";
}

function Start(){	
	pause = false;	
	iniCross('');
}

function Stop(){
	clearTimeout(zInterval);
	pause = true;
	iniCross('');
}

function iniCross(prev_next){
	if(!pause){
		clearInterval(zInterval);
	 	zInterval =setTimeout("so_xfade()", 3000);
	}
	if(prev_next=='Next'){		
		so_xfade();
	}
	else if(prev_next=='Previous'){																			
				nIndex--;								
				if(nIndex<0){
					nIndex = (imgs.length)-1;
				}
				backCourse = true;
		
			so_xfade();
		
					
		}	
}




