﻿
var oTimer;
var intW = 650;  //screen.availWidth - 300;
var intH = 700;  //screen.availHeight - 300;
var SwearsMax = 21;

var arrFonts = new Array("Arial Black", "Comic Sans MS", "Impact", "Verdana", "Courier");

var arrAnimals = new Array("monkey",
		                            "cow",
		                            "chimpanzee",
		                            "manatee",
		                            "pig",
		                            "horse",
		                            "gibbon",
		                            "gorilla",
		                            "duck",
		                            "moose",
		                            "chihuahua",
		                            "mong",
		                            "hippo");

var arrPeople = new Array("Barry Chuckle",
                                    "Mykey",
                                    "baldmonkey",
                                    "Mother Theresa",
                                    "your mum",
                                    "Jesus",
                                    "Kirsty Allsopp",
                                    "Joseph Fritzl",
                                    "Hitler",
                                    "the pope",
                                    "Daz Sampson",
                                    "Gary Glitter",
                                    "Harold Shipman",
                                    "Jeremy Beadle");

var textSizes = new Array("xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large");

var arrTourettesWords = new Array("fuck", "tits",
		                            "jen gives head",
		                            "arse",
		                            "piss",
		                            "knob cheese",
		                            "wank handle",
		                            "buttock pump",
									"cat molester",
									"arse cheese",
									"smelly dog\'s arse",
									"dog eggs",
									"spunkbubble",
									"the queen\'s gash",
									"kylie\'s mimsy",
									"{animal} tits",
									"{animal} wank",
									"{person}\'s anus",
									"g-spot tornado",
									"budgie\'s minge",
									"cunt fungus",
									"nipples",
									"hitler\'s mum\'s dog\'s minge",
									"piss bucket",
									"scandinavian scat porn",
									"flange",
									"gay bum sex",
									"septic tits",
									"{animal} fucker",
									"{person} having bumsex with a midget",
									"{animal} spunk",
									"{person}\'s dirty bottom",
									"{person} fellating a {animal}",
									"your mum\'s hairy cock",
									"{person}\'s sex face",
									"your sister\'s smelly bra sweat",
									"your dad sniffs park benches",
									"{person} doing a splatter fart",
									"a dead {animal} with herpes",
									"milk the prostate baby!",
									"{person}\'s pissy knickers",
									"{person} bumming a dead {animal} in the eye socket",
									"shit your leg off",
									"{person}\'s sex piss",
									"GUFFBEAK",
									"{person} is a guffbeak",
									"gaswank", 
									"{person} is a gaswanker");
var intDivCount = 0;
var arrColours = new Array("Red", "Green", "Blue", "Purple", "Black", "Orange", "White");
var arrBGColours = new Array("Black", "White", "White", "White", "White", "Black", "#333333");

function DoTic() {
    //document.onclick = ClearDivs;

    var sTourettesWord = new String(RandomArraryElement(arrTourettesWords).toUpperCase());
    sTourettesWord = sTourettesWord.replace("{PERSON}", RandomArraryElement(arrPeople).toUpperCase());
    sTourettesWord = sTourettesWord.replace("{ANIMAL}", RandomArraryElement(arrAnimals).toUpperCase());

    var intTop = Math.round(Math.random() * intH) + 125;
    var intLeft = Math.round(Math.random() * intW);
    //window.status=intTop + ":" + intLeft;
    //var sColour=new String(RandomArraryElement(arrColours));


    var div = document.createElement("div");

    div.id = "divSweary_" + intDivCount;
    var intColour = Math.floor(Math.random() * arrColours.length);
    var sColour = new String(arrColours[intColour]);
    //div.style.backgroundColor="white";
    div.style.backgroundColor = arrBGColours[intColour].toLowerCase();
    div.style.color = sColour.toLowerCase();
    div.style.fontSize = RandomArraryElement(textSizes);
    div.style.fontFamily = RandomArraryElement(arrFonts);
    div.style.fontWeight = "Bold";
    div.style.position = "fixed";
    div.style.display = "inline";
    div.style.padding = "5px";

//    var opacityValue = 40;
//    div.style.opacity = opacityValue / 10;
//    div.style.filter = "alpha(opacity=" + opacityValue * 10 + ")";

    div.className = "TourettesDiv"
    div.style.zIndex = intDivCount + 1;
    div.innerHTML = unescape(sTourettesWord);

    div.style.borderBottomColor = "Black";
    div.style.borderColor = sColour.toLowerCase();
    div.style.borderWidth = "3px";
    div.style.borderStyle = "solid";
    //div.style.fontFamily="Arial Black";


    div.style.top = intTop + "px";
    div.style.left = (intLeft - div.offsetWidth) + "px";

    window.status = div.offsetWidth;

    document.getElementById("div1").appendChild(div);


    intDivCount++;
    if (intDivCount >= SwearsMax) {
        window.clearTimeout(oTimer);
        ClearDivs();
    }

    

    window.setTimeout("DelayedRemove('" + div.id + "')", 3500 + Math.floor(Math.random() * 2000));

    oTimer = window.setTimeout("DoTic()", 10);

}

function rollOver(objectID) {
    document.getElementById(objectID).className = "";
}

function rollOut(objectID) {
    document.getElementById(objectID).className = "TourettesDiv";
}

function KNPageInit() {
    //            for (var i = 0; i < document.links.length; i++)
    //            {
    //                document.links[i].href = "../Default.aspx";
    //            }
    oTimer = window.setTimeout("DoTic()", 10);

}
function GoHome() {
    window.location.href = "/";
    return false;
}

function RandomArraryElement(objArray) {
    var intMaxElement = objArray.length;
    var intRandomElement = Math.floor(Math.random() * intMaxElement);
    return objArray[intRandomElement];
}


function ClearDivs() {


//    window.clearTimeout(oTimer);
//    for (i = 0; i < intDivCount; i++) {
//        var divElement = document.getElementById("divSweary_" + i);
//        document.body.removeChild(divElement);
//    }
//    intDivCount = 0;
//    //document.onclick = DoTic;
//    KNPageInit();
    
}

function DelayedRemove(divElementID) {
    document.getElementById("div1").removeChild(document.getElementById(divElementID));
}
