var pos = 0;
var poz = 0;
var sea = null;
var width = 530;
var vk = new Object();
(vk = {
init: function () {
document.write("<div id=\"player-vk-write\" align=\"center\"> <ul id=\"player-vk-season\"><li id=\"seasons\"></li></ul> <div id=\"player-vk-player\"></div> <ul id=\"player-vk-serial\"></ul> <a href=\"javascript://\" class=\"prev\" onclick=\"vk.move(1);\">prev</a> <a href=\"javascript://\" class=\"next\" onclick=\"vk.move(0);\">next</a> <a href=\"javascript://\" class=\"prev1\" onclick=\"vk.move1(1);\">prev</a> <a href=\"javascript://\" class=\"next1\" onclick=\"vk.move1(0);\">next</a> <\/div>")
},
player: function (a, b) {
document.getElementById("player-vk-player").innerHTML = "";
var d = document.createElement("iframe");
d.src = String(a);
d.width = "100%";
d.height = "372";
d.setAttribute("border", "0");
d.setAttribute("frameborder", "0");
d.setAttribute("scrolling", "no");
d.setAttribute("allowfullscreen", "");
d.setAttribute("webkitallowfullscreen", "");
d.setAttribute("mozallowfullscreen", "");
d.setAttribute("oallowfullscreen", "");
d.setAttribute("msallowfullscreen", "");
document.getElementById("player-vk-player").appendChild(d);
if (document.getElementById("player-vk-serial")) {
c = document.getElementById("player-vk-serial").getElementsByTagName("span");
for (var i = 0; i < c.length; i++) {
c[i].removeAttribute("class")
}
}
b.setAttribute("class", "active")
},
season: function (a, b) {
if (document.getElementById("player-vk-season")) {
c = document.getElementById("player-vk-season").getElementsByTagName("span");
for (var i = 0; i < c.length; i++) {
document.getElementById("season" + i).style.display = "none";
c[i].removeAttribute("class")
}
document.getElementById("season" + a).style.display = "";
sea = a
}
b.setAttribute("class", "active")
},
show: function (a, b) {
for (var i = 0; i < a; i++) {
document.getElementById("player-vk-season").getElementsByTagName("li")[0].innerHTML += "<span onclick=\"vk.season(" + i + ", this)\">Сезон " + (i + 1) + "</span>";
document.getElementById("player-vk-serial").innerHTML += "<li id=\"season" + i + "\" style=\"display:none;\"></li>"
}
for (var i = 0; i < a; i++) {
for (var j = 0; j < b[i].length; j++) {
document.getElementById("season" + i).innerHTML += "<span onclick=\"vk.player('" + b[i][j] + "', this);\">Серия " + (j + 1) + "</span>"
}
}
document.getElementById("player-vk-season").getElementsByTagName("span")[0].setAttribute("class", "active");
document.getElementById("player-vk-season").getElementsByTagName("span")[0].click();
document.getElementById("season0").getElementsByTagName("span")[0].click();
document.getElementById("season0").style.display = ""
},
move: function (d) {
var a, b;
var c = document.getElementById("seasons");
var e = c.offsetWidth;
var f = c.offsetLeft;
if (d == 0) {
clearTimeout(a);
b = setInterval(function () {
pos = pos - 10;
if (pos >= (f - width) && pos >= -(e - width)) {
c.style.left = pos + "px"
} else clearTimeout(b)
}, 15)
}
if (d == 1) {
clearTimeout(b);
b = setInterval(function () {
pos = pos + 10;
if (pos <= (f + width) && pos <= 0) {
c.style.left = pos + "px"
} else clearTimeout(b)
}, 15)
}
},
move1: function (d) {
var a, b;
var c = document.getElementById("season" + sea);
var e = c.offsetWidth;
var f = c.offsetLeft;
if (d == 0) {
clearTimeout(a);
b = setInterval(function () {
poz = poz - 10;
if (poz >= (f - width) && poz >= -(e - width)) {
c.style.left = poz + "px"
} else clearTimeout(b)
}, 15)
}
if (d == 1) {
clearTimeout(b);
b = setInterval(function () {
poz = poz + 10;
if (poz <= (f + width) && poz <= 0) {
c.style.left = poz + "px"
} else clearTimeout(b)
}, 15)
}
}
});