function confirm_delete_news (news_id, news_flag, news_headline)
{
	var msg = "Do you really want to delete news/article\n\n" + news_headline;
	var locn = "confirmation.php?action=delete_news&news_id=" + news_id + "&news_flag=" + news_flag;
	if (confirm(msg))
	{
	    document.location = locn;
	}
}

function confirm_delete (place_id, place_name)
{
	var msg = "Do you really want to delete\n\n" + place_name + "\n\nand all its reviews?";
	var locn = "confirmation.php?action=delete_place&place_id=" + place_id;
	if (confirm(msg))
	{
	    document.location = locn;
	}
}

function confirm_remove_image (place_id, place_name)
{
	var msg = "Do you really want to remove the picture for\n\n" + place_name;
	var locn = "cgi/remove_place_image.cgi?place_id=" + place_id;
	if (confirm(msg))
	{
	    document.location = locn;
	}
}

function confirm_close (place_id, place_name)
{
	var msg = "Do you really want to close\n\n" + place_name + "?";
	var locn = "confirmation.php?action=close_place&place_id=" + place_id;
	if (confirm(msg))
	{
	    document.location = locn;
	}
}

function confirm_delete_review (review_id)
{
	var msg = "Do you really want to delete this review?";
	var locn = "confirmation.php?action=delete_review&review_id=" + review_id;
	if (confirm(msg))
	{
	    document.location = locn;
	}
}

function verify_quicksearch (f)
{
    if (f.searchbox.value == '')
	{
	    alert ('Please enter a valid location');
		return false;
	}
	else
	{
	    return true;
	}
}

function verify_mapsearch (f)
{
    if (f.mapsearch.value == '')
	{
	    alert ('Please enter a valid location');
		return false;
	}
	else
	{
	    return true;
	}
}


function valid_email(str) 
{
   return (str.indexOf("@") > 1);
}

function verify_advanced_search (f)
{
    if (f.search_video_profile.value == '' && f.search_place_name.value == '' && f.search_location.value == '' && f.search_place_type_id[0].selected == true && f.search_veggie_plus.checked == false && f.search_vegan.checked == false && f.search_licensed.checked == false && f.search_nonsmoking.checked == false)
	{
	    alert ('Please enter a value in at least one field');
		return false;
	}
	else
	{
	    return true;
	}
}

function verify_join (f)
{
    if (f.accept.checked == false)
	{
	    alert ('Please check the box to indicate that you have read and understood our terms and conditions');
		return false;
	}

    if (f.email.value == '')
	{
	    alert ('Please enter your email address');
		return false;
	} 
	
	if (!valid_email(f.email.value))
	{
	    alert ('Your email address does not appear to be valid. Please re-enter your email address');
		return false;
	}

    if (f.firstname.value == '')
	{
	    alert ('Please enter your first name');
		return false;
	} 

    if (f.surname.value == '')
	{
	    alert ('Please enter your surname');
		return false;
	} 

	return true;
}

var image="";
var banners=0;

function cycle() 
{
    if (++banners > 2) banners=1;
    loadbanners();
    document.banner1.src = image;
    window.setTimeout('cycle();',3000);
}

function loadbanners() 
{
    if (banners==1)
    {
        image="images/myimage1.gif";
    }
    if (banners==2)
    {
        image="images/myimage3.gif";
    }
}

var link = "http://www.vegsoc.org/nvw/"

function urlswitch() 
{
    if (banners==1)
    {
        link = "http://www.vegsoc.org/nvw/";
    }
    if (banners==2)
    {
        link = "http://www.vegsoc.org/awards/";
    }
    return link;
}

if (document.images) 
{
    ads = new Array(3);
    alts = new Array(3);
    smallad1s = new Array(2);
    smallalt1s = new Array(2);
    ads[0] = "http://www.veggieplaces.co.uk/images/vegetarian_banner.gif";
    ads[1] = "http://www.veggieplaces.co.uk/images/vegetarian_banner.gif";
    ads[2] = "http://www.veggieplaces.co.uk/images/vegetarian_banner.gif";
    alts[0] = "Vegetarian - vegetarian and vegan shop";
    alts[1] = "Vegetarian - vegetarian and vegan shop";
    alts[2] = "Vegetarian - vegetarian and vegan shop";
    smallad1s[0] = "http://www.veggieplaces.co.uk/images/hermit.gif";    
    smallad1s[1] = "http://www.veggieplaces.co.uk/images/hermit.gif";    
    smallalt1s[0] = "A relaxing and lovely vegetarian holiday get away from it all break in tasteful four star accommodation at a fabulous location with stunning views over beautiful Herefordshire countryside.";
    smallalt1s[1] = "A relaxing and lovely vegetarian holiday get away from it all break in tasteful four star accommodation at a fabulous location with stunning views over beautiful Herefordshire countryside.";
}

newplace = new Array(3);
newplace[0] = "http://www.vegetarian.co.uk";
newplace[1] = "http://www.vegetarian.co.uk";
newplace[2] = "http://www.vegetarian.co.uk";

newsmallad1 = new Array(2);
newsmallad1[0] = "http://www.veggieplaces.co.uk/cgi/forward.pl?url=www.hermitholidays.co.uk/rates_and_bookings.shtml";
newsmallad1[1] = "http://www.veggieplaces.co.uk/cgi/forward.pl?url=www.hermitholidays.co.uk/rates_and_bookings.shtml";

var timer = null
var counter = 0
var smallad1counter = 0

function banner() 
{
    timer=setTimeout("banner()", 6000);
    counter++;
    if (counter >= 3) counter = 0;
    document.bannerad.src = ads[counter];
    document.bannerad.alt = alts[counter];
}

function smallad1() 
{
    timer=setTimeout("smallad1()", 6000);
    smallad1counter++;
    if (smallad1counter >= 2) smallad1counter = 0;
    document.smallad1.src = smallad1s[smallad1counter];
    document.smallad1.alt = smallalt1s[smallad1counter];
}

function gothere() 
{
    counter2 = counter;
    window.location.href = newplace[counter2];
}

function dosmallad1() 
{
    counter3 = smallad1counter;
    window.location.href = newsmallad1[counter3];
}
