var pxMove = 0;
var pxStart = 0;
var ciklpxStop = 0;
var dvigNapr = 306;
var actpage="l1";

function setTimerPic(){
if (window.highlight) clearInterval(highlight);
if (pxStart >= 0) dvigNapr=306; else if(pxStart <= -1224) dvigNapr=306*-1;
//alert(pxStart+" . "+ciklpxStop+" . "+dvigNapr);
ciklpxStop=(pxStart)*-1+dvigNapr;
timerPic=setInterval("high('logotype', ciklpxStop)",8000);
}

function high(idPic, pxStop){
	pic=idPic;
	stop=pxStop;

if (window.highlight) {
pxStart = pxMove
clearInterval(highlight);
if (window.timerPic) { clearInterval(timerPic); }
}

if (window.timerPic) clearInterval(timerPic);
pxMove=pxStart; 
highlight=setInterval("highlightPic(pic, stop)",1)
}

function highlightPic(idPic1, pxStop1){
nameidPic = idPic1; pxStopFunc = pxStop1*-1;

//расчет скорости
koef=(pxStopFunc-pxStart); if (koef<0) koef=koef*-1;
koef=parseInt(koef/306);
skolkoOstalos = parseInt(pxMove)-parseInt(pxStopFunc); if (skolkoOstalos<0) skolkoOstalos=skolkoOstalos*-1;
//skolkoOstalos2 = parseInt(pxMove)-parseInt(pxStart); if (skolkoOstalos2<0) skolkoOstalos2=skolkoOstalos2*-1;
if (skolkoOstalos<=60) { 
shagDvigen = parseInt(skolkoOstalos/10); if (shagDvigen<1) shagDvigen=1; 
koeficient = parseInt(koef*skolkoOstalos/60);  if (koeficient<1) koeficient=1; 
}//else if (skolkoOstalos2<=60) { shagDvigen = parseInt(skolkoOstalos2/10); if (shagDvigen<1) shagDvigen=1; } 
else { shagDvigen = 6; koeficient=koef;}
//конец расчета

if (pxStopFunc<pxStart) napravlenie = (shagDvigen*koeficient)*-1; else napravlenie = shagDvigen*koeficient;

if ((pxStopFunc<pxStart && pxStopFunc<pxMove) || (pxStopFunc>pxStart && pxStopFunc>pxMove)) {
pxMove=pxMove+napravlenie; 

document.getElementById(nameidPic).style.left=pxMove+"px";
}
else if (window.highlight) {
pxStart = pxMove
clearInterval(highlight);

//Управление вкладками
nomVkladka = parseInt((pxStart/306)*-1 + 1);
idVkladka = "l"+nomVkladka;
if (idVkladka != actpage) { 
deactive_page_all(); change_class(idVkladka,'logo_name_act'); actpage=idVkladka;
}


if (window.timerPic) { clearInterval(timerPic); }
setTimerPic();

}

}

//var b=getBrowserInfo();
setTimerPic();






function baza(clipart) {
if (screen.height < 730){
	windop = window.open("foto.html?"+clipart+"","foto","width=600,scrollbars=1,resizable=1");
	windop.focus();
	  }
else {
windop = window.open("foto.html?"+clipart+"","foto","height=550,width=600");
windop.focus();
}
}
function prew_pic(clipart) {
	windop = window.open("foto.html?"+clipart+"","uvelich","scrollbars=1,resizable=1,menubar=1");
	windop.focus();
}
function Help(name) {
	windop = window.open("help/"+name+".php","help","height=270,width=350,scrollbars=1,resizable=1");
		windop.focus();
}

function novost(fail,papka,h,w) {
if (screen.height < 730){
	windop = window.open(""+papka+"/"+fail+".html","news","width=400,scrollbars=1,resizable=1,menubar=1");
	windop.focus();
	  }
else {
windop = window.open(""+papka+"/"+fail+".html","news","height=300,width=400,scrollbars=1,resizable=1,menubar=1");
windop.focus();
}
}

function menuover(obj)
{
obj.style.cursor="hand";
//obj.className="menuover";
//obj.all.tags('A').item(0).style.color="#522020";
}

function photoover(obj)
{
//alert(obj);
var TABLE = document.getElementById(obj);
TABLE.getAttributeNode('bgcolor').value = "";
//obj.style.cursor="hand";
//obj.className="photoover";
//obj.all.tags('A').item(0).style.color="#522020";
}

function menuout(obj)
{
obj.className="menuout";
//obj.all.tags('A').item(0).style.color="#1E6A54";
}

function menuclick(obj)
{
window.location.href=obj.all.tags('A').item(0).href;
}


//скрыть-показать див
function showHideDiv(id1,id2){
document.getElementById(id1).style.display = 'block';
document.getElementById(id2).style.display = 'none';
}

//показать класс
function showClass(id, theClass){
document.getElementById(id).className = theClass;
}

//скрыть класс
function hideClass(id, theClass){
document.getElementById(id).className = 'none';
}

//поменять картинку
function showImg(id, srс1, src2){
obj = document.getElementById(id);
obj.src = (obj.src.indexOf(srс1) != -1)? src2: srс1;
}


function vkl_reder(ind, red1, red2, red3){
document.getElementById('par'+ind+'_1').className = red1;
document.getElementById('par'+ind+'_2').className = red2;
document.getElementById('par'+ind+'_3').className = red3;
}	


function ch_class(id, clas){
document.getElementById(id).className = clas;
}	


function display(id){
obj = document.getElementById(id);
if(obj)
obj.style.visibility = "visible";
}

function hidden(id){
obj = document.getElementById(id);
if(obj)
obj.style.visibility = "hidden";
}

function cs(id, theClass){
obj = document.getElementById(id);
if(obj)
obj.className = theClass;
}


function show(id, path)
{
    if (obj = document.getElementById('pic')) {
        obj.style.background = "url('"+path+"')";
		}
} 


function hide_banner_all()
{
	for(i = 0; i < 1000; i++){
		obj1 = document.getElementById('banner_'+i);
		obj2 = document.getElementById('glass');
		if(obj1) {obj1.style.display = "none";}
		if(obj2) {obj2.style.display = "none";}
	}
}





function display_menu(ind)
{
	for(i = 0; i < 20; i++){
		obj = document.getElementById('m'+ind+'_'+i);
		if(obj) {obj.style.visibility = "visible";}
    }
}


function hide_menu(ind)
{
	for(i = 0; i < 20; i++){
		obj = document.getElementById('m'+ind+'_'+i);
		if(obj) {obj.style.visibility = "hidden";}
    }
}


function change_all(ind)
{
 hide_all(); hiding('pr'+ind+'_1'); displaing('pr'+ind+'_2');
}






function change_class(id, cl_name)
{
if(id != actpage) document.getElementById(id).className = cl_name;
}


function deactive_page_all()
{
	for(i = 0; i < 15; i++){
		obj1 = document.getElementById('l'+i);
		if(obj1) {obj1.className = "logo_name";}
	}
}











function displaing(id){
obj = document.getElementById(id);
if(obj)
obj.style.display = "block";
}

function hiding(id){
obj = document.getElementById(id);
if(obj)
obj.style.display = "none";
}


function change_page()
{
	for(i = 0; i < 1000; i++){
		obj = document.getElementById('af_'+i+'_');
		if(obj) {obj.style.display = "none";}
	}
}


//SELECT
var nohide = 0;
function select_this(id, val){
form_obj = document.getElementById(id);
form_obj.value = val;
}
function view_this(id, val){
form_obj = document.getElementById(id);
textNode = form_obj.firstChild;
textNode.nodeValue = val;
}

function hide(id){
obj = document.getElementById(id);
if(!nohide){
obj.style.display = 'none';
window.status = nohide;
}
else
nohide = 0;
}

function show(id){
obj = document.getElementById(id);
obj.style.display = 'block';
}
function show_hide(id){
obj = document.getElementById(id);
obj.style.display = (obj.style.display == 'none')? 'block': 'none';
nohide=1;
}

//сохранять позицию экрана при переходе на следующею страницу
function save_screen_pos(){
if(navigator.userAgent.indexOf("MSIE") != -1) popravka = 141; else popravka = 0;
setCookie("screen_pos", document.body.scrollTop-popravka);
}

//установка куки
function setCookie(name, value){
	document.cookie = name+"="+escape(value)+";path=/";
}

function view_foto(pid,rid,view){
	windop = window.open("../foto.php?pid="+pid+"&rid="+rid+"&view="+view,"uvelich","width=850,height=720,status=1,resizable=1,scrollbars=1");
	windop.focus();
}
