function kdsMouseIn(ElemID) {
	$('#kdsPhotoLink'+ElemID).animate({opacity: '1'});
}
function kdsMouseOut(ElemID) {
	$('#kdsPhotoLink'+ElemID).animate({opacity: '0.8'});
}
function randomPhotoChangeShart() {
	randomPhotoChange();
}
function randomPhotoChange() {
	var ElemID, PhotoCount, r_handler, oldBG, varAddress, PhotoID, XMLResult, IDMass='&kdsPhotoCount=';
	
	PhotoCount = gv('kdsPhotoCount');
	IDMass += PhotoCount;
	for (var i=0; i<PhotoCount; i++)
		IDMass += '&kdsPhotoID'+i+'='+gve('kdsPhotoID'+i);
	ElemID = Math.floor(Math.random()*PhotoCount);
	oldBG = $('#kdsPhoto'+ElemID).attr('src');
	$('#kdsPhotoLink'+ElemID).animate({opacity: '1'});
	$('#kdsPhotoLink'+ElemID).css('background', 'url(\''+oldBG+'\') left top no-repeat');
	$('#kdsPhoto'+ElemID).animate({opacity: '0'});
	
	r_handler = function() {
		XMLResult=document.getElementById('kdsTmpPhoto').innerHTML; 
		//alert(XMLResult);
		
		varAddress = GetXMLValue(XMLResult, "address"); 
		PhotoID = GetXMLValue(XMLResult, "id");
		
	//	if (isIE){
	//		document.getElementById('kdsPhotoLink'+ElemID).href='/?pg=previewphoto&PhotoID='+PhotoID;
	//		document.getElementById('kdsPhoto'+ElemID).src=varAddress;
	//		document.getElementById('kdsPhotoID'+ElemID).value = PhotoID;
	//	} else {
			document.getElementById('kdsPhotoLink'+ElemID).setAttribute('href', '/?pg=previewphoto&PhotoID='+PhotoID);
			document.getElementById('kdsPhoto'+ElemID).setAttribute('src', varAddress);
			document.getElementById('kdsPhotoID'+ElemID).value = PhotoID;
	//	}
		
		//$('#kdsPhoto'+ElemID).show();
		$('#kdsPhoto'+ElemID).animate({opacity: '1'});
		//$('#kdsPhotoLink'+ElemID).css('background', '');
		$('#kdsPhotoLink'+ElemID).animate({opacity: '0.8'});
		setTimeout(randomPhotoChange, 3000);
	};
	Loader('lib/ajax_kaleidoscope.php', 'kdsModuleName=GetPhoto'+IDMass, 'kdsTmpPhoto', r_handler);
}
function kdsShowPhoto() {
	$('#kdsMainPhoto').animate({opacity: "1"});
}