
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}
var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		gobutton_over = newImage("pooleskin/graphics/forms/gobutton-over.gif");
		atoz_over = newImage("pooleskin/graphics/menu/atoz-over.gif");
		yourcouncil_over = newImage("pooleskin/graphics/menu/yourcouncil-over.gif");
		contact_over = newImage("pooleskin/graphics/menu/contact-over.gif");
		tourism_over = newImage("pooleskin/graphics/menu/tourism-over.gif");
		menu_17_tourism_over = newImage("pooleskin/graphics/menu/menu_17-tourism_over.gif");
		news_over = newImage("pooleskin/graphics/menu/news-over.gif");
		whatsnew_over = newImage("pooleskin/graphics/menu/whatsnew-over.gif");
		jobs_over = newImage("pooleskin/graphics/menu/jobs-over.gif");
		findit_over = newImage("pooleskin/graphics/menu/findit-over.gif");
		about_over = newImage("pooleskin/graphics/menu/about-over.gif");
		help_over = newImage("pooleskin/graphics/menu/help-over.gif");
		home_over = newImage("pooleskin/graphics/menu/home-over.gif");
		preloadFlag = true;
	}
}

function validatesu(form)
	{
	if (document.su.unit_name.value == "")
		{
		alert ('Please select a service unit');
		document.su.unit_name.focus();
		return false;
		}
	return true;
	}

function doublecheck(entry)
	{
	if (confirm('Are you sure you want to delete:\n'+entry))	
		{
		return true;	 
		}
	else
		{
		return false;
		}
	}

function doubledeptcheck(entry)
	{
	if (confirm(entry+'\n\nWarning: Deleting this Department page will remove all Service level pages under it\ndo you want to continue?'))	
		{
		return true;	 
		}
	else
		{
		return false;
		}
	}

function checkLinks() {
	for (var i=0; i<document.links.length; i++) {
		var myString = document.links[i].href
		if (myString.substr(0,29)  != "http://www.boroughofpoole.com") {
			document.links[i].target = "_blank";
		}
	}
}

function toptastic() {
	location.reload()
}

function launchImg(imagefile,title, width, height)
	{
		imgWin=window.open(imagefile,"imgWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=50,top=10,width="+width+",height="+height+"")
	}

function launchTender(imagefile,title)
	{
		imgWin=window.open(imagefile,"imgWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,left=50,top=10,width=450,height=500")
	}

function redirectHere () {
    	location.href = '/pb_unit.asp'
	}

function clear_textbox()
		{
		if (document.searchbox.keyword.value == "Enter search here :")
		document.searchbox.keyword.value = "";
		}
	
function maplaunch(gridref)
	{
	gridlength = gridref.length;
	alpha = gridref.charAt(0);
	numeric = gridref.charAt(1);
	if (gridlength > 2)
		{
		numeric = numeric + gridref.charAt(2);
		}
	destination = "/cgi-bin/map2.pl?act=gridref&style=borough&gridrefalpha=" + alpha + "&gridrefnumeric=" + numeric;
	window.open(destination,"main")
	}

function popup(url,name)
	{
	var width = 500;
	var height = 300;
	var left = 240;
	var top = 170;
	var toolbar = 'no';
	if (window.screen)
		{
		width = window.screen.availWidth - 275;
		height = window.screen.availHeight - 240;
		top = 160;
		}
	if (name == 'cal')
		{
		width = 400;
		height = 300;
		top = 150;
		left = 30;
		}
	window.open(url,name,"width="+width+",height="+height+",left="+left+",top="+top+",screenX="+left+",screenY="+top+",resizable,scrollbars")
	}
