///////////////////////////////////////////////////////////////////////////////
//  
// This script is written and developed by SP Internet Consultancy 
//  
// *** Authorship *** 
//  
// SP Internet Consultancy asserts their authority over this script. It  
// remains their intellectual property, and may not be marketed otherwise. 
//  
// *** Ownership *** 
//  
// SP Internet Consultancy retains the ownership of this script and its  
// source code. The owner of the web site this script is running on is  
// granted a non-exclusive licence to use this script on their web site.  
// SP Internet Consultancy has the right to resell or redevelop this script. 
//  
// *** Reuse *** 
//  
// The owner of the web site may not resell or redevelop this script without  
// prior consent of SP Internet Consultancy. 
//  
// *** Workability *** 
//  
// SP Internet Consultancy makes every effort to ensure that their scripts  
// function correctly. In the event of this, or any other script provided by  
// SP Internet Consultancy, being modified by another party SP Internet  
// Consultancy have no obligation to fix any repairs caused by such modification. 
//  
// *** Disclaimer *** 
//  
// SP are not liable for the information provided by this, or any script,  
// written or provided by SP Internet Consultancy. SP makes no claims to the  
// suitability or usability of the information. 
//  
// *** Contact: *** 
//  
// SP Internet Consultancy can be contacted at: 
//  
// mephist@netscape.net  
// kas@easynet.co.uk 
//  
///////////////////////////////////////////////////////////////////////////////

function verifyForm(form) {

	// This function will check a form and make sure that all
	// text, hidden, or password elements of the form have
	// a value. If the test fails a message will be displayed
	// in an alert box.

	var checkPassed = true;

	for (i = 0; i < form.elements.length; i++) {

		if (form.elements[i].type == "text"
		    || form.elements[i].type == "hidden"
		    || form.elements[i].type == "password") {

			if (form.elements[i].value == "") {

				checkPassed = false;

			}

		}

	}

	if (!checkPassed) {

		alert("Please complete the form");

	}

	return checkPassed;

}


function verifyMailer() {

	var form = document.forms['mailer'];
	var valid = verifyForm(form);

	if (valid) {

		form.submit();

	}		

}

function resetMailer() {

	var form = document.forms['mailer'];
	form.reset();

}

function verifySearch() {

	var form = document.forms['sitesearch'];
	var valid = verifyForm(form);

	if (valid) {

		form.submit();

	}		

}

function resetSearch() {

	var form = document.forms['sitesearch'];
	form.reset();

}

function setECardImage(form, variant) {

	form.Variant.value = variant;

}

function verifyEcardStep1(form) {

	if (form.Variant.value == "") {

		form.Variant.value = "<???>";

	}

	if (form.From.value == "" || form.To.value == ""
	    || form.Body.value == "") {

		alert("Please complete the form");
		return false;

	} else {

		return true;

	}

}

function setSearchLocation(selectItem) {

	var hidden = document.forms["search"].Search_Locations;
	var index = selectItem.selectedIndex;
	var option = selectItem.options[index];

	if (option.value == "ERR") {

		hidden.value = "";

	} else {

		hidden.value = option.value

	}

}

function verifyPractitionerSearchForm(form) {

	if (form.Search_Locations.value == "") {

		alert("Please select a location");
		return false;

	}

	return true;

}

function verifySiteSearch(form) {

	if (form.CiRestriction.value == "") {

		alert("Please enter something to search for");
		return false;

	} else {

		return false;

	}

}

function checkPracSearch() {

	var form = document.forms["search"];

	if (form.Search_Locations.value == "") {

		alert("Please select a location");
		return;

	}

	form.submit();

}

function resetPracSearch() {

	var form = document.forms["search"];
	form.reset();
	form.Search_Locations.value = "";

}

function print_page() {

	var document_all = (document.all) ? 1 : 0;
	var print_supported = (window.print) ? 1 : 0;
	var is_mac = (navigator.userAgent.indexOf("Mac") != -1); 

	if (print_supported) {

		window.print();

	} else if (document_all && !is_mac) {

		if (confirm("Would you like to print this page?")) {

			vbs_Print_Page();
		}

	} else {

		alert("Sorry, your browser doesn't support this feature.");

	}

}

function open_shop () {

	var description = "";
	description += "dependent=no,";
	description += "directories=yes,";
	description += "location=yes,";
	description += "menubar=yes,";
	description += "resizable=yes,";
	description += "scrollbars=yes,";
	description += "status=yes,";
	description += "toolbar=yes";

	open("http://www.cyberspace.healersworld.com", "shop", description);

}
