function image_flip(sel,sec){
	var trans = 600;
	if(typeof sec=='undefined') var sec = 3;
	if(typeof window.t=='undefined'){
		window.t=setTimeout('image_flip("'+sel+'",'+sec+')',sec*1000);
		return;
	}
	if($(sel+" img").length!=0 && $(sel+" img").css('display')!='none'){
		$(sel+" img").fadeOut(trans,function(){
			$this = $(this);
			$.ajax({
				url:"resources/php/image_flip.php",
				data:"src="+$(sel+" img").attr('src'),
				async:false,
				success:function(msg){
					//$("#page").prepend(msg);
					//alert($this.attr('src'));
					$this.attr('src',dirname($this.attr('src'))+"/"+msg);
					window.t=setTimeout('image_flip("'+sel+'",'+sec+')',trans);
				}
			});
			
			
			
			
		});
		
		return;
	}
	if($(sel+" img").length!=0 && $(sel+" img").css('display')=='none')
		$(sel+" img").fadeIn(trans);
		window.t=setTimeout('image_flip("'+sel+'",'+sec+')',sec*1000);
		
}
function dirname(path){return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');}
function basename(path) {return path.replace(/\\/g,'/').replace( /.*\//, '' );}

