// JavaScript Document
/* ################################ GENERIC RANDOM BACKGROUND IMAGE ############################## */
/* This function changes the background image of the header, if no Javascript leaves the defaut in */
var n = 0;
function ChangeCSSBgImg() {
if (!document.getElementById) return false;
var MyElement = "header" //The ID of the element you want to change
// var ImgPath = "http://mediafiles.thedms.co.uk/publication/ys-brad/headers/bradford/" //The file path to your images
if (!document.getElementById(MyElement)) return false;
var random_images = new Array ();
random_images[0] = "pics/header1.jpg";
random_images[1] = "pics/header2.jpg";
random_images[2] = "pics/test1.jpg";
random_images[3] = "pics/header1.jpg";
var random_text = new Array ();
random_text[0] = "Free Quotation Service and delivery to site of roof trusses (attic and standard) and engineered floor joists in 5 Days!";
random_text[1] = 'You can request on online quotation right now for roof trusses or floors by clicking here';
random_text[2] = 'Hello World!';
random_text[3] = '' +'Hello World!';
document.getElementById('transinfo2').innerHTML =random_text[n];
if (n<3) n=n+1; else n=0;
if ($backgroundurl != ImgURL) {
$header.style.backgroundImage = ImgURL;
}
movement = setTimeout("ChangeCSSBgImg()",3000);
}
function setInnerText (elementId, text) {
var element;
if (document.getElementById) {
element = document.getElementById(elementId);
}
else if (document.all) {
element = document.all[elementId];
}
if (element) {
if (typeof element.textContent != 'undefined') {
element.textContent = text;
}
else if (typeof element.innerText != 'undefined') {
element.innerText = text;
}
else if (typeof element.removeChild != 'undefined') {
while (element.hasChildNodes()) {
element.removeChild(element.lastChild);
}
element.appendChild(document.createTextNode(text)) ;
}
}
}
/* random number generator */
function rand(n) {
return ( Math.floor ( Math.random ( ) * n ) );
}
/* Custom onload function */
function addLoadEvent(func) {
n=0;
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
/* trigger onload */
addLoadEvent(ChangeCSSBgImg);
function roll_over(img_name,img_src)
{document[img_name].src=img_src;}
function md(e)
{try{if(event.button==2||event.button==3)return false;}
catch(e){if(e.which==3)return false;}}
document.oncontextmenu=function(){return false;}
document.ondragstart=function(){return false;}
document.onmousedown=md;