var BannerRollover=function(id,options){
	var cont=id;
	var imgA;
	var imgB;
	var close;
	/*options should contain
		transition duration,
		start height,
		end height,
		start image src,
		end image src
	*/

	var opts=options;

	var transition;

	window.addEvent("domready",function(){
		transition=$(cont).effect("height",{duration: opts.duration, transition: Fx.Transitions.linear});

		$(cont).setStyle("height",opts.start+"px");
		$(cont).setStyle("overflow","hidden");
		$(cont).setStyle("position","relative");

		$(cont).appendChild(imgA=$(document.createElement("img")).setProperty("src",opts.imgA).setStyles({position:"absolute",top:"0px",left:"0px"}).setOpacity(1));
		$(cont).appendChild(imgB=$(document.createElement("div")).setStyles({position:"absolute",top:"0px",left:"0px"}).setOpacity(0));
	
		$(cont).addEvent("mouseenter",mouseOverEv);
		
		imgB.innerHTML='\
		<object type="application/x-shockwave-flash"\
		data="'+opts.imgB+'" width="728" height="226">\
		<param name="AllowScriptAccess" value="always" />\
		<param name="movie" value="'+opts.imgB+'" />\
		<param id="fv" name="flashVars" value="val=test" />\
		<param name="base" value="flash" />\
		<param name="wmode" value="opaque" />\
		</object> ';
	});

	var mouseOverEv=function(){
		transition.stop();
		transition.start(opts.end);
		imgA.setOpacity(0);
		imgB.setOpacity(1);
		$(cont).removeEvents("mouseenter");
	}

	var restoreEv=function(){
		imgA.setOpacity(1);
		imgB.setOpacity(0);
		transition.start(opts.start);
		$(cont).addEvent("mouseleave",function(){
			$(cont).addEvent("mouseenter",mouseOverEv);
			$(cont).removeEvents("mouseleave");
		});
	}
	
	this.closeFlash=function(){
		restoreEv();
	}
}

var bannerObj=new BannerRollover("BannerDiv",{
	duration:750,
	start:30,
	end:226,
	imgA:"/images/kawasaki_banner_off.gif",
	imgB:"/images/flash/kawasaki_banner2_v02.swf"
});

function closeFlash(){
	bannerObj.closeFlash();
}