﻿function G(id) { return document.getElementById(id); }
function formatPic(E) { for (var A in E) { var H = E[A].width; var F = E[A].height; var C = E[A].valign; var I = document.getElementsByName(A); for (var B = 0; B < I.length; B++) { if (I[B].width > 0 && I[B].height > 0) { var D = (H / I[B].width < F / I[B].height) ? H / I[B].width : F / I[B].height; if (D <= 1) { I[B].width = I[B].width * D; if (C == 1) { I[B].style.marginTop = (F - I[B].height) / 2 + "px" } } } } } }
var sid = ((new Date()).getTime() + "_" + Math.round(Math.random() * 2147483637));
function sendPfScrollStat() { if (document.images) { (new Image()).src = "/js/blank.js?func=pfscroll&sid=" + sid + "&t=" + (new Date()).getTime() } }
var Slider = (function() { var N = 12; var R = 6; var D = 211; var O = false; var Q; var L = 0; var B = null; var I = false; var J = G("holder1"); var F = G("slidePic"); G("holder2").innerHTML = J.innerHTML; F.scrollLeft = J.scrollWidth; function K() { clearInterval(B); B = setInterval(function() { C(); A() }, 3000) } function H() { clearInterval(B) } function S() { if (O) { return } clearInterval(B); O = true; Q = setInterval(function() { E() }, N) } function P() { if (I) { return } clearInterval(Q); if (F.scrollLeft % D != 0) { L = -(F.scrollLeft % D); T() } else { O = false } K() } function E() { if (F.scrollLeft <= 0) { F.scrollLeft = J.offsetWidth } F.scrollLeft -= R } function C() { clearInterval(Q); if (O) { return } clearInterval(B); O = true; U(); Q = setInterval(function() { U() }, N) } function A() { if (I) { return } clearInterval(Q); if (F.scrollLeft % D != 0) { L = D - F.scrollLeft % D; T() } else { O = false } K() } function U() { if (F.scrollLeft >= J.scrollWidth) { F.scrollLeft = 0 } F.scrollLeft += R } function T() { if (L == 0) { O = false; I = false; return } var V; var W = N, X = R; if (Math.abs(L) < D / 5) { X = Math.round(Math.abs(L / 5)); if (X < 1) { X = 1 } } if (L < 0) { if (L < -X) { L += X; V = X } else { V = -L; L = 0 } F.scrollLeft -= V; setTimeout(function() { T() }, W) } else { if (L > X) { L -= X; V = X } else { V = L; L = 0 } F.scrollLeft += V; setTimeout(function() { T() }, W) } } function M() { var Z = G("slidePic"); Z.onmouseover = function() { Slider.stop() }; Z.onmouseout = function() { Slider.play() }; var V = G("slide_left"), W = G("slide_right"); V.onmouseover = W.onmouseover = function() { Slider.stop(); this.className = "arr_bg" }; V.onmouseout = W.onmouseout = function() { this.className = ""; Slider.play() }; var X = G("arrow_left"); X.onmousedown = function() { this.className = "arr_left"; Slider.up() }; X.onmouseup = function() { Slider.stopUp() }; X.onmouseout = function() { Slider.stopUp(); this.className = "" }; var Y = G("arrow_right"); Y.onmousedown = function() { this.className = "arr_right"; Slider.down() }; Y.onmouseup = function() { Slider.stopDown() }; Y.onmouseout = function() { Slider.stopDown(); this.className = "" }; X.onclick = Y.onclick = function() { setTimeout(sendPfScrollStat, 1000) }; K() } return { init: M, play: K, stop: H, up: S, stopUp: P, down: C, stopDown: A} })();
window.onload = function() {
    formatPic({ slidepic: { width: 211, height: 100, valign: 1 }, evypic: { width: 211, height: 100 }, goodpics: { width: 211, height: 100} });
    Slider.init();
    //Mediabox.init.bind(Mediabox);
};

