function randomAd(product)
{
	if (product=='mow')
	{
		//var whichAd  = getRandom2();
		var whichAd  = getRandom1();
		//var randomAd = new Array(2);
		var randomAd = new Array(1);

		randomAd[0] ='<p style="font-size:0.95em;"><b>Mentor drug database</b> is a comprehensive knowledge base of pharmaceutical products and appliances that can be integrated into any clinical system.<br />';
		randomAd[0]+='<div style="text-align:center;margin:-0.25em 0 0.50em 0;"><img style="width:127px;height:125px;border:1px solid black;" src="/images/ddb_green_127x125.gif" alt=\"drug database image\" /></div>';
		randomAd[0]+='<p style="font-size:0.95em;">Over 70,000 products and packs are contained within the database, including: generic medicinal products, proprietary (branded) medicinal products, and more.';
		randomAd[0]+='<span style="float:right;"><a class="mt1p0" href="/mdd/intro.asp" title="Find out more"><img style="width:40px;height=15px;" src="/images/more.gif" alt="more button..." /></span></a></p>';
	
		//randomAd[1] ="<div style=\"text-align:center;\"><img style=\"width:99px;height:120px;border:none;\" src=\"/images/palm_99x120.gif\" alt=\"Palm\" title=\"Palm\" /></div>";
		//randomAd[1]+="<div style=\"font-size:0.95em;\"><b>Mentor on the move provides access to:</b>";
		//randomAd[1]+='<ul><li>Immediate Reference Articles</li><li>Calculators</li><li>Diagnostic suggestions</li><!-- removed 10/11/08 <li>Oxford Handbook of Clinical Medicine</li><li>Oxford Handbook of Clinical Specialities</li> --><li>Travel Advice</li></ul></div>';
		//randomAd[1]+="<div style=\"text-align:right;\"><a class=\"mt1p0\" href=\"/mom/intro.asp\" title=\"Find out more\"><img style=\"width:40px;height=15px;\" src=\"/images/more.gif\" alt=\"more... button\" /></a></div>";
	}
	else if (product=='mom')
	{
		var whichAd  = getRandom2();
		var randomAd = new Array(2);
	
		randomAd[0] = "<center><img src=\"/images/web_150x100.jpg\" style=\"width:150px;height:100px;border:1px solid black;\"	/></center><p style=\"font-size:0.95em;margin-top:1em;\"><b>Mentor on the web</b> provides instant access to evidence-based reference materials to support the accurate diagnosis and ongoing management of patients' conditions.<br /><br />";
		randomAd[0]+="And, because it's web-based, healthcare professionals can easily access from the surgery, pharmacy or at home, <strong>no matter what clinical system is used.</strong><br />";
		randomAd[0]+="<span style=\"float:right;\"><a class=\"mt1p0\" href=\"/mow/intro.asp\" title=\"Find out more\" alt=\"Find out more\"><img src=\"/images/more.gif\" width=\"40\" height=\"15\" /></span></a></p>";
	
		randomAd[1] ='<p style="font-size:0.95em;"><b>Mentor drug database</b> is a comprehensive knowledge base of pharmaceutical products and appliances that can be integrated into any clinical system.<br />';
		randomAd[1]+='<div style="text-align:center;margin:-0.25em 0 0.50em 0;"><img style="width:127px;height:125px;border:1px solid black;" src="/images/ddb_green_127x125.gif" alt=\"drug database image\" /></div>';
		randomAd[1]+='<p style="font-size:0.95em;">Over 70,000 products and packs are contained within the database, including: generic medicinal products, proprietary (branded) medicinal products, and more.';
		randomAd[1]+='<span style="float:right;"><a class="mt1p0" href="/mdd/intro.asp" title="Find out more"><img style="width:40px;height=15px;" src="/images/more.gif" alt="more button..." /></span></a></p>';
	}
	else if (product=='mdd')
	{
		//var whichAd  = getRandom2();
		var whichAd  = getRandom1();
		//var randomAd = new Array(2);
		var randomAd = new Array(1);
	
		randomAd[0] = "<center><img src=\"/images/web_150x100.jpg\" style=\"width:150px;height:100px;border:1px solid black;\"	/></center><p style=\"font-size:0.95em;margin-top:1em;\"><b>Mentor on the web</b> provides instant access to evidence-based reference materials to support the accurate diagnosis and ongoing management of patients' conditions.<br /><br />";
		randomAd[0]+="And, because it's web-based, healthcare professionals can easily access from the surgery, pharmacy or at home, <strong>no matter what clinical system is used.</strong><br />";
		randomAd[0]+="<span style=\"float:right;\"><a class=\"mt1p0\" href=\"/mow/intro.asp\" title=\"Find out more\" alt=\"Find out more\"><img src=\"/images/more.gif\" width=\"40\" height=\"15\" /></span></a></p>";
	
		//randomAd[1] ="<div style=\"text-align:center;\"><img style=\"width:99px;height:120px;border:none;\" src=\"/images/palm_99x120.gif\" alt=\"Palm\" title=\"Palm\" /></div>";
		//randomAd[1]+="<div style=\"font-size:0.95em;\"><b>Mentor on the move provides access to:</b>";
		//randomAd[1]+='<ul><li>Immediate Reference Articles</li><li>Calculators</li><li>Diagnostic suggestions</li><!-- removed 10/11/08 <li>Oxford Handbook of Clinical Medicine</li><li>Oxford Handbook of Clinical Specialities</li> --><li>Travel Advice</li></ul></div>';
		//randomAd[1]+="<div style=\"text-align:right;\"><a class=\"mt1p0\" href=\"/mom/intro.asp\" title=\"Find out more\"><img style=\"width:40px;height=15px;\" src=\"/images/more.gif\" alt=\"more... button\" /></a></div>";
	}
	else
	{
		var whichAd  = getRandom2();
		//var randomAd = new Array(3);
		var randomAd = new Array(2);
	
		randomAd[0] = "<center><img src=\"/images/web_150x100.jpg\" style=\"width:150px;height:100px;border:1px solid black;\"	/></center><p style=\"font-size:0.95em;margin-top:1em;\"><b>Mentor on the web</b> provides instant access to evidence-based reference materials to support the accurate diagnosis and ongoing management of patients' conditions.<br /><br />";
		randomAd[0]+="And, because it's web-based, healthcare professionals can easily access from the surgery, pharmacy or at home, <strong>no matter what clinical system is used.</strong><br />";
		randomAd[0]+="<span style=\"float:right;\"><a class=\"mt1p0\" href=\"/mow/intro.asp\" title=\"Find out more\" alt=\"Find out more\"><img src=\"/images/more.gif\" width=\"40\" height=\"15\" /></span></a></p>";
	
		randomAd[1] ='<p style="font-size:0.95em;"><b>Mentor drug database</b> is a comprehensive knowledge base of pharmaceutical products and appliances that can be integrated into any clinical system.<br />';
		randomAd[1]+='<div style="text-align:center;margin:-0.25em 0 0.50em 0;"><img style="width:127px;height:125px;border:1px solid black;" src="/images/ddb_green_127x125.gif" alt=\"drug database image\" /></div>';
		randomAd[1]+='<p style="font-size:0.95em;">Over 70,000 products and packs are contained within the database, including: generic medicinal products, proprietary (branded) medicinal products, and more.';
		randomAd[1]+='<span style="float:right;"><a class="mt1p0" href="/mdd/intro.asp" title="Find out more"><img style="width:40px;height=15px;" src="/images/more.gif" alt="more button..." /></span></a></p>';
	
		//randomAd[2] ="<div style=\"text-align:center;\"><img style=\"width:99px;height:120px;border:none;\" src=\"/images/palm_99x120.gif\" alt=\"Palm\" title=\"Palm\" /></div>";
		//randomAd[2]+="<div style=\"font-size:0.95em;\"><b>Mentor on the move provides access to:</b>";
		//randomAd[2]+='<ul><li>Immediate Reference Articles</li><li>Calculators</li><li>Diagnostic suggestions</li><!-- removed 10/11/08 <li>Oxford Handbook of Clinical Medicine</li><li>Oxford Handbook of Clinical Specialities</li> --><li>Travel Advice</li></ul></div>';
		//randomAd[2]+="<div style=\"text-align:right;\"><a class=\"mt1p0\" href=\"/mom/intro.asp\" title=\"Find out more\"><img style=\"width:40px;height=15px;\" src=\"/images/more.gif\" alt=\"more... button\" /></a></div>";
	}

	document.getElementById('ad_box').innerHTML = randomAd[whichAd];
}

function getRandom1()
{
	var ranNum= Math.floor(Math.random()*1);
	return ranNum;
}

function getRandom2()
{
	var ranNum= Math.floor(Math.random()*2);
	return ranNum;
}

function getRandom3()
{
	var ranNum= Math.floor(Math.random()*3);
	return ranNum;
}

function doLogin(toSys)
{
	var toSysName = '';
	var toURL = '';
	var myHTML = '';
	
	if (toSys=='mow')
	{
		toSysName = 'Mentor on the web';
		toURL = 'http://www.webmentorlibrary.com/login.asp';
	}
	else
	{
		toSysName = 'Mentor on the move';
		toURL = 'http://www.webmentorlibrary.com/subscription/palmmentor.asp';
	}
	
	myHTML+='<form action="' + toURL + '" method="get"><div><p class="limegreen">Login to ' + toSysName + '</p><table>';
	myHTML+='<tr><td class="limegreen tdr fsmall">User ID:&nbsp;</td><td><input type="text" name="user" value="" size="8" /></td></tr>';
	myHTML+='<tr><td class="limegreen tdr fsmall">Password:&nbsp;</td><td><input type="password" name="pword" value="" size="8" /></td></tr>';
	myHTML+='</table>';
	myHTML+='<span style="text-align:center;"><a style="color:white;" href="">Forgotten your password?</a></span>';
	myHTML+='<div style="clear:both;float:right;margin-top:0.50em;"><input class="sbutton" type="submit" name="Login" value="&nbsp;Login&nbsp;" /></div>';
	myHTML+='</div></form>';

	document.getElementById('loginarea').innerHTML = myHTML;
}
function createWindow(cUrl,cName,cFeatures)
{
	var xWin = window.open(cUrl,cName,cFeatures)
}

function mailcheck(product)
{
	if (product=="mow")
	{
		required = new Array ("ContactName","Address1","postcode","email");
	}
	else if (product = "mom")
	{
		required = new Array ("ContactName","SurgeryName","Address1","postcode","email");
	}

	for (i=0;i<required.length;i++)
	{
		inputs = document.getElementById(required[i]);
		if (inputs.value == "")
		{
			alert("A required field has been left blank");
			return false;
		}
	}
	return true;
}

function subscribeWindow(mode)
{
	window.open("http://beta.mentor-online.com/mow/team.asp","fs","address=0")
}