try{document.execCommand('BackgroundImageCache', false, true);}catch(e){}
function shht(id){el1 = document.getElementById(id);el2 = document.getElementById(id+'_hidden');if(el1.style.display==''){el1.style.display='none';el2.style.display='';}else{el1.style.display='';el2.style.display='none';}return false;}
function redirect(url){window.location=url;}
function newwindow(selection,w,h){l=(screen.availWidth-w)/2;t=(screen.availHeight-h)/2;window.open(selection,'_blank','height='+h+',width='+w+',scrollbars=yes,left='+l+',top='+t+',resizable=yes');return false;}
function newwindow2(selection,w,h){l=(screen.availWidth-w)/2;t=(screen.availHeight-h)/2;window.open(selection,'_blank','height='+h+',width='+w+',scrollbars=no,left='+l+',top='+t+',resizable=yes');return false;}
function replyTo(id)
{	if(id==0)
	{		document.getElementById('addComment').appendChild(document.getElementById('commentForm'));
		document.getElementById('commentFormTitle').innerHTML=langAddComment;
	}
	else
	{		document.getElementById('replyTo'+id).appendChild(document.getElementById('commentForm'));
		document.getElementById('commentFormTitle').innerHTML=langReplyFor;
	}	document.getElementById('replyTo').value=id;
}

function galleryShowPhoto(id)
{	var str = '';
	document.getElementById('subGalleryImage').src=sitePath+'images/gallery/'+photos[id]+'.jpg';
	start=0;	for (var i=0;i<photos.length;i++)
	{		if (i == id)
		{			start = i;
			photoCurrent = i;
			break;
		}	}
	if (start > 0) start--;
	if (start > photos.length - 4) start = photos.length - 4;
	photosLength = 4;
	if (photos.length < 4) photosLength = photos.length;
	for (var i=start;i<start+photosLength;i++)
	{		cls = i == id ? 4 : 3;		str += '<div class="b'+cls+'"><div class="b'+cls+'t"><div class="b'+cls+'r"><div class="b'+cls+'b"><div class="b'+cls+'l"><div class="b'+cls+'tl"><div class="b'+cls+'tr"><div class="b'+cls+'bl"><div class="b'+cls+'br"><div class="b'+cls+'text">';
		if (cls == 3) str += '<a href="#" onclick="galleryShowPhoto('+i+');return false;">';
		str += '<img src="' + sitePath + 'images/gallery/previews/' + photos[i] + '.jpg" border="0" alt="" />';
		if (cls == 3) str += '</a>';
		str += '</div></div></div></div></div></div></div></div></div></div>';
		document.getElementById('subGalleryContainer').innerHTML = str;
	}
	document.getElementById('arrowPrev').style['display'] = id == 0 ? 'none' : 'block';
	document.getElementById('arrowNext').style['display'] = id == photos.length-1 ? 'none' : 'block';
}


function galleryShowPhotoWidth(id)
{
	var str = '';
	document.getElementById('subGalleryImage').src=sitePath+'images/gallery/'+photos[id]+'.jpg';
	start=0;
	for (var i=0;i<photos.length;i++)
	{
		if (i == id)
		{
			start = i;
			photoCurrent = i;
			break;
		}
	}
	if (start > 0) start--;
	if (start > photos.length - 7) start = photos.length - 7;
	photosLength = 7;
	if (photos.length < 7) photosLength = photos.length;
	for (var i=start;i<start+photosLength;i++)
	{
		cls = i == id ? 4 : 3;
		str += '<div class="b'+cls+'"><div class="b'+cls+'t"><div class="b'+cls+'r"><div class="b'+cls+'b"><div class="b'+cls+'l"><div class="b'+cls+'tl"><div class="b'+cls+'tr"><div class="b'+cls+'bl"><div class="b'+cls+'br"><div class="b'+cls+'text">';
		if (cls == 3) str += '<a href="#" onclick="galleryShowPhotoWidth('+i+');return false;">';
		str += '<img src="' + sitePath + 'images/gallery/previews/' + photos[i] + '.jpg" border="0" alt="" />';
		if (cls == 3) str += '</a>';
		str += '</div></div></div></div></div></div></div></div></div></div>';
		document.getElementById('subGalleryContainer').innerHTML = str;
	}
	document.getElementById('arrowPrev').style['display'] = id == 0 ? 'none' : 'block';
	document.getElementById('arrowNext').style['display'] = id == photos.length-1 ? 'none' : 'block';
}
