function LoadSWFmain(movie, width, height, id) {


	
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="'+id+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+width+'" height="'+height+'">\n');
	document.write('<param name="allowScriptAccess" value="sameDomain">')
	document.write('<param name="movie" value="'+movie+'">\n');
	document.write('<param name="quality" value="high">\n');
	document.write('<param name="menu" value="false">\n');
	document.write('<param name="scale" value="noscale">\n');
	document.write('<param name="salign" value="lt">\n');
	document.write('<param name="wmode" value="transparent">\n');	
	document.write('<param name="bgcolor" value="#ffffff">');
	document.write('<embed src="'+movie+'" width="'+width+'" height="'+height+'"  name="'+id+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false"  scale="noscale"  salign="lt" wmode="transparent"></embed>\n');
	document.write('</object>\n');

	
}


var displayPictureObj;
function displayPicture(pic) {
	displayPictureObj = new displayPicture2(pic);
}

function closePicture() {
	document.getElementById("coveringDiv").style.display = "none";
	document.getElementById("photo").style.display = "none";
	document.getElementById("preloader").style.display = "none";
	document.getElementById("photoObject").src = '';
	
	delete displayPictureObj;
}

function displayPicture2(pic) {

	if (document.body.scrollHeight > document.body.offsetHeight) { 
		H = document.body.scrollHeight; }
	else { 
		H = document.body.offsetHeight; 
	}
	
	var myWidth = 0, myHeight = 0;
	if( typeof(window.innerWidth) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	var photo;
	photo = document.getElementById("photo");
	
	var preloader;
	preloader = document.getElementById("preloader");
	
	document.getElementById("coveringDiv").style.height  = H+"px";
	
	photo.style.height  = myHeight+"px";
	//photo.style.display = "block";
	
	preloader.style.height  = myHeight+"px";
	preloader.style.display = "block";
	
	document.getElementById("photoObject").src = pic;
	document.getElementById("coveringDiv").style.display = "block";
	
	
	
	function setPicPosition() {
	
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	
	photo.style.top = scrOfY+"px";
	preloader.style.top = scrOfY+"px";
	
	setTimeout(setPicPosition, 50)
	
	}
	setPicPosition();
	
	
	
}

function imageLoaded() {
	document.getElementById('photo').style.display='block';
	document.getElementById('preloader').style.display='none';
}
