document.write(""); var gallery_timer = 0; var mouse_inside=0; var mspeed=15; function slideRight() { var cards = document.getElementById("gallery_preview").childNodes; var k = 0; for (var i = 0; i < cards.length; i++) { if (cards[i].tagName != undefined && cards[i].style != undefined && cards[i].className == "card_container") { if (cards[i].style.display == "block") { var old_card = cards[i]; var next = 1; k++; } else { if (next) { var new_card = cards[i]; next = 0; } if (!first_div) { var first_div = i; } } } } if (new_card == undefined) { var new_card = cards[first_div]; } if (k < 2) { old_card.style.marginLeft = 0; new_card.style.marginLeft = old_card.offsetWidth + 30 + "px"; new_card.style.display = "block"; document.getElementById("gallery_preview").style.height = new_card.offsetHeight + "px"; document.getElementById("gallery_preview").style.width = new_card.offsetWidth + "px"; moveRight(old_card, new_card, old_card.offsetWidth + 30); } stopSlide(); } function moveRight(old_card, new_card, w) { var margin = parseInt(new_card.style.marginLeft); var margin1 = parseInt(old_card.style.marginLeft); var op = 1 - (margin / w); if (margin > 0) { margin -= 20; if (margin < 0) { margin = 0; } new_card.style.marginLeft = margin + "px"; old_card.style.marginLeft = margin1 - 20 + "px"; new_card.style.opacity = op; old_card.style.opacity = 1 - op; setTimeout(function() { moveRight(old_card, new_card, w); }, 20); } else { old_card.style.opacity = 1; old_card.style.display = "none"; } } function slideLeft() { var cards = document.getElementById("gallery_preview").childNodes; var k = 0; for (var i = cards.length - 1; i >= 0; i--) { if (cards[i].tagName != undefined && cards[i].style != undefined && cards[i].className == "card_container") { if (cards[i].style.display == "block") { var old_card = cards[i]; var next = 1; k++; } else { if (next) { var new_card = cards[i]; next = 0; } if (!first_div) { var first_div = i; } } } } if (new_card == undefined) { var new_card = cards[first_div]; } if (k < 2) { old_card.style.marginLeft = 0; new_card.style.marginLeft = -(old_card.offsetWidth + 30) + "px"; new_card.style.display = "block"; document.getElementById("gallery_preview").style.height = new_card.offsetHeight + "px"; document.getElementById("gallery_preview").style.width = new_card.offsetWidth + "px"; moveLeft(old_card, new_card, old_card.offsetWidth + 30); } stopSlide(); } function moveLeft(old_card, new_card, w) { var margin = parseInt(new_card.style.marginLeft); var margin1 = parseInt(old_card.style.marginLeft); var op = 1 - (-margin / w); if (margin < 0) { margin += 20; if (margin > 0) { margin = 0; } new_card.style.marginLeft = margin + "px"; old_card.style.marginLeft = margin1 + 20 + "px"; new_card.style.opacity = op; old_card.style.opacity = 1 - op; setTimeout(function() { moveLeft(old_card, new_card, w); }, 20); } else { old_card.style.opacity = 1; old_card.style.display = "none"; } } function startSlide() { slideRight(); gallery_timer = setTimeout("startSlide()", mspeed*200); } function stopSlide() { clearTimeout(gallery_timer); } window.onload = function() { if (document.getElementById('gallery_preview') != undefined) { startSlide(); } } var carousel=document.getElementById('carousel'); carousel.onmouseout = function(event) { var event = event || window.event; var t = event.target || event.srcElement; var relTarg = event.relatedTarget || event.fromElement; if (t.id[0]!='g' /*&& t.id[0]!='b'*/&& relTarg.id!='carousel' && relTarg.id!='left_arrow' && relTarg.id!='right_arrow' && t.id!='carousel' && !(t.id[0]=='b' && relTarg.id=="" && !isNaN(t.id[1]))) { //window.status+='stop = из: '+t.id+', в: '+relTarg.id+';'; stopSlide(); } else if (! (t.id[0]=='g' && relTarg.id[0]=='b')/*relTarg.id[0]!='b' && isNaN(relTarg.id[1])*/) { //window.status+='start =из: '+t.id+', в: '+relTarg.id+';'; //startSlide(); } } carousel.onmouseover = function(event) { var event = event || window.event; var t = event.target || event.srcElement; var relTarg = event.relatedTarget || event.fromElement; if(t.id!='carousel' && t.id!='left_arrow' && t.id!='right_arrow' && relTarg.id!='left_arrow' && relTarg.id!='right_arrow') { //window.status='stop.id=from: '+relTarg.id+', to: '+t.id+';'; stopSlide(); } /*else if (relTarg.id[0]!='b' && !isNaN(relTarg.id[1])) { window.status+='start.id=from: '+relTarg.id+', to: '+t.id+';'; startSlide(); }*/ } mspeed=20;