bVer = parseInt(navigator.appVersion);
	document.write("<style>");
	if (!(navigator.appVersion.indexOf("MSIE") == -1)) {
		document.write("div.shop{width:581px;margin:20px 20px 20px 20px; }");
	} else {
		document.write("div.shop{width:541px;margin:20px 20px 20px 20px; }");
	}

if (!((navigator.appVersion.indexOf("MSIE") == -1)&&(navigator.appVersion.substring(0,3)-4.8<0))){
	sOut="";
	document.write("p {	margin: 2px 6px 3px 5px; }");			
	document.write(".black p {	margin: 0px; }");			
	document.write(".menu p {	margin: 0px; }");			
	document.write("p.vbig {	margin: 0px; }");			
	document.write("div.latest{margin:0px 50px 10px 0px; }");
	document.write("div.forumcare{margin:0px 11px 20px 0px; }");
	document.write("div.forumlinks{margin:0px 11px 20px 0px; }");
	document.write("div.rightlinks{margin:0px 0px 20px 0px; }");
	document.write("div.storycolumn{margin:0px 0px 30px 200px; }");
	document.write("div.rightcolumn{margin:0px 7px 25px 7px;}");
	document.write("div.recent{margin-right:3px; }");
	document.write("div.rcnoborder{width:200px; }");
	document.write("div.cn {	margin:10px 15px 10px 15px; }");			
	document.write("div.story {	margin-top:10px; }");			
	
} else {
//netscape <4.8 on PC
	sOut="This site works best with modern browsers. Some features may not work properly with Netscape 4.x. ";					
	document.write("p {	margin: 2px 7px 3px 7px; }");			
	document.write(".black p {	margin: 0px; }");			
	document.write(".menu p {	margin: 0px; }");			
	document.write("p.vbig {	margin: 0px; }");			
	document.write("div.latest{margin:0px 50px 10px 0px; }");
	document.write("div.forumcare{margin:0px 11px 20px 0px; }");
	document.write("div.forumlinks{margin:0px 11px 20px 0px; }");
	document.write("div.rightlinks{margin:0px 0px 20px 0px; }");
	document.write("div.storycolumn{margin:0px 0px 30px 200px; }");
	document.write("div.rightcolumn{margin:0px 7px 25px 7px }");
	document.write("div.rightcolumn{width:184px; }");
	document.write("div.rcnoborder{width:200px; }");
	document.write("div.recent{margin-right:3px; }");
	document.write("div.cn {	margin:10px 15px 10px 15px; }");			
	document.write("div.story {	margin-top:10px; }");			

}
document.write("</style>");

function setCookie(sIn) {
    document.cookie = "badmothersclub=" + sIn;
}
function readCookie() {
    return unescape(document.cookie);
}

function makeCookie(Name,Value,Expiry,Path,Domain,Secure) {
//if you want to save the cookie
if (Expiry != null && !isNaN(Expiry)) {
	var datenow = new Date();
	datenow.setTime(datenow.getTime() + 86400000*Expiry);
	Expiry = datenow.toGMTString();
//	alert(Expiry);
}
Expiry = (Expiry) ? '; expires='+Expiry : '';
Path = (Path)?'; path='+Path:'';
Domain = (Domain) ? '; domain='+Domain : '';
Secure = (Secure) ? '; secure' : '';

document.cookie = Name + '=' + escape(Value) + Expiry + Path + Domain + Secure;

}

function readCookie(Name) {

var cookies = ' ' + document.cookie;
if (cookies.indexOf(' ' + Name + '=') == -1) return null;

var start = cookies.indexOf(' ' + Name + '=') + (Name.length + 2);
var finish = cookies.substring(start,cookies.length);
finish = (finish.indexOf(';') == -1) ? cookies.length : start + finish.indexOf(';');

return unescape(cookies.substring(start,finish));
}

function addToFaves(sID){
	var sTemp=readCookie("faves");
	if (sTemp==null) sTemp="";
	if (sTemp.indexOf(sID)==-1)
		sTemp=sTemp+","+sID;
	makeCookie("faves",sTemp,365,'','',false);
	window.location.reload();
}

function removeFromFaves(sID){
	var sFind=","+sID+",";
	var sTemp=readCookie("faves")+",";
	var start=sTemp.indexOf(sFind);
	var finish = sTemp.substring(start+1,sTemp.length);
	finish = (finish.indexOf(',') == -1) ? sTemp.length : start + finish.indexOf(',');
	if (start!=-1){
		sTemp=sTemp.substring(0,start)+sTemp.substring(finish+1,sTemp.length-1);
	}
	makeCookie("faves",sTemp,365,'','',false);
	window.location.reload();
}

function setLastItem(iID, iCount){
	var sFind=","+iID+"|";
	var sTemp=readCookie("discussions");
	if (sTemp==null) start=-1;
	else start=sTemp.indexOf(sFind);
	if (start==-1){ //not found, just append
	}
	else { // found, remove
//		start=start+sFind.length;
		var finish = sTemp.substring(start+1,sTemp.length);
		var end = (finish.indexOf(',') == -1) ? finish.length : finish.indexOf(',');
		sTemp=sTemp.substring(0,start)+finish.substring(end,finish.length);
	}
	sTemp=sTemp+sFind+iCount;
	// cookie size limit - make sure sTemp isn't too long
	if (sTemp.length>3000){
		sTemp=sTemp.substring(sTemp.length-3000,sTemp.length);
		sTemp=sTemp.substring(sTemp.indexOf(','),sTemp.length);
	}
//	alert(sTemp);
	makeCookie("discussions",sTemp,365,'','',false);
}

function oldSetLastItem(iID, iCount){
	var sFind=","+iID+"|";
	var sTemp=readCookie("discussions");
	if (sTemp==null) start=-1;
	else start=sTemp.indexOf(sFind);
	if (start==-1){ //not found, just append
		sTemp=sTemp+sFind+iCount;
	}
	else { // found, replace the bit between the | and the comma with iCount
		start=start+sFind.length;
		var finish = sTemp.substring(start,sTemp.length);
		var end = (finish.indexOf(',') == -1) ? finish.length : finish.indexOf(',');
		sTemp=sTemp.substring(0,start)+iCount+finish.substring(end,finish.length);
	}
	makeCookie("discussions",sTemp,365,'','',false);
}

function goRegister() {
window.location.href="index.jsp?lnk=360&type=1";
}
function popEmail(sIn){
var w = window.open("","_new","height=400,width=400");
w.location.href="email.jsp?"+sIn;
w.focus();
}
function goReminder(){
var w = window.open("","_new","height=250,width=300");
w.location.href="freminder.htm";
w.focus();
}
function goLogin(){
var w = window.open("","_new","height=250,width=300");
w.location.href="flogin.htm";
w.focus();
}
function goChat(){
var w = window.open("","_new","height=480,width=640");
w.location.href="chathome.jsp";
w.focus();
}
function goShop(){
var w = window.open("","_new","height=550,width=570,scrollbars=yes");
w.location.href="shop1.htm";
w.focus();
}
function goSurvey(){
var w = window.open("","_new","height=550,width=640,scrollbars=yes");
w.location.href="survey.jsp";
w.focus();
}
function goBib(){
var w = window.open("","_new","height=500,width=570,scrollbars=yes");
w.location.href="shop2.htm";
w.focus();
}
function goApron(){
var w = window.open("","_new","height=500,width=570,scrollbars=yes");
w.location.href="shop3.htm";
w.focus();
}
function goLogout(){
	makeCookie('username','',-1,'','',false);
	makeCookie('password','',-1,'','',false);
	makeCookie('bmc_exp','',-1,'','',false);
	window.location.reload();
}

function setForumStyle(i){
	makeCookie("forumstyle",i,365,'','',false);
	window.location.reload();
}

function checkemail(email){
	if(email.length < 7){
		alert("Your Email address does not appear long enough. Please fill it in then click 'GO' again.");
		return false;
	}
	else if(email.indexOf("@") == -1){
		alert("Your Email address does not appear well-formed. Please fill it in then click 'GO' again.");
		return false;
	}
	else if(email.indexOf("@") > email.lastIndexOf(".")){
		alert("Your Email address does not appear well-formed. Please fill it in then click 'GO' again.");
		return false;
	}

	return true;
}

var fVer = 0;	
var bFlashOK = false;

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

if(isIE && isWin){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
	document.write('if (flash5Installed) then \n');	
	document.write('fVer=5 \n');	
	document.write('elseif (flash4Installed) then \n');	
	document.write('fVer=4 \n');	
	document.write('end if \n');	
	document.write('</SCR' + 'IPT\> \n');
}

function detectFlash(){	
	if (navigator.plugins){
		if (navigator.plugins["Shockwave Flash 2.0"]|| navigator.plugins["Shockwave Flash"]){
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
			fVer = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		}
	}
	
	if(navigator.userAgent.indexOf("WebTV") != -1) fVer = 2;	
	if (fVer >= 4) bFlashOK = true;
}

detectFlash();
//bFlashOK = false;
function replaceString(sSrc, sFrom, sTo){
	sReturn=sSrc;
    iFromLen=sFrom.length;
    iToLen=sTo.length;
    iPos=0;
    iEnd=0;
    do {
        iPos=sReturn.indexOf(sFrom,iEnd);
        if (iPos!=-1) {
            sReturn = sReturn.substring(0,iPos)+sTo+sReturn.substring(iPos+iFromLen);
            iEnd=iPos+iToLen;
        }
    } while (iPos!=-1);
	return sReturn;

}
