var opacity_out=0;
var opacity_in=0;
var last_photo="";
var promo1_active=false;
var promo2_active=false;
var active_img="promo1";
function rotate_photo(photo_file){
		if ((last_photo!=photo_file) && (promo1_active==false) && (promo2_active==false)) {
			 last_photo=photo_file;
			 promo1_active=true;
			 promo2_active=true;
			 fade_out(active_img);
			 active_img = (active_img=="promo1" ? "promo2": "promo1");
			 var promo = document.getElementById(active_img);
			 promo.src="images/events/"+photo_file;
			 setTimeout("fade_in('"+active_img+"')",50); 	 
		}
}

function fade_out(active){
		if (opacity_out > 1) {	 
			 									  opacity_out=opacity_out-11;
          					  		var current = document.getElementById(active).style;
        	 							  if (navigator.userAgent.indexOf	("MSIE") != -1) { current.filter = "alpha(opacity=" + opacity_out + ")"; }
                		 			else if (navigator.userAgent.indexOf("Firefox") != -1) { current.opacity = opacity_out/100 ; }
                  	 			else { current.KhtmlOpacity = ( opacity_out / 100 ); }
          								setTimeout("fade_out('"+active+"')",3); 
        		  } else {
        								  if (active=="promo1") promo1_active=false;
        								  if (active=="promo2") promo2_active=false;
													opacity_out=100;
        			} 
    				
}

function fade_in(active){
	 if (opacity_in < 100) { 
       	 								  opacity_in =(opacity_in-1)+12; 
       	 								  var next_img = document.getElementById(active).style;
       	 								  if (navigator.userAgent.indexOf	("MSIE") != -1) { next_img.filter = "alpha(opacity=" + opacity_in + ")"; }
               			 			else if (navigator.userAgent.indexOf("Firefox") != -1) { next_img.opacity = opacity_in/100 ; }
                 		 			else { next_img.KhtmlOpacity = ( opacity_in / 100 ); }	
        									setTimeout("fade_in('"+active+"')",4);
        			    } else {
        									if (active=="promo1") promo1_active=false;
        								  if (active=="promo2") promo2_active=false;
													opacity_in=0;
        			    } 
}
function popupWindow(url) {
width=593;
height=600;
	x = (screen.width-width)/2;
	y = (screen.height-height)/2;
	window.open(url,'popupWindow','scrollbars=yes, width='+width+', height='+height+', left='+x+', top='+y + ', screenX='+x+', screenY='+y);//
}

