window.onload = function(){

	var b = document.getElementsByTagName('div');
	
	for(var x in b){
		if(b[x].className) if(b[x].className.indexOf('banner o90')>-1){
						
			if(window.addEventListener){
				b[x].addEventListener('mouseover', function(e) { flip(e) },false); 
			}else{
				b[x].attachEvent ('onmouseover', flip ); }
				
			var lx = b[x].getElementsByTagName('a');
			
			for(var l in lx){
				if(lx[l].href) lx[l].style.display = 'none';
			}
				
		}
		
		if(b[x].className) if(b[x].className.indexOf('pldB')>-1){
		
			if(window.addEventListener){
				b[x].addEventListener('load', function(e) { preload(e) },false); 
			}else{
				b[x].attachEvent ('onload', preload ); }
				
		}
		
	}
	
	if( navigator.appName.indexOf('Micro')>-1 ) increment = 20;
	ni = window.setInterval("next()", 5000);
}

var increment = 5;
var cr = 1;
var ni;
var animate = null;
var opacity = 0;

function next(){
	cr ++;
	if(cr > 3) cr = 1;
	flip(null, document.getElementById('banner' + cr.toString()));		
}

var pA = false;
var pB = false;

function u(e){
	ni = window.setInterval('next()', 4000);
}

function flip(e, o){

		
		sO(document.getElementById('bContainer'), 0);
			
		var b = document.getElementsByTagName('div');
						
		for(var x in b){
			if(b[x].className) if(b[x].className.indexOf('banner o90 o')>-1){
				b[x].className = 'banner o90';
			}
		}
		if(o) 
			var t = o;
		else
			var t = gt(e);
		
    	var b = t.id.replace(/banner/g, '').replace(/ /g,'');
		document.getElementById('bContainer').className = 'b' + b;
		
		t.className = 'banner o90 o' + b;
		cr = parseInt(b);
		opacity = 0;
		f('bContainer',0);	

}

function gt(e){
	var t;
	if (!e) var e = window.event;
	if (e.target)
		t = e.target;
	else if (e.srcElement) 
		t = e.srcElement;
	if (t.nodeType == 3)
		t = t.parentNode;
	return t;	
}



function f(objId,op,f) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
	  sO(obj, opacity);
      opacity += increment;
      if(!animate) animate = window.setInterval("f('"+objId+"',"+opacity+")", 5);
    } else{
    	window.clearInterval(animate);
    	animate = null;
    }
  }
}

function sO(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  obj.style.filter = "alpha(opacity:"+opacity+")";
  obj.style.KHTMLOpacity = opacity/100;
  obj.style.MozOpacity = opacity/100;
  obj.style.opacity = opacity/100;
}
function go(u){
	window.location = '/' + u;
}

var preload = 3;

function preload(){
alert(preload);
	preload --;
	if(preload <= 0){
		alert('uyep');
	}
}
