function gotodropdownlist(){
if (document.form1.suburblist.options[document.form1.suburblist.selectedIndex].value != "") {
	document.form1.action ="/capetown/suburb/"+document.form1.suburblist.options[document.form1.suburblist.selectedIndex].value;
	return true;
		}
else {
	alert ("Please select a suburb from the list.");
	return false;
	}
}


function emailcheck(email) {
    if (email != null && email != "") {
        a = email.lastIndexOf("@");
        b = email.lastIndexOf(".");
        c = email.indexOf(":");
        d = email.indexOf("/");
        e = email.substring(0,a);
        f = e.indexOf("@");
        g = email.substring(a+1,email.length);
        h = g.indexOf("[");
        i = g.indexOf("]");
        j = g.indexOf("<");
        k = g.indexOf(">");
        l = email.substring(a+1,b);
        m = email.substring(b+1,email.length);
        n = email.substring(0,a);
        o = 0;
        if (a > b) {o++};
        if (c != -1) {o++};
        if (d != -1) {o++};
        if (f != -1) {o++};
        if (h != -1) {o++};
        if (i != -1) {o++};
        if (j != -1) {o++};
        if (k != -1) {o++};
        if (l.length < 2) {o++};
        if (m.length < 2) {o++};
        if (n.length < 1) {o++};
        if (o == 0) { return true; }
        else { return false; }
    }
    else { return false; }
}

function checkform() {
	msg = "";

	// contact details
	if (document.frm.name.value == "")  msg = msg + "- Your name\n";
	if (!emailcheck(document.frm.email.value)) msg = msg + "- Your valid email address\n";
	if (document.frm.message.value == "")  msg = msg + "- Your message\n";
	
	// display the form check	
	if (msg!="")
		{
		alert ("Please complete the following:\r\n\r\n"+msg);
		return false;
		}
}

function checkform2() {
	msg = "";

	// contact details
	if (document.frm.name.value == "")  msg = msg + "- Your name\n";
	if (!emailcheck(document.frm.email.value)) msg = msg + "- Your valid email address\n";
	
	// display the form check	
	if (msg!="")
		{
		alert ("Please complete the following:\r\n\r\n"+msg);
		return false;
		}
}

function checkform_friend() {
	msg = "";

	// contact details
	if (document.frm.name.value == "")  msg = msg + "- Your name\n";
	if (!emailcheck(document.frm.email.value)) msg = msg + "- Your email address\n";
	if (!emailcheck(document.frm.emailfriend.value)) msg = msg + "- Your friends email address\n";
	if (document.frm.message.value == "")  msg = msg + "- Your message\n";
	
	// display the form check	
	if (msg!="")
		{
		alert ("Please complete the following:\r\n\r\n"+msg);
		return false;
		}
}


function bookmark(burl,btitle) {
	if (document.all)
		window.external.AddFavorite(burl,btitle)
}

