$(document).ready(function(){

$.imgsExt=["jpg","jpeg","bmp","gif","png","tiff"];
$.videoExt=["flv","mov","avi"];
$.imgsExtS=$.imgsExt.join(",");
$.videoExtS=$.videoExt.join(",");
$.cntnrID=$.imageID||0;
$.imageID=$.imageID||0;
$.videoID=$.videoID||0;
$.JW=$.JW||{};
$.flsVideoOptions=$.flsVideoOptions||{};

$(".FlsExtCntnr").each(function(){
var n=$(this);
var s=$('.FlsExtCntnrOut',n);
	s.append("<div class=\"FlsExtCntnrOutVideo\" ></div>");
	s.append("<ul class=\"FlsExtCntnrOutImages\" ></ul>");
var u=$('ul',s);
var vc=$('.FlsExtCntnrOutVideo',s);
$(".FlsExtHDItem", n).each(function(){
	var i=$(this); 
	var a=$('a',i);
	var d=$('p',i);
	var e=a.attr('rel');
	if($.imgsExtS.indexOf(e)>-1){
		var p=$('img',i);
		a.html('');
		a.attr('alt',a.attr('title'));
		a.attr('title',d.html());
		a.removeAttr('height');
		a.removeAttr('width');
		a.append(p);
		a.attr('rel',"prettyPhoto[gal"+$.cntnrID+"]");
		u.append($(document.createElement("li")).append(a));
		$.imageID++;
	}
	if($.videoExtS.indexOf(e)>-1){
		var v='<div class="FlsExtHDItemVideo" id="FlsExtHDItemVideo'+$.videoID+'" >';
		if(a.html().length>0)v+='<div class="FlsExtHDItemVideoCaption" >'+a.html()+'</div>';
		v+='<div class="FlsExtHDItemVideoCaptionEmbeded" id="FlsExtHDItemVideoCaptionEmbeded'+$.videoID+'" ></div>';
		if(d.html().length>0)v+='<div class="FlsExtHDItemVideoDescription" >'+d.html()+'</div>';
		v+='</div>';
		var wd=a.attr('width')||$.flsVideoOptions.wd||640;
		var hg=a.attr('height')||$.flsVideoOptions.hd||480;
		vc.append(v);
		if(e=='flv'){
			swfobject.embedSWF("/res/swf/jw/jw.swf",
				"FlsExtHDItemVideoCaptionEmbeded"+$.videoID,
				wd,
				hg,
				"9.0.0",
				"/res/google/expressInstall.swf", 
				{
					file:a.attr('href'),
					screencolor:"e0e0e0",
					backcolor:$.JW.backcolor||"1191b6",
					lightcolor:$.JW.lightcolor||"ffffff",
					frontcolor:$.JW.frontcolor||"f0f0f0",
					volume:"30",
					skin:"/res/swf/jw/modieus.swf"
				},
				{menu:"false"},
				{id:"FlsExtHDItemVideoCaptionEmbededSWF"+$.videoID,name:"FlsExtHDItemVideoCaptionEmbededSWF"+$.videoID}
			);
		}
		if(e=='avi' || e=='wma'){
			var md='<object codebase="http://www.apple.com/qtactivex/qtplugin.cab" '+
				'classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" '+
				'type="application/x-oleobject" width="'+wd+'" height="'+hg+'" > '+
				'<param name="url" value="'+a.attr('href')+'" > '+
				'<embed src="'+a.attr('href')+'" width="'+wd+'" height="'+hg+'" '+
				'type="application/x-mplayer2" '+
				'pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed> '+
				'</object>';
			$('#FlsExtHDItemVideoCaptionEmbeded'+$.videoID).append(md);
		}		
		if(e=='mov'){
			var md='<object codebase="http://www.apple.com/qtactivex/qtplugin.cab" '+
				'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" '+
				'width="'+wd+'" height="'+hg+'" > '+
				'<param name="src" value="'+a.attr('href')+'" > '+
				'<embed src="'+a.attr('href')+'" width="'+wd+'" height="'+hg+'" '+
				'pluginspage="http://www.apple.com/quicktime/download/" ></embed> '+
				'</object>';
			$('#FlsExtHDItemVideoCaptionEmbeded'+$.videoID).append(md);
		}			
		$.videoID++;
	}
	i.remove();
}); // each .FlsExtHDItem
$('li:first',u).addClass("FlsFirstElement");
$('div:first',vc).addClass("FlsFirstElement");
$('li:last',u).addClass("FlsLastElement");
$('div:last',vc).addClass("FlsLastElement");
$.cntnrID++;
}); // each .FlsExtCntnr

if($.imageID>0){
$("a[rel^='prettyPhoto']").prettyPhoto({
	animationSpeed: 'normal', /* fast/slow/normal */
	padding: 40, /* padding for each side of the picture */
	opacity: 0.35, /* Value betwee 0 and 1 */
	showTitle: true, /* true/false */
	allowresize: true, /* true/false */
	counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
	theme: 'light_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
	hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
	modal: false, /* If set to true, only the close button will close the window */
	changepicturecallback: function(){}, /* Called everytime an item is shown/changed */
	callback: function(){} /* Called when prettyPhoto is closed */
});
} // if

}); // ready

// ЮТФ
