// JavaScript Document
function swapEvents(EventNum){
for(i=1;i<4;i++){
document.getElementById("event"+i).style.display = "none";
}
document.getElementById("event"+EventNum).style.display = "inline";
writeText = "";
switch(EventNum){
case 1:
writeText+="<b>Cape Town</b> | <a href='javascript:swapEvents(2);'>Joburg</a> | <a href='javascript:swapEvents(3);'>Durban</a>";
break;
case 2:
writeText+="<a href='javascript:swapEvents(1);'>Cape Town</a> | <b>Joburg</b> | <a href='javascript:swapEvents(3);'>Durban</a>";
break;
case 3:
writeText+="<a href='javascript:swapEvents(1);'>Cape Town</a> | <a href='javascript:swapEvents(2);'>Joburg</a> | <b>Durban</b>";
break;
default:
writeText+="<a href='javascript:swapEvents(1);'>Cape Town</a> | <a href='javascript:swapEvents(2);'>Joburg</a> | <a href='javascript:swapEvents(3);'>Durban</a>";
break;
}
document.getElementById('theEventHead').innerHTML = writeText;
}

<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
currentProd = "";

function rateProduct(theMark){
for(i=1;i<6;i++){
if(i!=theMark){MM_swapImage('mark'+i,'','images/mark_'+i+'.gif',1)}
}
document.getElementById("theRate").value = theMark;
currentProd = theMark;
}
function checkProduct(theMark){
if(theMark!=currentProd){
MM_swapImgRestore();
} else if(currentProd==""){
MM_swapImgRestore();
}
}

function openAZ(whichOne){
myCheck = document.getElementById("content_"+whichOne).style.display;
if(myCheck=="none" || myCheck==""){
document.getElementById("content_"+whichOne).style.display = "inline";
document.getElementById("hold_"+whichOne).className="azListOff";
} else {
document.getElementById("content_"+whichOne).style.display = "none";
document.getElementById("hold_"+whichOne).className="azListOn";
}

}

function showEvent(whichOne){
myCheck = document.getElementById(whichOne).style.display;
if(myCheck=="none" || myCheck==""){
document.getElementById(whichOne).style.display = "inline";
} else {
document.getElementById(whichOne).style.display = "none";
}
}

function openEvent(theURL) { 
  myWindow = window.open(theURL,'popper','resizable=yes,width=530,height=500,scrollbars=yes');
  myWindow.focus();
}

function submitVac(doWhich) { 
switch(doWhich){
case 0:
document.getElementById('toolResults').style.display = "none";
break;
case 1:
document.getElementById('toolResults').style.display = "inline";
break;
}
}


function submitDueDate(doWhich) { 
switch(doWhich){
case 0:
document.getElementById('toolResults').style.display = "none";
break;
case 1:
document.getElementById('toolResults').style.display = "inline";
break;
}
}


function submitOvulation(doWhich) { 
switch(doWhich){
case 0:
document.getElementById('toolResults').style.display = "none";
break;
case 1:
document.getElementById('toolResults').style.display = "inline";
break;
}
}

/////////////////////////////// nav /////////////////////////////////////
 
function createNav(){
topNav = new Array();
topNav[0] = new Array()
topNav[0][0] = new Array("Getting Pregnant","http://www.parent24.com/Content/Getting_pregnant",0);
topNav[0][1] = new Array();
topNav[0][1][0] = new Array("Conception","http://www.parent24.com/Content/Getting_pregnant/conception",10);
topNav[0][1][1] = new Array("Fertility Problems","http://www.parent24.com/Content/Getting_pregnant/fertility_problems",11);
topNav[0][1][2] = new Array("Health and safety","http://www.parent24.com/Content/Getting_pregnant/health_safety",12);
topNav[0][1][3] = new Array("Forums","http://forum.parent24.com",13);
topNav[0][1][4] = new Array("Win","http://www.parent24.com/Content/Competitions",14);
topNav[1] = new Array()
topNav[1][0] = new Array("Pregnancy","http://www.parent24.com/Content/Pregnant",1);
topNav[1][1] = new Array();
topNav[1][1][0] = new Array("How's the foetus","http://www.parent24.com/Content/Pregnant/Hows_the_foetus",20);
topNav[1][1][1] = new Array("Mom's health","http://www.parent24.com/Content/Pregnant/Moms_Health",21);
topNav[1][1][2] = new Array("Think about","http://www.parent24.com/Content/Pregnant/Think_About",22);
topNav[1][1][3] = new Array("Forums","http://forum.parent24.com",23);
topNav[1][1][4] = new Array("Events","http://www.parent24.com/Content/Events",24);
topNav[1][1][5] = new Array("Galleries","http://www.parent24.com/Content/Galleries",25);
topNav[1][1][6] = new Array("Win","http://www.parent24.com/Content/Competitions",26);
topNav[2] = new Array()
topNav[2][0] = new Array("Baby 0-1","http://www.parent24.com/Content/Baby",2);
topNav[2][1] = new Array();
topNav[2][1][0] = new Array("Birth","http://www.parent24.com/Content/Baby/Birth",30);
topNav[2][1][1] = new Array("Care &amp; Nutrition","http://www.parent24.com/Content/Baby/Care_Nutrition",31);
topNav[2][1][2] = new Array("Development &amp; Behaviour","http://www.parent24.com/Content/Baby/Development_Behaviour",32);
topNav[2][1][3] = new Array("Health &amp; safety","http://www.parent24.com/Content/Baby/Health_Safety",33);
topNav[2][1][4] = new Array("Events","http://www.parent24.com/Content/Events",34);
topNav[2][1][5] = new Array("Forums","http://forum.parent24.com",35);
topNav[2][1][6] = new Array("Galleries","http://www.parent24.com/Content/Galleries",36);
topNav[2][1][7] = new Array("Win","http://www.parent24.com/Content/Competitions",37);
topNav[3] = new Array()
topNav[3][0] = new Array("Toddler 1-2","http://www.parent24.com/Content/Toddler_1-2",3);
topNav[3][1] = new Array();
topNav[3][1][0] = new Array("Care &amp; Nutrition","http://www.parent24.com/Content/Toddler_1-2/Care_Nutrition",40);
topNav[3][1][1] = new Array("Development &amp; Behaviour","http://www.parent24.com/Content/Toddler_1-2/Development_Behaviour",41);
topNav[3][1][2] = new Array("Health &amp; safety","http://www.parent24.com/Content/Toddler_1-2/Health_safety",42);
topNav[3][1][3] = new Array("Events","http://www.parent24.com/Content/Events",43);
topNav[3][1][4] = new Array("Forums","http://forum.parent24.com",44);
topNav[3][1][5] = new Array("Galleries","http://www.parent24.com/Content/Galleries",45);
topNav[3][1][6] = new Array("Win","http://www.parent24.com/Content/Competitions",46);
topNav[4] = new Array()
topNav[4][0] = new Array("Preschool 2-6","http://www.parent24.com/Content/Preschool_2-6",4);
topNav[4][1] = new Array();
topNav[4][1][0] = new Array("Care &amp; Nutrition","http://www.parent24.com/Content/Preschool_2-6/Care_Nutrition",50);
topNav[4][1][1] = new Array("Development &amp; Behaviour","http://www.parent24.com/Content/Preschool_2-6/Development_Behaviour",51);
topNav[4][1][2] = new Array("Health &amp; safety","http://www.parent24.com/Content/Preschool_2-6/Health_safety",52);
topNav[4][1][3] = new Array("Events","http://www.parent24.com/Content/Events",53);
topNav[4][1][4] = new Array("Forums","http://forum.parent24.com",54);
topNav[4][1][5] = new Array("Galleries","http://www.parent24.com/Content/Galleries",55);
topNav[4][1][6] = new Array("Win","http://www.parent24.com/Content/Competitions",56);
topNav[5] = new Array()
topNav[5][0] = new Array("School 7-12","http://www.parent24.com/Content/School_7-12",5);
topNav[5][1] = new Array();
topNav[5][1][0] = new Array("Care &amp; Nutrition","http://www.parent24.com/Content/School_7-12/Care_Nutrition",60);
topNav[5][1][1] = new Array("Development &amp; Behaviour","http://www.parent24.com/Content/School_7-12/Development_Behaviour",61);
topNav[5][1][2] = new Array("Health &amp; safety","http://www.parent24.com/Content/School_7-12/Health_safety",62);
topNav[5][1][3] = new Array("Events","http://www.parent24.com/Content/Events",63);
topNav[5][1][4] = new Array("Forums","http://forum.parent24.com",64);
topNav[5][1][5] = new Array("Galleries","http://www.parent24.com/Content/Galleries",65);
topNav[5][1][6] = new Array("Win","http://www.parent24.com/Content/Competitions",66);
topNav[6] = new Array()
topNav[6][0] = new Array("Teen 13-18","http://www.parent24.com/Content/Teen_13-18",6);
topNav[6][1] = new Array();
topNav[6][1][0] = new Array("Care &amp; Nutrition","http://www.parent24.com/Content/Teen_13-18/Care_Nutrition",70);
topNav[6][1][1] = new Array("Development &amp; Behaviour","http://www.parent24.com/Content/Teen_13-18/Development_Behaviour",71);
topNav[6][1][2] = new Array("Health &amp; safety","http://www.parent24.com/Content/Teen_13-18/Health_safety",72);
topNav[6][1][3] = new Array("Events","http://www.parent24.com/Content/Events",73);
topNav[6][1][4] = new Array("Forums","http://forum.parent24.com",74);
topNav[6][1][5] = new Array("Galleries","http://www.parent24.com/Content/Galleries",75);
topNav[6][1][6] = new Array("Win","http://www.parent24.com/Content/Competitions",76);
topNav[7] = new Array()
topNav[7][0] = new Array("Focus","http://www.parent24.com/Content/Focus",7);
topNav[7][1] = new Array();
topNav[7][1][0] = new Array("Babycare","http://www.parent24.com/Content/Focus/babycare",80);
topNav[7][1][1] = new Array("Breastfeeding","http://www.parent24.com/Content/Focus/breastfeeding",81);
topNav[7][1][2] = new Array("Sleep","http://www.parent24.com/Content/Focus/sleep",82);
topNav[7][1][3] = new Array("Common Ailments","http://www.parent24.com/Content/Focus/Common_Ailments",83);
topNav[7][1][4] = new Array("First Aid","http://www.parent24.com/Content/Focus/first_aid",84);
topNav[7][1][5] = new Array("Travel","http://www.parent24.com/Content/Focus/travel",85);
topNav[7][1][6] = new Array("Nutrition","http://www.parent24.com/Content/Focus/nutrition",86);
topNav[8] = new Array()
topNav[8][0] = new Array("Experts","http://www.parent24.com/Content/Experts",8);
topNav[8][1] = new Array();
topNav[9] = new Array()
topNav[9][0] = new Array("Columns","http://www.parent24.com/Content/Columnists",9);
topNav[9][1] = new Array();
topNav[9][1][0] = new Array("Readers Letters","http://www.parent24.com/Content/Columnists/Readers_Letters",100);
topNav[10] = new Array()
topNav[10][0] = new Array("Me and My Kids","http://www.parent24.com/AuthRegistration.aspx",10);
topNav[10][1] = new Array();


//-->


//////////////////////////////////////////// write nav
myNav = "";
/////////////////write main nav
mySub="";
for(i=0;i<topNav.length;i++){
myNav+="<a href=\""+topNav[i][0][1]+"\" onMouseOver=\"showSub("+topNav[i][0][2]+");\" onMouseOut=\"checkState();\" id=\"top_"+topNav[i][0][2]+"\">"+topNav[i][0][0]+"</a>"
if(i!=topNav.length-1){myNav+="<p></p>"}
/////////////////write sub nav
mySub += "<div id=\"subNav"+topNav[i][0][2]+"\" style=\"display:none;\">";
for(a=0;a<topNav[i][1].length;a++){
mySub+="<a href=\""+topNav[i][1][a][1]+"\" onMouseOver=\"clearOut();\" onMouseOut=\"checkState();\" id=\"sub_"+topNav[i][1][a][2]+"\">"+topNav[i][1][a][0]+"</a>"
if(a!=topNav[i][1].length-1){mySub+="<p></p>"}
}
mySub += "</div>";
}
document.getElementById("mainNav").innerHTML=myNav;
document.getElementById("sNav").innerHTML=mySub;
if((theMarker=="") || (theMarker==undefined)){}else{
setMainStyle(theMarker,theSubMarker);showSub(theMarker);
}

}
////////////////////////////////////////// end write nav
mynavTime = "";

function showSub(tSub){
for(i=0;i<topNav.length;i++){
document.getElementById("top_"+topNav[i][0][2]).className = "offNav";
}
clearInterval(mynavTime);
hideSubs()
if((theSubMarker=="") || (theSubMarker==undefined)) {}else{
document.getElementById("subNav"+tSub).style.display = "inline";
}
document.getElementById("top_"+tSub).className = "hightLightNav";
}

function clearSub(){
if((theMarker=="") || (theMarker==undefined)){
hideSubs();
} else {
showSub(theMarker);
setMainStyle(theMarker,theSubMarker);
}
clearInterval(mynavTime);
}

function checkState(){
mynavTime = setInterval(clearSub,1000);
}

function setMainStyle(theID,theSubID){
document.getElementById("top_"+theID).className = "hightLightNav";

if((theSubMarker=="") || (theSubMarker==undefined)) {}else{
document.getElementById("sub_"+theSubID).className = "hightLightSub";
document.getElementById("subNav"+theID).style.display = "inline";}
}


function hideSubs(){
for(i=0;i<topNav.length;i++){
document.getElementById("subNav"+topNav[i][0][2]).style.display = "none";
document.getElementById("top_"+topNav[i][0][2]).className = "offNav";
}
}

function clearOut(){
clearInterval(mynavTime);
}

////////////////////////////////////////////////////////////// scrollbars////////////////////////////////////////////////////////
/////////------------------- start scrolly  -----------------------------/////////////////////////////
///////// scripted by overactive //////////////////////////////////////////////////////////////////////////////
//ssmyArray = new Array(200,200,400,200,400,200)
ssarrayNum = "";
ssCurrentPos = 0;//position of content
ssSpeed = 50;//speed of movement
ssMoveme = "";//interval
ssAutoMoveme = "";//interval
ssTotal="";//total width
ssEnd=0;

/////////////////////////////////// eased moving  /////////////////////////////////////////////////////////////
function ssmoveScroll(ssDir){
ssMoveAmount = (ssEnd-ssCurrentPos)/3;
if((ssCurrentPos<ssEnd+2)&&(ssCurrentPos>ssEnd-2)){
// cleartimeout
ssCurrentPos = ssEnd;clearInterval(ssMoveme);
}else {
ssCurrentPos=Math.round(ssCurrentPos+ssMoveAmount);
}
document.getElementById("scrollMover").style.left =ssCurrentPos+"px";
}
/////////////////////////////////// pause it  /////////////////////////////////////////////////////////////
function ssPause() {
clearInterval(ssAutoMoveme);
//clearInterval(ssMoveme);
}
/////////////////////////////////// move next  /////////////////////////////////////////////////////////////
function ssNext() {
clearInterval(ssAutoMoveme);
clearInterval(ssMoveme);
ssEnd-=ssMoveAmt;
//if((ssEnd+(ssMoveAmt-20))<=(sstotalWidth-ssTotal)){ssEnd=0}
if((ssEnd-(ssMoveAmt))<=(sstotalWidth-ssTotal)){ssEnd+=ssMoveAmt;}else{
writeIt("total"+ssTotal+"end"+ssEnd+"move amount"+ssMoveAmt+"/")
ssMoveme = setInterval("ssmoveScroll(1)",ssSpeed);
}
}
/////////////////////////////////// move next  /////////////////////////////////////////////////////////////
function ssNextAuto() {
clearInterval(ssMoveme);
ssEnd-=ssMoveAmt;
if((ssEnd+((ssMoveAmt)))<=(sstotalWidth-ssTotal)){ssEnd=0}
writeIt("total"+ssTotal+"end"+ssEnd+"move amount"+ssMoveAmt+"/")
ssMoveme = setInterval("ssmoveScroll(1)",ssSpeed);
}
/////////////////////////////////// move back  /////////////////////////////////////////////////////////////
function ssPrev() {
clearInterval(ssAutoMoveme);
clearInterval(ssMoveme);
ssEnd+=ssMoveAmt;
//if(ssEnd>=(ssMoveAmt-20)){ssEnd=sstotalWidth-ssTotal+20}
if(ssEnd>=(ssMoveAmt-20)){ssEnd-=ssMoveAmt;} else {
writeIt("total"+ssTotal+"end"+ssEnd+"move amount"+ssMoveAmt+"/")
ssMoveme = setInterval("ssmoveScroll(0)",ssSpeed);
}
}
/////////////////////////////////// total width  /////////////////////////////////////////////////////////////
function writeIt(thetxt){
//document.getElementById("writ").innerHTML = thetxt;
}

function ssCalcWidth() {
sstotalWidth = Number(ss_holderwidth);//width of holder
ssMoveAmt = Number(ss_movewidth);// move amount
sstheNum=0;
//for(i=0;i<ssmyArray.length;i++){sstheNum+=ssmyArray[i];}
for(i=0;i<ss_numarticles+1;i++){sstheNum+=ss_movewidth;} 
ssTotal=sstheNum;
document.getElementById("scrollMover").style.width = ssTotal+"px";
// ssautoMove();
}
/////////////////////////////////// automove  /////////////////////////////////////////////////////////////
function ssautoMove(){
ssAutoMoveme =  setInterval("ssNextAuto()",10000);
}

/////////------------------ end scrolly  -------------------////////////////////////////////////


///////////////////////////////////// gallery scripts ////////////////////////////////////////////////////
function showImage(imgNum){
document.getElementById('thePic').innerHTML = "<img src='"+pImages[imgNum][0]+"'>";
document.getElementById('theCap').innerHTML = pImages[imgNum][1];
currentNum = imgNum;
}

function showNext(){
if((currentNum+1)==totalNum){currentNum=0} else {currentNum++;}
showImage(currentNum);
}

function showPrev(){
if((currentNum-1)<0){currentNum=totalNum-1} else {currentNum--;}
showImage(currentNum);
}

function initiateGal(){
totalPages = Math.ceil(totalNum/16);
remainder = totalNum-(totalPages*16)
currentPage = 0;
showImage(0);
setThumbs();
}


function setThumbs(){
start = (currentPage*16)
if(currentPage==(totalPages-1)){theTotal=16+((currentPage*16)+remainder)} else {theTotal=16+(currentPage*16)}
myWriteThumb = "";
for(i=start;i<theTotal;i++){
if(pImages[i][2]!=undefined){myWriteThumb += "<a href='javascript:showImage("+i+");'><img src='"+pImages[i][2]+"' border='0'></a>";}
}
document.getElementById('theThumbs').innerHTML = myWriteThumb;
document.getElementById('theNums').innerHTML = "Page "+(currentPage+1)+" of "+totalPages;
}

function galNext(which){
switch(which){
case 0:
currentPage--;
if(currentPage<0){currentPage=0;}
break;
case 1:
currentPage++;
if(currentPage>=totalPages-1){currentPage=totalPages-1;}
break;
}
setThumbs();
}
///////////////////////////////////////////////////////////////////////////////////////////////
