﻿function flyOut(client)
{
    client.style.display = 'block';
    
    if (!client.style.left)
    {
        marg = 0;
    }
    else
    {
        marg = parseInt(client.style.left);
    }
    
    if (marg >= 0 && marg <= 27)
    {
        marg = marg + 1;
        client.style.left = marg + "px";
        tout = window.setTimeout(function () { flyOut(client); }, 12);
    }
}

function flyOutP(client,parent)
{
    client.style.display = 'block';
    parent.style.zIndex = "2000";
    
    if (!client.style.left)
    {
        marg = 0;
    }
    else
    {
        marg = parseInt(client.style.left);
    }
    
    if (marg >= 0 && marg <= 19)
    {
        marg = marg + 1;
        client.style.left = marg + "px";
        tout = window.setTimeout(function () { flyOutP(client,parent); }, 12);
    }
}

function pauseFlyP(client,parent)
{
    parent.style.zIndex = "1";
    
    if (typeof tout == "undefined")
    {
        //do nothing
    }
    else
    {
        clearTimeout(tout);
    }
    
    client.style.display = 'none';
}

function pauseFly(client)
{
    if (typeof tout == "undefined")
    {
        //do nothing
    }
    else
    {
        clearTimeout(tout);
    }
    
    client.style.display = 'none';
}

function goLeft(client)
{
    var scrollerID = client.id.replace('imgrightarrw', 'scroll');
    var scroller = document.getElementById(scrollerID);
    
    if (!scroller.style.marginLeft)
    {
        marg = 0;
    }
    else
    {
        marg = parseInt(scroller.style.marginLeft);
    }
    
    if (marg <= 0 && marg >= -430)
    {
        marg = marg - 1;
        scroller.style.marginLeft = marg + "px";
        tout = window.setTimeout(function () { goLeftB(scrollerID); }, 25);
    }
}

function goLeftB(scrollerID)
{
    var scroller = document.getElementById(scrollerID);
    
    if (!scroller.style.marginLeft)
    {
        marg = 0;
    }
    else
    {
        marg = parseInt(scroller.style.marginLeft);
    }
    
    if (marg <= 0 && marg >= -430)
    {
        marg = marg - 1;
        scroller.style.marginLeft = marg + "px";
        tout = window.setTimeout(function () { goLeftB(scrollerID); }, 25);
    }
}

function goRight(client)
{
    var scrollerID = client.id.replace('imgleftarrw', 'scroll');
    var scroller = document.getElementById(scrollerID);
    
    if (!scroller.style.marginLeft)
    {
        marg = 0;
    }
    else
    {
        marg = parseInt(scroller.style.marginLeft);
    }
    
    if (marg < 0)
    {
        marg = marg + 1;
        scroller.style.marginLeft = marg + "px";
        tout = window.setTimeout(function () { goRightB(scrollerID); }, 25);
    }
}

function goRightB(scrollerID)
{
    var scroller = document.getElementById(scrollerID);
    
    if (!scroller.style.marginLeft)
    {
        marg = 0;
    }
    else
    {
        marg = parseInt(scroller.style.marginLeft);
    }
    
    if (marg < 0)
    {
        marg = marg + 1;
        scroller.style.marginLeft = marg + "px";
        tout = window.setTimeout(function () { goRightB(scrollerID); }, 25);
    }
}

function pause()
{
    if (typeof tout == "undefined")
    {
        //do nothing
    }
    else
    {
        clearTimeout(tout);
    }
}

function newCaptchaString() 
{
    var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
    var string_length = 8;
    var randomstring = '';
    for (var i=0; i<string_length; i++) {
        var rnum = Math.floor(Math.random() * chars.length);
        randomstring += chars.substring(rnum,rnum+1);
    }
    setCookie('CaptchaImageText', randomstring, null);
    document.getElementById('imgCaptcha').src = 'http://www.thewoofbook.co.uk/resource.ashx?c=' + randomstring;
    
    return true;
}
function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=");
        if (c_start!=-1)
        {
            c_start=c_start + c_name.length+1;
            c_end=document.cookie.indexOf(";",c_start);
            if (c_end==-1) c_end=document.cookie.length;
            return unescape(document.cookie.substring(c_start,c_end));
        }
    }
    return "";
}
function setCookie(c_name,value,expiredays)
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString());
}

//var mapKey = "ABQIAAAAQCOfETL6agi8ELDyoxqdOBQCzom7vKYlBuG3mt25PpYkGgoZpRQSu3o_hqBKJVYfkl7DYbcBZ1Cm4g";

var mapKey = serveKey(); 
function serveKey() 
{
    if (window.location.hostname.toUpperCase() == "WWW.THEWOOFBOOK.CO.UK" || window.location.hostname.toUpperCase() == "THEWOOFBOOK.CO.UK") 
    {
        return "ABQIAAAAQCOfETL6agi8ELDyoxqdOBSV0bEBTh3sLs28fWTSZxX3zzkcxRQmRqA9Ejq1RczUL5kCx6PkPCWjUw";
    }
    else if (window.location.hostname.toUpperCase() == "WWW.WOOFBOOK.CO.UK" || window.location.hostname.toUpperCase() == "WOOFBOOK.CO.UK") 
    {
        return "ABQIAAAAQCOfETL6agi8ELDyoxqdOBQGwnHZnzGIDWHBJ8At8CD61DWNnBTL3Kk2L06fqB0c1uwUryqVD2rqYA";
    }
    else if (window.location.hostname.toUpperCase() == "WWW.THEWOOFBOOK.COM" || window.location.hostname.toUpperCase() == "THEWOOFBOOK.COM") 
    {
        return "ABQIAAAAQCOfETL6agi8ELDyoxqdOBT582mEtyAgMx-5rWuBzZq_wLZgFRRC0zLtn03pVIgVSHYbcaO3MD9ctw";
    }            
}

var BM = 2; //button middle
var BR = 3; //button right

function mouseDown(e)
{
    try { if (event.button==BM||event.button==BR) {return false;} }
    catch (e) { if (e.which == BR) {return false;} }
}
document.oncontextmenu = function() { return false; }
document.ondragstart   = function() { return false; }
document.onselectstart = function() { return false; }
document.onmousedown   = mouseDown;



