var cPic = 0;
var tDuration = 400;
var myFx1,myFx2;
var active = false;

function showMV(id, name, x, y) {
	var so = new SWFObject('../flv/player.swf','mpl',x,y,'9');
	so.addParam('allowscriptaccess','always');
	so.addParam('allowfullscreen','true');
	if (name == "cphcx1_mv")
		so.addParam('flashvars','&file=http://cubic.kusphoto.com/cphcx1/cphcx1_mv_cut1_large.f4v&controlbar=none&autostart=true&repeat=list&bufferlength=30&displayclick=play&stretching=none');
	else
		so.addParam('flashvars','&file=http://cubic.kusphoto.com/cphcx2/cphcx2_' + name +'.f4v&controlbar=none&autostart=true&repeat=list&bufferlength=30&displayclick=play&stretching=none');
	so.write(id);
}

function hideMV() {
	$('player').innerHTML = "";
}

function show(tDiv, vDiv){
	myFx1 = new Fx.Tween($(tDiv), {duration: tDuration});
	myFx2 = new Fx.Tween($(vDiv), {duration: tDuration});
	myFx1.start('opacity', '1', '0');
	setTimeout("myFx2.start('opacity', '0', '1');active=false;", tDuration - 100);
}

function changePic(nPic) {
	if(active)
		return;
	if(nPic == cPic)
		return;
	active = true;
	show('ovp' + cPic, 'ovp' + nPic);
	if(cPic != 0)$("ov" + cPic).className = "ov_uns";
	$("ov" + nPic).className = "ov_sel";
	if(nPic == 6)
		showMV("player","cphcx1_mv",504,303);
	if(cPic == 6)
		hideMV("player");
	cPic = nPic;
}