function submitSearch() {

	document.search.submit();

}
 
function goback() {
history.back()
}

function drawAlert() {
alert ("Sorry, this link is unavailabe at present!");
}

function drawAlertAdmin() {
alert ("Sorry, this feature is unavailable in Admin Mode.");
}

function drawFeatureAlert() {
alert ("Sorry, you cannot delete this page at present.\n\nIt is being used as a Feature Article on the Homepage.");
}

function drawFeatureAlert2() {
alert ("Sorry, you cannot make this page inactive at present.\n\nIt is being used as a Feature Article on the Homepage.");
}

function URLwin(loc) {
if (loc != "" )
{
     URLtestwin = window.open('','testURL','location=yes,menubar=yes,toolbar=yes,resize=yes,scrollbars=yes,status=yes,width=640,height=480');
     URLtestwin.location.href = loc;
     }
}

function HelpPopUp()
	{
	msgWindow=window.open('_help.asp','help',"toolbar=no,top=10,left=10,width=626,height=560,directories=no,status=yes,resize=no,scrollbars=yes,menubar=no")
	} 
	
function ReorderPopUp(url, win)
	{
	msgWindow=window.open(url,win,"toolbar=no,top=10,left=60,width=416,height=550,directories=no,status=yes,resize=no,scrollbars=yes,menubar=no")
	} 
	
function updateOpener() {
    opener.location.href = opener.location.href;
	}

function editPage() {
	document.editPage.action = "editpage.asp";
	document.editPage.submit();
}

function createPage() {
	document.createNew.action = "newpage.asp";
	document.createNew.submit();
}
	
function deletePage() {
	document.deletepage.action = "delete.asp";
	document.deletepage.submit();
}

function replace(string,text,by) {
    // Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

if (document.images) {

// Preload Rollover "on" images
	imgd1on=new Image();
	imgd1on.src="/images_gen/download_pdf_red_on.gif";
	imgd2on=new Image();
	imgd2on.src="/images_gen/download_pdf_green_on.gif";
	imgd3on=new Image();
	imgd3on.src="/images_gen/download_pdf_blue_on.gif";
	
	imgf1on=new Image();
	imgf1on.src="/images_gen/site_search_on.gif";
	imgf2on=new Image();
	imgf2on.src="/images_gen/email_divex_on.gif";
	imgf2aon=new Image();
	imgf2aon.src="/images_gen/email_divex2_on.gif";
	
	imgw1on=new Image();
	imgw1on.src="/images_gen/decrease_width_on.gif";
	imgw2on=new Image();
	imgw2on.src="/images_gen/increase_width_on.gif";
	
	img1on=new Image();
	img1on.src="/images_gen/01_defence_on.gif";
	img2on=new Image();
	img2on.src="/images_gen/02_commercial_on.gif";
	img3on=new Image();
	img3on.src="/images_gen/03_hyperbaric_on.gif";
	img4on=new Image();
	img4on.src="/images_gen/04_ROVs_on.gif";
	img5on=new Image();
	img5on.src="/images_gen/05_servicing_on.gif";
	img6on=new Image();
	img6on.src="/images_gen/06_training_on.gif";
	img7on=new Image();
	img7on.src="/images_gen/07_consultancy_on.gif";
	img8on=new Image();
	img8on.src="/images_gen/08_dive_hire_on.gif";
	img9on=new Image();
	img9on.src="/images_gen/whoweare_on.gif";
	img10on=new Image();
	img10on.src="/images_gen/10_locations_on.gif";
	img11on=new Image();
	img11on.src="/images_gen/11_contact_us_on.gif";
	img12on=new Image();
	img12on.src="/images_gen/12_client_area_on.gif";
	img13on=new Image();
	img13on.src="/images_gen/13_dive_xtra_on.gif";
	
// Preload Rollover "off" images
	imgd1off=new Image();
	imgd1off.src="/images_gen/download_pdf_red_off.gif";
	imgd2off=new Image();
	imgd2off.src="/images_gen/download_pdf_green_off.gif";
	imgd3off=new Image();
	imgd3off.src="/images_gen/download_pdf_blue_off.gif";
	
	imgf1off=new Image();
	imgf1off.src="/images_gen/site_search_off.gif";
	imgf2off=new Image();
	imgf2off.src="/images_gen/email_divex_off.gif";
	imgf2aoff=new Image();
	imgf2aoff.src="/images_gen/email_divex2_off.gif";
	
	imgw1off=new Image();
	imgw1off.src="/images_gen/decrease_width_off.gif";
	imgw2off=new Image();
	imgw2off.src="/images_gen/increase_width_off.gif";
	
	img1off=new Image();
	img1off.src="/images_gen/01_defence_off.gif";
	img2off=new Image();
	img2off.src="/images_gen/02_commercial_off.gif";
	img3off=new Image();
	img3off.src="/images_gen/03_hyperbaric_off.gif";
	img4off=new Image();
	img4off.src="/images_gen/04_ROVs_off.gif";
	img5off=new Image();
	img5off.src="/images_gen/05_servicing_off.gif";
	img6off=new Image();
	img6off.src="/images_gen/06_training_off.gif";
	img7off=new Image();
	img7off.src="/images_gen/07_consultancy_off.gif";
	img8off=new Image();
	img8off.src="/images_gen/08_dive_hire_off.gif";
	img9off=new Image();
	img9off.src="/images_gen/whoweare_off.gif";
	img10off=new Image();
	img10off.src="/images_gen/10_locations_off.gif";
	img11off=new Image();
	img11off.src="/images_gen/11_contact_us_off.gif";
	img12off=new Image();
	img12off.src="/images_gen/12_client_area_off.gif";
	img13off=new Image();
	img13off.src="/images_gen/13_dive_xtra_off.gif";}

// Activating the menu rollovers

function imgAct(imgName) {
	if (document.images) {
document[imgName].src=eval(imgName+"on.src");
	}
}

// Deactivating the menu rollovers

function imgInact(imgName) {
	if (document.images) {
document[imgName].src=eval(imgName+"off.src");
	}
}
