function payPalAdd(itemName, itemNumber, fCost, iStock) {
	if (iStock > 0) {
		document.writeln("<br/>");
		payPalAddSmall(itemName, itemNumber, fCost, iStock);
	}
	document.writeln("<br/><br/>");
}

function payPalAddSmall(itemName, itemNumber, fCost, iStock) {
	if (iStock > 0) {
		document.writeln("<form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">");
		if (iStock == 1)
			document.writeln("<input type=\"image\" src=\"./assets/graphics/add_to_order.jpg\" border=\"0\" name=\"submit\" alt=\"Add to Order.\">");
		else if (iStock == 2)
			document.writeln("<input type=\"image\" src=\"./assets/graphics/advance.jpg\" border=\"0\" name=\"submit\" alt=\"Advance order.\">");
		document.writeln("<img alt=\"\" border=\"0\" src=\"https://www.paypal.com/en_GB/i/scr/pixel.gif\" width=\"1\" height=\"1\">");
		document.writeln("<input type=\"hidden\" name=\"add\" value=\"1\">");
		document.writeln("<input type=\"hidden\" name=\"cmd\" value=\"_cart\">");
		document.writeln("<input type=\"hidden\" name=\"business\" value=\"sales@caley.com\">");
		document.writeln("<input type=\"hidden\" name=\"item_name\" value=\"" + itemName + "\"/>");
		document.writeln("<input type=\"hidden\" name=\"item_number\" value=\"" + itemNumber + "\"/>");
		document.writeln("<input type=\"hidden\" name=\"amount\" value=\"" + fCost + "\"/>");
		document.writeln("<input type=\"hidden\" name=\"return\" value=\"http://www.caley.com/thanks.shtml\">");
		document.writeln("<input type=\"hidden\" name=\"cancel_return\" value=\http://www.caley.com/index.shtml\">");
		document.writeln("<input type=\"hidden\" name=\"shopping_url\" value=\"http://www.caley.com/index.shtml\">");
		document.writeln("<input type=\"hidden\" name=\"no_note\" value=\"1\">");
		document.writeln("<input type=\"hidden\" name=\"currency_code\" value=\"GBP\">");
		document.writeln("<input type=\"hidden\" name=\"lc\" value=\"GB\">");
		document.writeln("<input type=\"hidden\" name=\"bn\" value=\"PP-ShopCartBF\">");
		document.writeln("</form>");
	}
}

function checkBasket() {
        document.writeln("<img class=\"noprint\" src=\"./assets/graphics/imgLockup.gif\" title=\"Credit card graphic\" alt=\"Credit card graphic\" />");
		document.writeln("<br/>");
        document.writeln("<form target=\"paypal\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">");
        document.writeln("<input type=\"hidden\" name=\"cmd\" value=\"_cart\"/>");
		document.writeln("<input type=\"hidden\" name=\"business\" value=\"sales@caley.com\"/>");
        document.writeln("<input type=\"image\" src=\"./assets/graphics/checkout.jpg\" border=\"0\" name=\"submit\" alt=\"PayPal - The safer, easier way to pay online.\">");
        document.writeln("<input type=\"hidden\" name=\"display\" value=\"1\"/>");
        document.writeln("</form>");
}

function isEmail(inputString) {
	var bEmail = true;
	var atPos = inputString.indexOf('@');
	
	if ( atPos == -1 ) {
		bEmail = false;
	} else if (inputString.lastIndexOf('.') < atPos) {
		bEmail = false;
	}

	return(bEmail);
}

function isLink(inputString) {
	var bLink = true;
	var atPos = inputString.indexOf('href=');
	
	if ( atPos == -1 ) {
		bLink = false;
	}

	return(bLink);
}

function isHypertext(inputString) {
	var bHyper = true;
	var atPos = inputString.indexOf('http://');
	
	if ( atPos == -1 ) {
		bHyper = false;
	}

	return(bHyper);
}