var imgLightTimer;
var imgLightMove;

function imgLight()
{
	imgLightMove = arguments[0];
	imgLightStp = false;
	getOpacityProperty();
	window.clearInterval(imgLightTimer);
	imgLightTimer = window.setInterval('imgLightStep()',10);
}

var climona = 100;
var tomclain = 100;
function imgLightStep(){
	
	if(imgLightMove=='+'){climona=climona+6; tomclain=tomclain-6;}
	else{climona=climona-6; tomclain=tomclain+6;}	
	
	if((climona<=10)||(tomclain<=10)){window.clearInterval(imgLightTimer)}
	else{
		if(imgLightStp&&(climona==100)){imgLightShow();window.clearInterval(imgLightTimer)}
		else{imgLightShow()}
		}
}

function imgLightShow(){
	
	if(climona>100){
		a = climona-100; imgLightshowElement('climona_h',a)
	}
	if(climona<=100){
		imgLightshowElement('climona',climona)
	}
	if(tomclain>100){
		b = tomclain-100; imgLightshowElement('tomclain_h',b)
	}
	if(tomclain<=100){
		imgLightshowElement('tomclain',tomclain)
	}
}

function imgLightshowElement(){
	
	if(opacityProp=='filter'){document.getElementById(arguments[0]).style.filter = 'alpha(opacity='+arguments[1]+')'}
	else{document.getElementById(arguments[0]).style[opacityProp] = arguments[1]/100;}
}

var imgLightStp = false;	
function imgLightStop()
{
	if(climona<=100){imgLightMove='+'}
	else{imgLightMove='-'}
	imgLightStp = true;
	window.clearInterval(imgLightTimer);
	imgLightTimer = window.setInterval('imgLightStep()',10);
}

var opacityProp = 'filter';
function getOpacityProperty()
{
  if (typeof document.body.style.opacity == 'string')
    opacityProp = 'opacity';
  else if (typeof document.body.style.MozOpacity == 'string')
    opacityProp = 'MozOpacity';
  else if (typeof document.body.style.KhtmlOpacity == 'string')
    opacityProp =  'KhtmlOpacity';
}