	var CImages = new Array();
	var yyy=-3000;
	
	isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
	isOpera=isOpera5=window.opera && isDOM //Opera 5+
	isOpera6=isOpera && window.print //Opera 6+
	isOpera7=isOpera && document.readyState //Opera 7+
	isMSIE=document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
	isMSIE5=isDOM && isMSIE //MSIE 5+
	isNetscape4=document.layers //Netscape 4.*
	isMozilla=isDOM && navigator.appName=="Netscape" //Mozilla или Netscape 6.*
	
	var mousex = 0;
	var mousey = 0;
	var	xOffset = -50; 
	var yOffset = 25; 
	
	if(isNetscape4) document.captureEvents(Event.MOUSEMOVE)
	if(isMSIE || isOpera7){
	document.onmousemove=function(){
		//alert ("isMSIE || isOpera7");
		mousex=event.clientX+document.body.scrollLeft
		mousey=event.clientY+document.body.scrollTop
		if ((mousex) < (document.body.clientWidth-200))
			skn.left = mousex + xOffset;
			
		if ((mousey) <	(document.body.clientHeight-100))			
			skn.top = mousey + yyy;
		//alert ("left: "+skn.left+"\ntop"+skn.top+"\nmouseX"+mousex+"\nmouseY"+mousey);
		return true
	}
	}else if(isOpera){
	document.onmousemove=function(){
		//alert ("isOpera");
		mousex=event.clientX
		mousey=event.clientY
		skn.left = mousex + xOffset;
		skn.top = mousey + yyy;
		return true
	}
	}else if(isNetscape4 || isMozilla){
	document.onmousemove=function(e){			
		mousex = e.pageX
		mousey = e.pageY
		if (mousex < window.innerWidth -200)
			skn.left = mousex + xOffset;
		if (mousey < window.innerHeight -150)
			skn.top = mousey + yyy;
		//	alert ("left: "+skn.left+"\ntop"+skn.top);
		return true
	}  
	}					
	
	//debugger; 
	var skn = (isMozilla )?document.getElementById('dek').style:document.all['dek'].style;		
		
	function ImageCell(vCounter, vheight)
		{
			//debugger;
				tDim = 'WIDTH="200" ' + vheight + ' ';
			

			tReturn = "";
			tReturn += '<TABLE BORDER=0>';
			tReturn += '<TR><TD ';
			tReturn += tDim;
			tReturn += 'align="center" valign="bottom">';
			switch (CImages[vCounter].DocType)
			{
				case "Album" :
					//tReturn += '<A HREF="Pa_ART.aspx?E=' + CImages[vCounter].EParam + '" target="AlbumDetail" ';
					tReturn += '<A HREF="FramerT_MAG.aspx?V=CDocT&E=' + CImages[vCounter].EParam + '&DT=ALB" target="AlbumDetail" ';
					break;
				case "Story" :
					//tReturn += '<A HREF="PSto_MAG.aspx?E=' + CImages[vCounter].EParam + '" target="StoryDetail" ';
					tReturn += '<A HREF="FramerT_MAG.aspx?V=CDocT&E=' + CImages[vCounter].EParam + '&DT=DOC" target="StoryDetail" ';
					break;
				default :
					tReturn += '<A HREF="' + DetailPage + '&Pic=' + CImages[vCounter].ItemNumber + '&SubE=' + CImages[vCounter].EParam + '" target=_top ';
					break;
			}
			//if (MacSystem == '')
			if (DisplayPopup == 'True')
				{
				tReturn += ' onmouseout=ProcessImageOut()';
				tReturn += ' onmouseover=ProcessImageIn(' + vCounter + ') ';
				}
			tReturn += '><IMG border=0 name="ThumbNail' + vCounter + '" src="' + CImages[vCounter].FilePath + '" OnError="this.src=\'../images/scannotfound.jpg\';"'
			if (CImages[vCounter].PicWidth > 0) tReturn += ' width="' + CImages[vCounter].PicWidth + '" ';
			if (CImages[vCounter].PicHeight > 0) tReturn += ' height="' + CImages[vCounter].PicHeight + '" ';
			tReturn += '>';
			tReturn += '</A>';				

		
			tReturn += '</TD><TD vAlign="bottom" align="left">';
			var viewIcon = true;
			
			if (viewIcon == true)
			{
				if (AbleToEditAlbum == true) 
				{ 
					tReturn += BuildButton(vCounter, 'Ico_Album_')+'<br>'; 
				}
				tReturn += BuildButton(vCounter, 'Ico_Box_A_Thumb_')+'<br>';
				tReturn += BuildButton(vCounter, 'Ico_Box_B_Thumb_')+'<br>';
				tReturn += BuildButton(vCounter, 'Ico_Cart_Thumb_')+'<br>';
				if (CImages[vCounter].CanEditPic == 1) 
				{ 
					tReturn += BuildButton(vCounter, 'Ico_Edit_Thumb_')+'<br>';
				}
				if (ERestr != '') 
				{ 
					tReturn += BuildButton(vCounter, 'Ico_Restr_Thumb_');
				}
			}
			//if (MacSystem != '')
			if (DisplayPopup == 'False')
			{
				tReturn += '</td>';	
				tReturn += '</tr><tr>';				
				tReturn += '<TD colspan="2" align="left" valign="top">';
				tReturn +=	popupFix(CImages[vCounter].DocYear ,CImages[vCounter].SourceName ,CImages[vCounter].CaptionLong, CImages[vCounter].PrintableTitle,CImages[vCounter].Restrictions,CImages[vCounter].Embargo,CImages[vCounter].HighRes,CImages[vCounter].PictureRestricted);
			}
		
			tReturn += '</TD></TR>';
			tReturn += '</TABLE>';
			return(tReturn);
		}
		
function ProcessImageIn(tPosition)
{popup(CImages[tPosition].DocYear ,CImages[tPosition].SourceName ,CImages[tPosition].CaptionLong, CImages[tPosition].PrintableTitle,CImages[tPosition].Restrictions,CImages[tPosition].Embargo,CImages[tPosition].HighRes,CImages[tPosition].PictureRestricted);}


	

		
function get_mouse(e)
{
alert ("x: "+e.pageX+event.x + document.body.scrollLeft);
var x = (nav)?e.pageX:event.x + document.body.scrollLeft; skn.left = x + xOffset;
var y = (nav)?e.pageY:event.y + document.body.scrollTop; skn.top = y + yyy;
}

function killpopup()
{
	clearTimeout (timer);
	if(!isNetscape4){ yyy=-3000; skn.visibility = "hidden";}
	if (document.getElementById) {
			var d = document.getElementById('dek');
			//var f = document.getElementById(photo_id);
		}
		else if (document.all) {
			var d = document.all['dek'];
			//var f = document.images[photo_id];
		}
		else return;
		//debugger;
		d.innerHTML=""; 

}
	

function showpopup (ImageYear,Source,Caption,Headline,IsNews,Id)
{
		//debugger;
		var content = "<table width='250' border='0' cellspacing='0' cellpadding='5' bgcolor='#CC0000'><tr><td class='ThumbPopupCaption'><b>" + Source +  ", " + ImageYear + "</b></td></tr>";
						
		// Caption
		if (Caption != '' || Headline != '')
		{ 			
			content += "<tr><td class='ThumbPopupCaption'>" + Headline;		
			if (Headline != '' && Caption != '') content += "<br>";			
			textCaption = new String(Caption);
			if (textCaption.length > 120) content += textCaption.slice(0,200) + " ..."; else content += textCaption;			
			content += "</td></tr>";
		}		
		
		if (IsNews != "")
		{ 
			content += "<tr><td class='ThumbPopupWarning'>";
			content += IsNews;
			//if (Restrictions != '') content += "Restriction&nbsp;&nbsp;";
			//if (Embargo == true) content += "Special conditions";
			content += "</td></tr>";
		}
		// HighRes
		if (Id != "")
		{ 
			content += "<tr><td class='ThumbPopupCaption'>";
			content += Id;
			content += "</td></tr>"; 
		}
		content += "</table>";
				
		yyy=yOffset;
				
		//debugger;
		
		
		content = '<span class="main">' + content + '</span>';		
		if (document.getElementById) {
			var d = document.getElementById('dek');
			//var f = document.getElementById(photo_id);
		}
		else if (document.all) {
			var d = document.all['dek'];
			//var f = document.images[photo_id];
		}
		else return;
		//debugger;
		d.innerHTML=content; 
		//alert("HTM: "+d.innerHTML);
		
		if (isMSIE)
		{   d.fireEvent ("onmousemove");			
			//debugger;	
				//this.css.filter = 'blendTrans(duration=0.3)';
				//this.elm.filters.blendTrans.apply();
				//this.css.visibility= 'visible';
				//this.elm.filters.blendTrans.play();
				skn.filter = 'blendTrans(duration=0.3)';
				d.filters.blendTrans.apply();
				skn.visibility="visible";	
				d.filters.blendTrans.play();
				//d.style.visibility="visible";
			
			d.fireEvent ("onmousemove");
		}
		else 
		{	
			skn.visibility="visible";	
			d.style.visibility="visible";
		}
		
}

function ev (origMx, origMy, ImageYear, Source, Caption, Headline, IsNews, Id)
{	
	if (origMx == null && origMy ==null)
	{		
		window.setTimeout("ev("+mousex+","+mousey+","+ImageYear+",'"+Source+"','"+Caption+"','"+Headline+"','"+IsNews+"','"+Id+"');",250);	
	}
	else if (origMx < mousex+10 && origMx > mousex-10 && origMy < mousey+10 && origMy > mousey-10)
	{			
		if (document.getElementById) {
			var d = document.getElementById('dek');
			//var f = document.getElementById(photo_id);
		}
		else if (document.all) {
			var d = document.all['dek'];
			//var f = document.images[photo_id];
		}		
		//alert("HTM: "+d.innerHTML);
		d.fireEvent ("onmousemove");
		showpopup (mousex,mousey,ImageYear,Source,Caption,Headline,IsNews,Id);
	}

}

var timer

function popup(ImageYear,Source,Caption,Headline,IsNews,Id, object)
{	
	if (isMozilla)
	{
		showpopup (ImageYear,Source,Caption,Headline,IsNews,Id);
	}

	if (isMSIE)
		var x = mousex;
		var y = mousey;
		timer= window.setTimeout ('showpopup ('+ImageYear+',"'+Source+'","'+Caption+'","'+Headline+'","'+IsNews+'","'+Id+'");',600);
	//	window.setTimeout("ev("+null+","+null+","+ImageYear+",'"+Source+"','"+Caption+"','"+Headline+"','"+IsNews+"','"+Id+"');",150);	

}

function showFullCaption(content)
{ 	
  Cap.innerHTML=content;		
}
