// JavaScript Document


function roller(aImg) {
    var src = aImg.src;
    var aPath = src.split('/');
    var img = aPath[aPath.length - 1].split('.');

    if (img[1] == 'def') {
	img[1] = 'rol';
    } else {
	img[1] = 'def';
    }
    aPath[aPath.length - 1] = img.join('.');
    src = aPath.join('/');
    aImg.src = src;
}

function printContent(myWin) {
    var target = myWin.document.getElementById('right_content');
    var theWin = window.open('', 'print','width=652,height=330,scrollbars,status');
    the_doc = theWin.document;
    the_doc.open();
    the_doc.write('<html><head><style>img.printButton { display: none; }</style></head>');
    the_doc.write('<link rel="Stylesheet" type="text/css" href="/_lib.css/global.css">');   
    the_doc.write('<body style="background-color: white; background-image: none; margin: 0;">');
	the_doc.write('<div style="width: 630px;">');
    the_doc.write('<p align="center" style="margin-top: 0;"><img alt="" src="/_common.images/print_header.gif"/></p>');   
    the_doc.write(target.innerHTML);
    the_doc.write('&nbsp;<br/><hr />');
    the_doc.write('<p align="center" class="small">North Warren Road&nbsp;&nbsp;Gainsborough&nbsp;&nbsp;Lincolnshire&nbsp;&nbsp;DN21 2TU<br/>');
    the_doc.write('Brick Kiln Lane&nbsp;&nbsp;Basford&nbsp;&nbsp;Stoke-on-Trent&nbsp;&nbsp;Staffordshire&nbsp;&nbsp;ST4 7BS<br/>');
    the_doc.write('Printed from http://www.eminox.com, copyright &copy; 2007 Eminox Ltd.<br/>');
	the_doc.write('</div>');
	the_doc.write('</body></html>');
    the_doc.close();
    theWin.print();
}

function posRel2()	{
var test;
}


function posRel() {
	var myDivs = document.getElementsByTagName("div");
	
/* position related topics and make them visible */	
	if (myDivs['relatedTopics'] != null) {
		myDivs['relatedTopics'].style.top = 1 + "px";
		var menuBot = parseInt(myDivs['menu_div'].offsetHeight);
		var relTop = parseInt(myDivs['relatedTopics'].style.top);
		relPos = menuBot + 210 + "px";
		myDivs['relatedTopics'].style.display = 'block';
		myDivs['relatedTopics'].style.top = relPos;
	}

/* position bottom bar */

/* first, check that the bottom bar and main content divs exist and set a value for the starting
location of the bottom bar */	
	if (myDivs['br'] != null && myDivs['right_content'] != null) {
		myDivs['br'].style.top = 1 + "px";
		
/* next, work out which of the divs has the lowest bottom point */		
		myPage = (document.location.href);
		if (myPage.indexOf('home/') > -1) { // check if we're on the home page;
			x1 = parseInt(myDivs['right_content'].offsetHeight) + 0;
			} else {
			x1 = parseInt(myDivs['right_content'].offsetHeight) + 0;
			}
		x2 = parseInt(myDivs['menu_div'].offsetHeight) + 0;
		if (myDivs['relatedTopics'] != null ) {
			x3 = parseInt(myDivs['relatedTopics'].offsetHeight) + x2;
			} else {
			x3 = 0 
			}
		x = (Math.max(x1,x2,x3))
//		alert (x);

/* then, compare the position of the lowest div with the bottom of the window, using 
different methods for IE and Mozilla */

		if ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >=4)){ 
			y = window.innerHeight;
		} else if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >=4)){ 	
			y = document.body.clientHeight;
		} else { 
			return;
		}

/* then, position the bottom bar and make it visible */
		if (x > y) {
			myDivs['br'].style.top = (x+225) + "px";
			myDivs['br'].style.display = 'block';
//			alert ("content bigger than window");
		} else {
//			alert ("window bigger than content");
			myDivs['br'].style.top = (y - 20) + "px";
			myDivs['br'].style.display = 'block';
		}
	}
	
return;
}