var obLink = new Array();
var obText = new Array();
var ycLink = new Array();
var ycText = new Array();
var imgRoot = "/images/site/";

//On Babyworld array
obText[0] = "babyworld shop";
obLink[0] = "https://shop.babyworld.co.uk/";
obText[1] = "Trying for a baby";
obLink[1] = "/information/trying/";
obText[2] = "Pregnancy";
obLink[2] = "/information/pregnancy/";
obText[3] = "Birth";
obLink[3] = "/information/birth/";
obText[4] = "Your baby";
obLink[4] = "/information/baby/";
obText[5] = "New parents";
obLink[5] = "/information/newparents/";
obText[6] = "Expert advice";
obLink[6] = "/experts/";
// obText[6] = "News";
// obLink[6] = "/news/";
obText[7] = "Product tests";
obLink[7] = "/information/products/";
obText[8] = "Competitions";
obLink[8] = "/competition_page/comp.asp";
obText[9] = "News";
obLink[9] = "/news/";
obText[10] = "Latest features";
obLink[10] = "/features/default.asp";
//obText[9] = "Jobs at babyworld";
//obLink[9] = "/aboutus/vacancies/";
obText[11] = "Store directory";
obLink[11] = "/shop/storedirectory.asp";
//obText[9] = "Events diary";
//obLink[9] = "/mediapack/eventsdiary2.asp";
obText[12] = "Jobs at babyworld";
obLink[12] = "/aboutus/vacancies/";

//Your Community array
ycText[0] = "What&rsquo;s inside?";
ycLink[0] = "/community_intro/community.asp";
ycText[1] = "Chat";
ycLink[1] = "/community/chat/chat.asp";
ycText[2] = "Discussion forums";
ycLink[2] = "/bbs/new_discpage.asp";
ycText[3] = "Antenatal club";
ycLink[3] = "/community_intro/antenatal.asp";
//ycLink[3] = "/community_intro/pregnancy_wk_antenatal_club_new.asp";
ycText[4] = "Pregnancy diaries";
ycLink[4] = "/community_intro/pregdiary_home.asp";
ycText[5] = "Birth stories";
ycLink[5] = "/community_intro/birthstories_home.asp";
ycText[6] = "Baby diaries";
ycLink[6] = "/community_intro/babydiary_home.asp";
ycText[7] = "Kids&rsquo; gallery";
ycLink[7] = "/community_intro/kidsgallery.asp";
// ycText[7] = "Meet our members";
// ycLink[7] = "/community_intro/member_home.asp";
// ycText[8] = "Find a friend";
// ycLink[8] = "/community/FindaFriend_main_menu.asp";
// ycText[9] = "Member services";
// ycLink[9] = "/community/memberservices.asp";
ycText[8] = "Help";
ycLink[8] = "/help/help_main_menu.asp";

loc = document.location.pathname;
if (loc.charAt(0)=="/"){
	loc = loc.slice(1);
}
if (loc.indexOf(".asp")!=-1){
	loc = loc.replace(".asp","");
}

aDir = loc.split("/")
nStr = "";
for (i=0; i<aDir.length ; i++){
	if(i==aDir.length-1){
		nStr += aDir[i];
	} else {
	    nStr += aDir[i] + "_";
	}
}
if(loc==""){
	bwLoc = "homepage"
} else {
	bwLoc = nStr;
}

preamble = "/redirect.html?redirect=int&linkfrom=";
preambleXt = "/redirect.html?redirect=ext&linkfrom=";
midamble = "&link=channelmenu_";
postamble = "?linkfrom=" + bwLoc + "&link=channelmenu";

//On Babyworld menu
function obWrite(){

	for (i=0; i<obText.length; i++){
		aWords = obText[i].split(" ");
		itemStr = "";
		for (x=0; x<aWords.length ; x++){
            if (x <= aWords.length-1){
				itemStr += aWords[x];
			} 
        }
		document.write('<tr>');
		document.write('<td colspan="2"><img src="' + imgRoot + 'shim.gif" height="1" width="1" border="0"></td></tr>');
		document.write('<tr>');
		document.write('<td width="16" align="right"><img src="' + imgRoot + 'purple_bullet.gif" width="8" height="8" alt="' + obText[i] + '" border="0" name="ob' + [i] + '"></td>');
	//	document.write('<td width="122">&nbsp;&nbsp;<a href="' + preamble + bwLoc + midamble + itemStr + "&linkto=" + obLink[i] + '" title="' + obText[i] + '" class="menu" onmouseover="window.status=\'' + obText[i] + '\';return true;ob' + [i] + '.src=\'' + imgRoot + 'white_bullet.gif\'"  onmouseout="window.status=\'Done\';return true;ob' + [i] + '.src=\'' + imgRoot + 'purple_bullet.gif\'">' + obText[i] + '</a></td>');
		document.write('<td width="122">&nbsp;&nbsp;<a href="' + obLink[i] + '" title="' + obText[i] + '" class="menu" onmouseover="window.status=\'' + obText[i] + '\';return true;ob' + [i] + '.src=\'' + imgRoot + 'white_bullet.gif\'"  onmouseout="window.status=\'Done\';return true;ob' + [i] + '.src=\'' + imgRoot + 'purple_bullet.gif\'">' + obText[i] + '</a></td>');
		document.write('</tr>');
	}
}
//Your Community menu
function ycWrite(){
	for (i=0; i<ycText.length ; i++){
		aWords = ycText[i].split(" ");
		itemStr = "";
		for (x=0; x<aWords.length ; x++){
            if (x <= aWords.length-1){
				itemStr += aWords[x];
			} 
        }
		document.write('<tr>');
		document.write('<td colspan="2"><img src="' + imgRoot + 'shim.gif" height="1" width="1" border="0"></td></tr>');
		document.write('<tr>');
		document.write('<td width="16" align="right"><img src="' + imgRoot + 'purple_bullet.gif" width="8" height="8" alt="' + ycText[i] + '" border="0" name="yc' + [i] + '"></td>');
	//	document.write('<td width="122">&nbsp;&nbsp;<a href="' + preamble + bwLoc + midamble + itemStr + "&linkto=" + ycLink[i] + '" title="' + ycText[i] + '" class="menu" onmouseover="window.status=\'' + ycText[i] + '\';return true;yc' + [i] + '.src=\'' + imgRoot + 'white_bullet.gif\'"  onmouseout="return true;yc' + [i] + '.src=\'' + imgRoot + 'purple_bullet.gif\'">' + ycText[i] + '</a></td>');
		document.write('<td width="122">&nbsp;&nbsp;<a href="' + ycLink[i] + '" title="' + ycText[i] + '" class="menu" onmouseover="window.status=\'' + ycText[i] + '\';return true;yc' + [i] + '.src=\'' + imgRoot + 'white_bullet.gif\'"  onmouseout="return true;yc' + [i] + '.src=\'' + imgRoot + 'purple_bullet.gif\'">' + ycText[i] + '</a></td>');
		document.write('</tr>');
	}
}

//dropdown with redirects function
function dropdown(fName,prefix){
	genText = eval(prefix + "Text");
	genLink = eval(prefix + "Link");
	selectedOpt = eval(prefix + "SelectedOpt")
	document.write('<form name="' + fName + '">');
	document.write('<select name="selectDD" onchange="window.location=' + fName + '.selectDD[' + fName + '.selectDD.selectedIndex].value;">');
	for (i=0; i<genText.length ; i++){
		if (i==selectedOpt){
			escGenText = escape(genText[i]);
			document.write('<option value="' + preamble + bwLoc + '&link=form_' + fName + '_' + escGenText + '&linkto=' + genLink[i] + '" selected>' + genText[i] + '</option>');
		} else {
			escGenText = escape(genText[i]);
			document.write('<option value="' + preamble + bwLoc + '&link=form_' + fName + '_' + escGenText + '&linkto=' + genLink[i] + '">' + genText[i] + '</option>');
		}
    }
	document.write('</select>');
	document.write('</form>');
}