// JavaScript Document
var commentsBlock = 0
var send2MailBlock = 0

// PHOTO-GALLERY VARIABLES
var photoPrevHover = 0

// SWAP BLOCK VARIABLES
var sbPrevID = 0

// PHOTO-GALLERY FULL SCREEN MODE
var photoGalleryFile = new Array()
var photoGalleryTitle = new Array()
var photoGalleryDesc = new Array()
var photoGalleryCImage = 0

function callCommentsBlock()
{
if(commentsBlock == 0)
{
document.getElementById('comment_block').style.display = 'block'
commentsBlock = 1
}
else
{
document.getElementById('comment_block').style.display = 'none'
commentsBlock = 0
}
}

function callSend2MailBlock()
{
if(send2MailBlock == 0)
{
document.getElementById('send2mail_block').style.display = 'block'
send2MailBlock = 1
}
else
{
document.getElementById('send2mail_block').style.display = 'none'
send2MailBlock = 0
}
}

function callPrintBlock(id)
{
var getPrintUrl = 'print.php?id=' + id
var printHandle = window.open(getPrintUrl, 'Print', 'width=576, height=560, resizable=0')
setTimeout(function(){printHandle.window.close()}, 2000)
}


// PHOTO-GALLERY FUNCTIONS
function photoThumbHover(id)
{
var cThumb = 'photoThumb' + id
var cPrevThumb = 'photoThumb' + photoPrevHover
if(id != photoPrevHover)
{
document.getElementById(cThumb).style.border = '#000000 1px solid'
document.getElementById(cPrevThumb).style.border = '#EEEEEE 1px solid'
photoPrevHover = id
}
}

function fPhotoFullSizeImageFT(id)
{
photoGalleryCImage = id
document.getElementById('dHideContent').style.display = 'block'
document.getElementById('dHideContent').style.height = document.documentElement.scrollHeight + 'px'
document.getElementById('dPhotoFSHandle').style.display = 'block'
document.getElementById('dPhotoFSImageHandle').innerHTML = '<img id=\"photoGalleryFullImage\" style=\"border: #FFFFFF 17px solid; border-bottom: #FFFFFF 5px solid; border-top: #FFFFFF 0px solid;\" src=\"' + photoGalleryFile[photoGalleryCImage] + '\" style=\"border: none;\" />'
window.setTimeout('fPhotoFSTitle()', 300)
}


function fPhotoFullSizeImage()
{
document.getElementById('dHideContent').style.display = 'block'
document.getElementById('dHideContent').style.height = document.documentElement.scrollHeight + 'px'
document.getElementById('dPhotoFSHandle').style.display = 'block'
document.getElementById('dPhotoFSImageHandle').innerHTML = '<img id=\"photoGalleryFullImage\" style=\"border: #FFFFFF 17px solid; border-bottom: #FFFFFF 5px solid;  border-top: #FFFFFF 0px solid;\" src=\"' + photoGalleryFile[photoGalleryCImage] + '\" style=\"border: none;\" />'
window.setTimeout('fPhotoFSTitle()', 300)
}


function fPhotoFSTitle()
{
//var newImg = new Image()
//newImg.src = photoGalleryFile[photoGalleryCImage]
// CLOSE IMAGE
document.getElementById('dPhotoFSClose').style.width = (document.getElementById('photoGalleryFullImage').width + 34) + 'px'
var photoClosePosition = document.getElementById('photoGalleryFullImage').width + 14
document.getElementById('dPhotoFSClose').innerHTML = '<div style=\"display: block; width: ' + photoClosePosition + 'px; color: #FF0000;\" align=\"right\"><img src=\"../images/main_images/photoGalleryClose.jpg\" style=\"cursor: pointer;\" onclick=\"cFullSizeImageClose(); return false;\" /></div>'

document.getElementById('dPhotoFSTitle').style.width = (document.getElementById('photoGalleryFullImage').width + 34) + 'px'
document.getElementById('dPhotoFSTitle').innerHTML = '<a href=\"#\" style=\"font-size: 13px; text-decoration: none; color:#000000;\" onclick=\"setPrevImageFull();\"><b><</b></a><span style=\"padding: 0px 10px 0px 10px;\">' + photoGalleryTitle[photoGalleryCImage] + '</span><a href=\"#\" style=\"font-size: 13px; text-decoration: none; color:#000000;\" onclick=\"setNextImageFull();\"><b>></b></a>'

document.getElementById('dPhotoFSDesc').style.width = (document.getElementById('photoGalleryFullImage').width + 34) + 'px'
document.getElementById('dPhotoFSDesc').innerHTML = '' + photoGalleryDesc[photoGalleryCImage] + ''
}


function setNextImageFull()
{
if(photoGalleryCImage == (photoGalleryFile.length-1)) photoGalleryCImage = 0
else photoGalleryCImage++

photoThumbHover(photoGalleryCImage)
fPhotoFullSizeImage()
}


function setPrevImageFull()
{
if(photoGalleryCImage == 0) photoGalleryCImage = photoGalleryFile.length - 1
else photoGalleryCImage--

photoThumbHover(photoGalleryCImage)
fPhotoFullSizeImage()
}


function cFullSizeImageClose()
{
document.getElementById('dHideContent').style.display = 'none'
document.getElementById('dPhotoFSHandle').style.display = 'none'
}


// MOST READED AND MOST COMMENTED BLOCKS
function cSwapBlock(id)
{
	if(id != sbPrevID)
	{
		
	var sbCurrentDiv = 'idSwapBlock' + id
	document.getElementById(sbCurrentDiv).style.display = 'block'
	var sbPrevDiv = 'idSwapBlock' + sbPrevID
	document.getElementById(sbPrevDiv).style.display = 'none'
	
	var sbCurrentDiv = 'idSwapBlockTitle' + id
	document.getElementById(sbCurrentDiv).style.border = '#ECECEC 1px solid'
	var sbPrevDiv = 'idSwapBlockTitle' + sbPrevID
	document.getElementById(sbPrevDiv).style.border = '#FFFFFF 1px solid'
	
	var sbCurrentDiv = 'idSBHref' + id
	document.getElementById(sbCurrentDiv).style.color = '#222222'
	var sbPrevDiv = 'idSBHref' + sbPrevID
	document.getElementById(sbPrevDiv).style.color = '#666666'
	
	sbPrevID = id
	}
}
