/*
showPhoto(document.getElementById('photo1'));

var rTimer;
var sds ;
/* window.captureEvents(Event.CLICK);
var polos=[];
function GetTickCount(){
	sds = new Date();
		return sds.getMinutes()*60000+sds.getSeconds()*1000+sds.getMilliseconds();
}

var tick=GetTickCount();
for(var i=1;i<10;i++){
	polos[i]=new Object();
	polos[i].x1=0;
	polos[i].x2=0;
	polos[i].old=tick;
}

TimeTick();

function go(index) {
     polos[index].x2=224;
     polos[index].old=GetTickCount();
}

function stop(index) {
     polos[index].x2=0;
     polos[index].x1=224;
     polos[index].old=GetTickCount();
}

function TimeTick()
{
     current=GetTickCount();
     var i;
     for(i=1;i<9;i++){
          polos[i].x1=polos[i].x1+(polos[i].x2-polos[i].x1)*(current-polos[i].old)/10000;
          document.getElementById('fly'+i).style.width=polos[i].x1+"px";
     }
      if(rTimer)
     {
          clearTimeout(rTimer);
     }
     rTimer = setTimeout('TimeTick()', 10);
}

//Скрипты галереи
function getAlbum(id,obj){
	if (obj.getAttribute('class')!='notdecor' && obj.getAttribute('className')!='notdecor'){
		jsquery(obj.name,0);
		document.getElementById('image_show').setAttribute('name',1);
	}
	//document.getElementById('gallerylist').innerHTML = '1';
}

function getPage(name,page){
	jsquery(name,page-1);
	document.getElementById('image_show').setAttribute('name',1);
}

function showPhoto(obj){
	if (!obj) return;
	try {
		if (document.getElementById('gallerylist')==null){
			showGalPhoto(obj);
			return;
		}
	} catch(error) {
		return;
	}
	try {
		var num = document.getElementById('count_photos').getAttribute('name');
	} catch(error) {
		var num = 16;
	}
	var str = new String();
	str = obj.style.background;
	var currentId = obj.id.replace('photo','');
	currentId = parseInt(currentId);
	var prevId = document.getElementById('image_show').getAttribute('name');
	if (currentId>=num){
		document.getElementById("arrow2").style.background = 'url(/images/big_arrow_right_un.png)';
		if (currentId>num)
			return;
	} else {
		document.getElementById("arrow2").style.background = 'url(/images/big_arrow_right.png)';
	}
	if (currentId<=1){
		document.getElementById("arrow1").style.background = 'url(/images/big_arrow_left_un.png)';
		if (currentId<1)
			return
	} else {
		document.getElementById("arrow1").style.background = 'url(/images/big_arrow_left.png)';
	}
	document.getElementById('photo'+prevId).style.borderColor ='#ED2421';
	document.getElementById('photo'+prevId).style.cursor ='pointer';
	str = str.replace('main_preview_','main_show_');
	obj.style.borderColor='#ffffff';
	obj.style.cursor ='default';
	document.getElementById('image_show').style.background=str;
	document.getElementById('image_show').setAttribute('name',currentId);
}

function arrowPhoto(nav){
	var str = new String();
	var prevId = document.getElementById('image_show').getAttribute('name');
	if(nav=='+'){
		var currentId = parseInt(prevId)+1;
	} else {
		var currentId = prevId -1;
	}

	try {
		var num = document.getElementById('count_photos').getAttribute('name');
	} catch(error) {
		var num = 16;
	}
	var prevId = document.getElementById('image_show').getAttribute('name');
	if(nav=='+'){
		var currentId = parseInt(prevId)+1;
	} else {
		var currentId = prevId -1;
	}
	if (currentId>=num||(currentId==0 && num==1)){
		document.getElementById("arrow2").style.background = 'url(/images/big_arrow_right_un.png)';
		if (currentId >num)
			return;
	} else {
		document.getElementById("arrow2").style.background = 'url(/images/big_arrow_right.png)';
	}
	if (currentId<=1){
		document.getElementById("arrow1").style.background = 'url(/images/big_arrow_left_un.png)';
		if (currentId<1)
			return
	} else {
		document.getElementById("arrow1").style.background = 'url(/images/big_arrow_left.png)';
	}
	
	obj = document.getElementById('photo'+currentId);
	if (!obj) {
		return;
	}
	var str = new String();
	str = obj.style.background;
	document.getElementById('photo'+prevId).style.borderColor ='#ED2421';
	str = str.replace('main_preview_','main_show_');
	obj.style.borderColor='#ffffff';
	document.getElementById('image_show').style.background=str;
	document.getElementById('image_show').setAttribute('name',currentId);
}

//Скрипт ajax'a
function jsquery(section,page){
	document.getElementById('loading_bar').style.display = 'block';
	JsHttpRequest.query(
			'../include/backend.php',{
			'section': section,
			'page': page
		},
		function(result, debugMessages) {
			document.getElementById('loading_bar').style.display = 'none';
			if (result.is_error){
				document.getElementById('loading_bar').innerHTML = result.error;
				document.getElementById('loading_bar').style.display='block';
			} else {
				if(result.content){
					document.getElementById('gallerylist').innerHTML = result.content;
					document.getElementById('navbar').innerHTML = result.navbar;
					document.getElementById('count_photos').setAttribute('name',result.count_photos);
					document.getElementById('paging').innerHTML = result.paging;
					showPhoto(document.getElementById('photo1'));
				}
			}
			if (result.text)
				result.text;
		},
		true
	);
}


function getGalAlbum(id,page){
	document.getElementById('image_show').setAttribute('name',1);
	//document.getElementById('gallerylist').innerHTML = '1';
	document.getElementById('loading_bar').style.display = 'block';
	JsHttpRequest.query(
			'/include/gallery_backend.php',{
			'id': id,
			'page': page-1
		},
		function(result, debugMessages) {
			document.getElementById('loading_bar').style.display = 'none';
			if(result.content){
				document.getElementById('photo_preview_list').innerHTML = result.content;
				document.getElementById('navbar').innerHTML = result.navbar;
				document.getElementById('count_photos').setAttribute('name',result.count_photos);
				document.getElementById('paging').innerHTML = result.paging;
				showGalPhoto(document.getElementById('photo1'));
			}
			if (result.text)
				alert(result.text);
		},
		true
	);
}

//Получение информации каталога
function getCatAlbum(id,parent,page){
	document.getElementById('image_show').setAttribute('name',1);
	//document.getElementById('gallerylist').innerHTML = '1';
	document.getElementById('loading_bar').style.display = 'block';
	JsHttpRequest.query(
			'/include/catalog_backend.php',{
			'id': id,
			'page': page-1,
			'parent_id': parent
		},
		function(result, debugMessages) {
			document.getElementById('loading_bar').style.display = 'none';
			if(result.content){
				document.getElementById('catalog_show').innerHTML = result.content;
				document.getElementById('item_gallery').innerHTML = result.gallery;
				//document.getElementById('count_photos').setAttribute('name',result.count_photos);
				document.getElementById('catalog_pager').innerHTML = result.paging;
				document.getElementById('item_info').innerHTML = result.iteminfo;
				showGalPhoto(document.getElementById('photo1'));
			}
			if (result.text)
				alert(result.text);
		},
		true
	);
}



function arrowGalPhoto(nav){
	var str = new String();
	try {
		var num = document.getElementById('count_photos').getAttribute('name');
	} catch(error) {
		var num = 5;
	}
	
	//Дополнительные стрелочки
	var isGal = 0;
	try {
		var smthing = document.getElementById('arrow3').getAttribute('name');
		isGal = 1;
	} catch(error) {
		isGal = 0;
	}
	
	var prevId = document.getElementById('image_show').getAttribute('name');
	if(nav=='+'){
		var currentId = parseInt(prevId)+1;
	} else {
		var currentId = prevId -1;
	}
	if (currentId>=num||(currentId==0 && num==1)){
		if (isGal){
			document.getElementById("arrow4").style.background = 'transparent url(/images/gal_arrow_right_un.png) no-repeat scroll 40% 50%';
		}
		document.getElementById("arrow2").style.background = 'transparent url(/images/catalog_rarr_un.png) no-repeat scroll 0%';
		if (currentId >num)
			return;
	} else {
		if (isGal){
			document.getElementById("arrow4").style.background = 'transparent url(/images/gal_arrow_right.png) no-repeat scroll 40% 50%';
		}
		document.getElementById("arrow2").style.background = 'transparent url(/images/catalog_rarr.png) no-repeat scroll 0%';
	}
	if (currentId<=1){
		if (isGal){
			document.getElementById("arrow3").style.background = 'transparent url(/images/gal_arrow_left_un.png) no-repeat scroll 40% 50%';
		}
		document.getElementById("arrow1").style.background = 'transparent url(/images/catalog_larr_un.png) no-repeat scroll 40% 50%';
		if (currentId<1)
			return
	} else {
		if (isGal){
			document.getElementById("arrow3").style.background = 'transparent url(/images/gal_arrow_left.png) no-repeat scroll 40% 50%';
		}
		document.getElementById("arrow1").style.background = 'transparent url(/images/catalog_larr.png) no-repeat scroll 40% 50%';
	}
	obj = document.getElementById('photo'+currentId);
	if (!obj) {
		return;
	}
	var str = new String();
	str = obj.src;
	document.getElementById('photo'+prevId).style.borderColor ='#ED2421';
	str = str.replace('preview_','');
	obj.style.borderColor='#ffffff';
	document.getElementById('image_show').src=str;
	document.getElementById('image_show').setAttribute('name',currentId);
}

function showGalPhoto(obj){
	if (!obj) return;
	try {
		var num = document.getElementById('count_photos').getAttribute('name');
	} catch(error) {
		var num = 5;
	}
	var str = new String();
	str = obj.src;

	//Дополнительные стрелочки
	var isGal = 0;
	try {
		var smthing = document.getElementById('arrow3').getAttribute('name');
		isGal = 1;
	} catch(error) {
		isGal = 0;
	}

	var currentId = obj.id.replace('photo','');
	if (currentId == 1){
		if (isGal){
			document.getElementById("arrow3").style.background = 'transparent url(/images/gal_arrow_left_un.png) no-repeat scroll 40% 50%';
		}
		document.getElementById("arrow1").style.background = 'transparent url(/images/catalog_larr_un.png) no-repeat scroll 40% 50%';
	} else {
		if (isGal){
			document.getElementById("arrow3").style.background = 'transparent url(/images/gal_arrow_left.png) no-repeat scroll 40% 50%';
		}
		document.getElementById("arrow1").style.background = 'transparent url(/images/catalog_larr.png) no-repeat scroll 40% 50%';
	}
	if (currentId == num){
		if (isGal){
			document.getElementById("arrow4").style.background = 'transparent url(/images/gal_arrow_right_un.png) no-repeat scroll 40% 50%';
		}
		document.getElementById("arrow2").style.background = 'transparent url(/images/catalog_rarr_un.png) no-repeat scroll 0%';
	} else {
		if (isGal){
			document.getElementById("arrow4").style.background = 'transparent url(/images/gal_arrow_right.png) no-repeat scroll 40% 50%';
		}
		document.getElementById("arrow2").style.background = 'transparent url(/images/catalog_rarr.png) no-repeat scroll 0%';
	}
	var prevId = document.getElementById('image_show').getAttribute('name');
	document.getElementById('photo'+prevId).style.borderColor ='#ED2421';
	document.getElementById('photo'+prevId).style.cursor ='pointer';
	str = str.replace('preview_','');
	obj.style.borderColor='#ffffff';
	obj.style.cursor='default';
	document.getElementById('image_show').src=str;
	document.getElementById('image_show').setAttribute('name',currentId);
}
*/
function sitemap(){
    $('sitemap').style.display = ($('sitemap').style.display == ''?'none':'');
    return true;
};