// piece of script added for search

var xmlHttp2;

function showsl(str)
{

var url="";
var num=0;

if(str == "WORLD")
{
url="/webx.html";
num=1;
}
else if(str == "iAfrica")
{
url="/allx.html";
num=1;
}
else if(str == "w")
{
document.main.search_for.selectedIndex = 0;
url="http://www.iafrica.com/scripts/webx.html";
}
else if(str == "a")
{
url="http://www.iafrica.com/allx.html";
}
else if(str == "1")
{
document.main1.search_for.selectedIndex = 0;
url="news.html";
}
else if(str == "2")
{
document.main1.search_for.selectedIndex = 0;
url="bus.html";
}
else if(str == "3")
{
document.main1.search_for.selectedIndex = 0;
url="sport.html";
}
else if(str == "4")
{
document.main1.search_for.selectedIndex = 0;
url="motor.html";
}
else if(str == "5")
{
document.main1.search_for.selectedIndex = 0;
url="ent.html";
}
else if(str == "6")
{
document.main1.search_for.selectedIndex = 0;
url="life.html";
}
else if(str == "7")
{
document.main1.search_for.selectedIndex = 0;
url="tech.html";
}
else if(str == "8")
{
document.main1.search_for.selectedIndex = 0;
url="travel.html";
}
else if(str == "9")
{
document.main1.search_for.selectedIndex = 0;
url="food.html";
}
else if(str == "10")
{
document.main1.search_for.selectedIndex = 0;
url="health.html";
}
else if(str == "11")
{
document.main1.search_for.selectedIndex = 0;
url="finance.html";
}
else if(str == "12")
{
document.main1.search_for.selectedIndex = 0;
url="property.html";
}
else
{

url="/allx.html";

}

xmlHttp2=GetXmlHttpObject();

if (xmlHttp2==null)
{
alert ("Browser does not support HTTP Request");
return;
}

if(num == 1)
{
xmlHttp2.onreadystatechange=stateChangedoo;
}
else
{
xmlHttp2.onreadystatechange=stateChangedo;
}




xmlHttp2.open("GET",url,true);
    xmlHttp2.send(null);

}


function stateChangedoo()
{

if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
{

var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = 'http://www.iafrica.com/search/wm.js';

document.getElementById("tsearch").innerHTML=xmlHttp2.responseText;
document.getElementById("tsearch").appendChild(script);

}

}

function stateChangedo()
{

if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
{

var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = 'http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en';

document.getElementById("tsearch").innerHTML=xmlHttp2.responseText;
document.getElementById("tsearch").appendChild(script);

}

}

function GetXmlHttpObject()

{

var xmlHttp2=null;


try
{
// Firefox, Opera 8.0+, Safari
 xmlHttp2=new XMLHttpRequest();
 }
 catch (e)
 {
// // Internet Explorer
 try
 {
 xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
 }
 catch (e)
 {
 xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
 }

 }

 return xmlHttp2;

 }


// of piece of script added for search 



// set some defaults
 iedom=document.all||document.getElementById;
 var cur_tab = "c_userBlock_tag1";
 var tmout;
 
function goSponsor  (theURL){
mysponsor =  window.open(theURL,"thesponsor");
mysponsor.focus();
}

function setuserBlock1  (theTarget,theContent){
clearTimeout(tmout);

cur_tab = theContent;
if ( theTarget == 'MR' )
	nxtblock = 2;
else if ( theTarget == 'ME' )
	nxtblock = 3;
else
	nxtblock = 1;
	
document.getElementById('MR').className = 'c_userBlock_1';
document.getElementById('ME').className = 'c_userBlock_2';
document.getElementById('MC').className = 'c_userBlock_3';
document.getElementById(theTarget).className = 'c_userBlock_Over';

document.getElementById('c_userBlock_tag1').style.display = 'none';
document.getElementById('c_userBlock_tag2').style.display = 'none';
document.getElementById('c_userBlock_tag3').style.display = 'none';
if (typeof jQuery != 'undefined') {
	$("#"+theContent).fadeIn("slow")
}
else
	document.getElementById(theContent).style.display = 'inline';
	
tmout = setTimeout("fade_next()", v_timeout);
}

function setuserBlock2  (theTarget,theContent){
document.getElementById('F').className = 'c_userBlock_1';
document.getElementById('B').className = 'c_userBlock_2';
document.getElementById('C').className = 'c_userBlock_3';
document.getElementById(theTarget).className = 'c_userBlock_Over';

document.getElementById('c_userBlock_tag4').style.display = 'none';
document.getElementById('c_userBlock_tag5').style.display = 'none';
document.getElementById('c_userBlock_tag6').style.display = 'none';
document.getElementById(theContent).style.display = 'inline';
}




function initiateLifeStyle(){

var p;
try {
  p = new XMLHttpRequest();
} catch (e) {
  p = new ActiveXObject("Msxml2.XMLHTTP");
}

var interactiveCount = 0;

function myfunc()
{

  if (p.readyState == 3) {
    interactiveCount++;
  }

  if (p.readyState != 4)
    return;

 // document.getElementById("id1").firstChild.nodeValue = p.responseText;

  if (p.responseXML) {   
    var str;
    try {
      var s = new XMLSerializer();
      var d = p.responseXML;
      str = s.serializeToString(d);
 
    } catch (e) {
      str = p.responseXML.xml;
    }
  //  document.getElementById("id2").firstChild.nodeValue = str;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var x=p.responseXML.getElementsByTagName("articles");

myLifeStyle = new Array();
for (i=0;i<x.length;i++)
{ 
myLifeStyle[i] = new Array();
myLifeStyle[i][0]=0;

theLHead="";
theLBlurb="";
theLPic="";
theLLink="";
theLTemplate="";
theLAnnounce="";
//if(x[i].getElementsByTagName("headline")[0].childNodes[0].nodeValue){theLHead=x[i].getElementsByTagName("headline")[0].childNodes[0].nodeValue;}
//if(x[i].getElementsByTagName("blurb")[0].childNodes[0].nodeValue){theLBlurb=x[i].getElementsByTagName("blurb")[0].childNodes[0].nodeValue;}
//if(x[i].getElementsByTagName("pic")[0].childNodes[0].nodeValue){theLPic=x[i].getElementsByTagName("pic")[0].childNodes[0].nodeValue;}
//if(x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue){theLLink=x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue;}
//if(x[i].getElementsByTagName("template")[0].childNodes[0].nodeValue){theLTemplate=x[i].getElementsByTagName("template")[0].childNodes[0].nodeValue;}
//if(x[i].getElementsByTagName("announcetitle")[0].childNodes[0].nodeValue){theLAnnounce=x[i].getElementsByTagName("announcetitle")[0].childNodes[0].nodeValue;}
if(x[i].getElementsByTagName("headline")[0].hasChildNodes()){theLHead=x[i].getElementsByTagName("headline")[0].childNodes[0].nodeValue;}else{theLHead=" ";}
if(x[i].getElementsByTagName("blurb")[0].hasChildNodes()){theLBlurb=x[i].getElementsByTagName("blurb")[0].childNodes[0].nodeValue;}else{theLBlurb=" ";}
if(x[i].getElementsByTagName("pic")[0].hasChildNodes()){theLPic=x[i].getElementsByTagName("pic")[0].childNodes[0].nodeValue;}else{theLPic=" ";}
if(x[i].getElementsByTagName("link")[0].hasChildNodes()){theLLink=x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue;}else{theLLink=" ";}
if(x[i].getElementsByTagName("template")[0].hasChildNodes()){theLTemplate=x[i].getElementsByTagName("template")[0].childNodes[0].nodeValue;}else{theLTemplate=" ";}
if(x[i].getElementsByTagName("announcetitle")[0].hasChildNodes()){theLAnnounce=x[i].getElementsByTagName("announcetitle")[0].childNodes[0].nodeValue;}else{theLAnnounce=" ";}

myLifeStyle[i][1]=theLHead;
myLifeStyle[i][2]=theLBlurb;
myLifeStyle[i][3]=theLPic;
myLifeStyle[i][4]=theLLink;
myLifeStyle[i][5]=theLTemplate;
myLifeStyle[i][7]=theLAnnounce;
switch(myLifeStyle[i][5]){
case "1": // layout 1
break;
case "2": // layout 2
break;
case "3": // layout 3
var y = x[i].getElementsByTagName("linkurl");
myLifeStyle[i][6]=new Array();
for(a=0;a<y.length;a++){
myLifeStyle[i][6][a] = new Array(x[i].getElementsByTagName("linktitle")[a].childNodes[0].nodeValue,x[i].getElementsByTagName("linkurl")[a].childNodes[0].nodeValue) ;
}
break;
case "4": // layout 4
var y = x[i].getElementsByTagName("linkurl");
myLifeStyle[i][6]=new Array();
for(a=0;a<y.length;a++){
myLifeStyle[i][6][a] = new Array(x[i].getElementsByTagName("linktitle")[a].childNodes[0].nodeValue,x[i].getElementsByTagName("linkurl")[a].childNodes[0].nodeValue) ;
}
break;
case "5":// layout 5
var y = x[i].getElementsByTagName("linkurl");
myLifeStyle[i][6]=new Array();
for(a=0;a<y.length;a++){
myLifeStyle[i][6][a] = new Array(x[i].getElementsByTagName("linktitle")[a].childNodes[0].nodeValue,x[i].getElementsByTagName("linkurl")[a].childNodes[0].nodeValue) ;
}
break;
case "6":// layout 6
var y = x[i].getElementsByTagName("linkurl");
myLifeStyle[i][6]=new Array();
for(a=0;a<y.length;a++){
myLifeStyle[i][6][a] = new Array(x[i].getElementsByTagName("linktitle")[a].childNodes[0].nodeValue,x[i].getElementsByTagName("linkurl")[a].childNodes[0].nodeValue) ;
}
break;
case "7":// layout 7
break;

default:
break;
}

}
compiled = "";

/// write the panels.
for(i=0;i<6;i++){
writeLifeBlocks(i,i);
}


compiled+="";
compiled+="<div id='c_row2_lifestyleArrows'>";
compiled+="<div style='padding-top:50px;'><img src='/pics/general/lifestyle_arrows.gif' name='lifeArrows' width='10' height='52' border='0' usemap='#lifeArrowsMap' id='lifeArrows'>";
compiled+="<map name='lifeArrowsMap'>";
compiled+="<area shape='rect' coords='2,30,10,51' href='javascript:lifestyleMove(0);'>";
compiled+="<area shape='rect' coords='2,2,8,24' href='javascript:lifestyleMove(1);'>";
compiled+="</map>";
compiled+="</div></div>";


document.getElementById("rightme").innerHTML = compiled;

//myInterval = setInterval(lifestyleMove,13000);
keepTotal = new Array();
keepTotal[0] = 1;
keepTotal[1] = myLifeStyle.length;
currentSpot = 6;	
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////	
  }  
}
// p.onload would also work in Mozilla
p.onreadystatechange = myfunc;
try {
  // Needed for Mozilla if local file tries to access an http URL
  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e) {
  // ignore
}
p.open("GET", lifestyleCaller);
p.send(null);

}



/////////////////////////////////// lifestyle move right


function lifestyleMove(direction){
if(direction===0){
start = currentSpot-7;
if(start<0){start=(keepTotal[1])-(start*-1)}
currentSpot--;
if(currentSpot<0){currentSpot = keepTotal[1]}
} else {
start = currentSpot-5;
if(start<0){start=(keepTotal[1])-(start*-1)}
currentSpot++;
if(currentSpot>keepTotal[1]){currentSpot = 0}
}
semitotal =(6+start);
total = keepTotal[1];
compiled = "";
i=start;


for(a=0;a<6;a++){

if(i>=keepTotal[1]){
i=0;
}
writeLifeBlocks(i,a);
i++;
}

compiled+="";
compiled+="<div id='c_row2_lifestyleArrows'>";
compiled+="<div style='padding-top:50px;'><img src='/pics/general/lifestyle_arrows.gif' name='lifeArrows' width='10' height='52' border='0' usemap='#lifeArrowsMap' id='lifeArrows'>";
compiled+="<map name='lifeArrowsMap'>";
compiled+="<area shape='rect' coords='2,30,10,51' href='javascript:lifestyleMove(0);'>";
compiled+="<area shape='rect' coords='2,2,8,24' href='javascript:lifestyleMove(1);'>";
compiled+="</map>";
compiled+="</div></div>";
keepTotal[0]=start;


 if (document.getElementById) {
       document.getElementById("rightme").innerHTML = compiled;
 }else{
     document.layers["rightme"].innerHTML = compiled;
 }

}

/////////////////////////////////// initialise buckets

function writeLifeBlocks(theWID,theWend){
switch(myLifeStyle[i][5]){
case "1":// layout 1
compiled+="<div class='c_row2_lifestyleBlock' id='lifestyle_"+i+"'>";
compiled+="<div id='c_row2_lifestyleArticleHead'><a href='"+myLifeStyle[i][4]+"'>"+myLifeStyle[i][1]+" &raquo;</a></div>";
compiled+="<div id='c_row2_lifestyleArticleCopy'>";
compiled+="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='140' height='153'>";
compiled+="<param name='movie' value='"+myLifeStyle[i][3]+"?text1="+myLifeStyle[i][2]+"&text2="+myLifeStyle[i][7]+"&theLink="+myLifeStyle[i][4]+"' /><param name='quality' value='high' />";
compiled+="<embed src='"+myLifeStyle[i][3]+"?text1="+myLifeStyle[i][2]+"&text2="+myLifeStyle[i][7]+"&theLink="+myLifeStyle[i][4]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='140' height='153'></embed></object>";
compiled+="</div>";
compiled+="</div>";
if((theWend+1)<6){compiled+="<div id='c_row2_lifestyleDiv'></div>";}
break;
case "2":// layout 2
compiled+="<div class='c_row2_lifestyleBlock' id='lifestyle_"+i+"'>";
compiled+="<div id='c_row2_lifestyleArticleHead'><a href='"+myLifeStyle[i][4]+"'>"+myLifeStyle[i][1]+" &raquo;</a></div>";
compiled+="<div id='c_row2_lifestyleArticlePic'><img src='"+myLifeStyle[i][3]+"'></div>";
compiled+="<div id='c_row2_lifestyleArticleCopy'>"+myLifeStyle[i][2]+" <a href='"+myLifeStyle[i][4]+"'>&raquo; More</a></div>";
compiled+="</div>";
if((theWend+1)<6){compiled+="<div id='c_row2_lifestyleDiv'></div>";}
break;
case "3":// layout 3
compiled+="<div class='c_row2_lifestyleBlock' id='lifestyle_"+i+"'>";
compiled+="<div id='c_row2_lifestyleArticleHead'><a href='"+myLifeStyle[i][4]+"'>"+myLifeStyle[i][1]+" &raquo;</a></div>";
compiled+="<div id='c_row2_lifestyleArticlePic'><img src='"+myLifeStyle[i][3]+"'></div>";
compiled+="<div id='c_row2_lifestyleArticleCopy'>"+myLifeStyle[i][2];
for(c=0;c<myLifeStyle[i][6].length;c++){
compiled+="<div>  <a href='"+myLifeStyle[i][6][c][1]+"'>&raquo; "+myLifeStyle[i][6][c][0]+"</a></div>";
}
compiled+="</div>";
compiled+="</div>";
if((theWend+1)<6){compiled+="<div id='c_row2_lifestyleDiv'></div>";}
break;
case "4":// layout 4
compiled+="<div class='c_row2_lifestyleBlock' id='lifestyle_"+i+"'>";
compiled+="<div id='c_row2_lifestyleArticleHead'><a href='"+myLifeStyle[i][4]+"'>"+myLifeStyle[i][1]+" &raquo;</a></div>";
compiled+="<div id='c_row2_lifestyleArticleCopy'>";
for(c=0;c<myLifeStyle[i][6].length;c++){
compiled+="<div>  <a href='"+myLifeStyle[i][6][c][1]+"'>&raquo; "+myLifeStyle[i][6][c][0]+"</a></div>";
}
compiled+="</div>";
compiled+="</div>";
if((theWend+1)<6){compiled+="<div id='c_row2_lifestyleDiv'></div>";}
break;
case "5":// layout 5
compiled+="<div class='c_row2_lifestyleBlock' id='lifestyle_"+i+"'>";
compiled+="<div id='c_row2_lifestyleArticleHead'><a href='"+myLifeStyle[i][4]+"'>"+myLifeStyle[i][1]+" &raquo;</a></div>";
compiled+="<div id='c_row2_lifestyleArticlePic'><img src='"+myLifeStyle[i][3]+"'></div>";
compiled+="<div id='c_row2_lifestyleArticleCopy'>"+myLifeStyle[i][2];
compiled+="<div>  <a href='"+myLifeStyle[i][4]+"'>&raquo; "+myLifeStyle[i][7]+"</a></div>";
for(c=0;c<myLifeStyle[i][6].length;c++){
compiled+="<div>  <a href='"+myLifeStyle[i][6][c][1]+"'>&raquo; "+myLifeStyle[i][6][c][0]+"</a></div>";
}
compiled+="</div>";
compiled+="</div>";
if((theWend+1)<6){compiled+="<div id='c_row2_lifestyleDiv' style='border:0px;'></div>";}
break;
case "6":// layout 6
compiled+="<div class='c_row2_lifestyleBlock' id='lifestyle_"+i+"'>";
compiled+="<div id='c_row2_lifestyleArticleHead'>"+myLifeStyle[i][1]+"</div>";
compiled+="<div id='c_row2_lifestyleArticleCopy'>";
for(c=0;c<myLifeStyle[i][6].length;c++){
compiled+="<div>  <a href='"+myLifeStyle[i][6][c][1]+"'>&raquo; "+myLifeStyle[i][6][c][0]+"</a></div>";
}
compiled+="</div>";
compiled+="</div>";
if((theWend+1)<6){compiled+="<div id='c_row2_lifestyleDiv'></div>";}
break;
case "7":// layout 7
compiled+="<div class='c_row2_lifestyleBlock' id='lifestyle_"+i+"'>";
compiled+="<div id='c_row2_lifestyleArticleHead'><a href='"+myLifeStyle[i][4]+"'>"+myLifeStyle[i][1]+" &raquo;</a></div>";
compiled+="<div id='c_row2_lifestyleArticleCopy'>"+myLifeStyle[i][2];
compiled+="</div>";
compiled+="</div>";
if((theWend+1)<6){compiled+="<div id='c_row2_lifestyleDiv'></div>";}
break;
case "8":// layout 8
compiled+="<div class='c_row2_lifestyleBlock' id='lifestyle_"+i+"'>";
compiled+="<div id='c_row2_lifestyleArticleCopy'>"+myLifeStyle[i][2]+"</div>";
compiled+="</div>";
if((theWend+1)<6){compiled+="<div id='c_row2_lifestyleDiv'></div>";}
break;

default:
break;
}
}

/////////////////////////////////// initialise buckets
function initialiseBucket(){
bucketSeq = new Array();
bucketSeq[0]
bucketSeq[1] = document.getElementById("one").innerHTML;
bucketSeq[2] = document.getElementById("two").innerHTML;
bucketSeq[3] = document.getElementById("three").innerHTML;
bucketSeq[4] = document.getElementById("four").innerHTML;
bucketSeq[5] = document.getElementById("five").innerHTML;
bucketSeq[6] = document.getElementById("six").innerHTML;

iBucket=getCookie('iBucket');
if (iBucket!=null && iBucket!="")
  {
	bucketOrder = iBucket.split(",");
  }
  else 
  { 
	bucketOrder = new Array(0,1,2,3,4,5,6);
  }
moveBucket();
}


function moveBucket(theID,theDir){
if(theDir==0  || theDir==1){
//find position
for(i=1;i<7;i++){
if(bucketOrder[i]==theID){move1Spot=i;move1id=bucketOrder[i];}
}
}
//find prev
if(theDir==0){
if(move1Spot>=2){
move2Spot = move1Spot-1;
} else {move2Spot = move1Spot}
}else if (theDir==1){
if(move1Spot<=5){
move2Spot = move1Spot+1;
} else {move2Spot = move1Spot}
} else {

}
if(theDir==0  || theDir==1){
move2id=bucketOrder[move2Spot];
bucketOrder[move2Spot] = move1id;
bucketOrder[move1Spot] = move2id;
}
document.getElementById("one").innerHTML = bucketSeq[bucketOrder[1]];
document.getElementById("two").innerHTML = bucketSeq[bucketOrder[2]];
document.getElementById("three").innerHTML = bucketSeq[bucketOrder[3]];
document.getElementById("four").innerHTML = bucketSeq[bucketOrder[4]];
document.getElementById("five").innerHTML = bucketSeq[bucketOrder[5]];
document.getElementById("six").innerHTML = bucketSeq[bucketOrder[6]];

//////////////////////////
setCookie('iBucket',bucketOrder,365);
iBucketList=getCookie('iBucketList');
if (iBucketList!=null && iBucketList!="")
  {
	tbucketLists = iBucketList.split(",");
	bucketLists = tbucketLists;
	  }
  else 
  { 
	bucketLists = new Array(0,6,6,6,6,6,6);
  }

writeBucket(1,parseInt(bucketLists[1]));
writeBucket(2,parseInt(bucketLists[2]));
writeBucket(3,parseInt(bucketLists[3]));
writeBucket(4,parseInt(bucketLists[4]));
writeBucket(5,parseInt(bucketLists[5]));
writeBucket(6,parseInt(bucketLists[6]));
}

function writeBucket(theBucket,theNumShow){
var theNumShow = theNumShow;
var theBucket = theBucket;
var setUp = "";
////////// write lists
switch(theNumShow){
case 0:
setUp = "<span class=\"white\">Display:</span>  <strong>0</strong>  |  <a href=\"javascript:writeBucket("+theBucket+",3)\">3</a>  |  <a href=\"javascript:writeBucket("+theBucket+",6)\">6</a>"
break;
case 3:
setUp = "<span class=\"white\">Display:</span>  <a href=\"javascript:writeBucket("+theBucket+",0)\">0</a>  |  <strong>3</strong>  |  <a href=\"javascript:writeBucket("+theBucket+",6)\">6</a>"
break;
case 6:
setUp = "<span class=\"white\">Display:</span>  <a href=\"javascript:writeBucket("+theBucket+",0)\">0</a>  |  <a href=\"javascript:writeBucket("+theBucket+",3)\">3</a>  |  <strong>6</strong>"
break;
}
switch(theBucket){
case 1:
document.getElementById("oneSub").innerHTML = setUp; 
var noted = "oneSub";
break;
case 2:
document.getElementById("twoSub").innerHTML = setUp; 
var noted = "twoSub";
break;
case 3:
document.getElementById("threeSub").innerHTML = setUp; 
var noted = "threeSub";
break;
case 4:
document.getElementById("fourSub").innerHTML = setUp; 
var noted = "fourSub";
break;
case 5:
document.getElementById("fiveSub").innerHTML = setUp; 
var noted = "fiveSub";
break;
case 6:
document.getElementById("sixSub").innerHTML = setUp; 
var noted = "sixSub";
break;
}
//// show / hide
switch(theNumShow){
case 0:
document.getElementById(noted+3).style.display = "none";
document.getElementById(noted+6).style.display = "none";
bucketLists[theBucket]=0;
break;
case 3:
document.getElementById(noted+3).style.display = "inline";
document.getElementById(noted+6).style.display = "none";
bucketLists[theBucket]=3;
break;
case 6:
document.getElementById(noted+3).style.display = "inline";
document.getElementById(noted+6).style.display = "inline";
bucketLists[theBucket]=6;
break;
}

////////////// set cookies

setCookie('iBucketList',bucketLists,365);

////////////////////////////////
}


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
/////////////////////////////////////////////// dreamweaver preload images, swap images, find objects

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];}
}

//////////////////////////////// rotate main articles
function initialise_rotateTopStories(){
myprogressTime = "";
//numSecs = 15000;
numProg= 200;
topStories = new Array("topContainer1","topContainer2","topContainer3","topContainer4");
topCurrent = 0;
rotateTopStories(1);
//mytopTime = setInterval(rotateTopStories,numSecs);
}

function rotateTop(direction){
//clearInterval(mytopTime);
switch(direction){
case 0:
clearInterval(myprogressTime);
break;
case 1:
topCurrent=topCurrent-1;
if(topCurrent<0){
topCurrent=topStories.length-1;
}
rotateTopStories(1);
//mytopTime = setInterval(rotateTopStories,numSecs);
restartProgress();
break;
case 2:
topCurrent=topCurrent+1;
if(topCurrent==topStories.length){
topCurrent=0;
}
rotateTopStories(1);
//mytopTime = setInterval(rotateTopStories,numSecs);
restartProgress();
break;
}

}
function rotateTopStories(automater){
if(!automater){
topCurrent=topCurrent+1;
if(topCurrent>=topStories.length){
topCurrent=0;

}
}
for(i=0;i<topStories.length;i++){
document.getElementById(topStories[i]).style.display ="none";
}
document.getElementById(topStories[topCurrent]).style.display = "inline";
restartProgress();
}

function restartProgress(){
clearInterval(myprogressTime);
progressWidth=0;
myprogressTime = setInterval(setProgressBar,numProg);
}

function setProgressBar(){
progressWidth+=3;
document.getElementById("c_row1_MainRotatesProgressBar").style.width=progressWidth+"px";
if(progressWidth>=200){rotateTopStories();}
}

//////////////////////// set the nav items
// few intialising

function writeNav(){

////////////// start load xml
var p;
try {
  p = new XMLHttpRequest();
} catch (e) {
  p = new ActiveXObject("Msxml2.XMLHTTP");
}

var interactiveCount = 0;

function myfunc()
{

  if (p.readyState == 3) {
    interactiveCount++;
  }

  if (p.readyState != 4)
    return;

  if (p.responseXML) {   
    var str;
    try {
      var s = new XMLSerializer();
      var d = p.responseXML;
      str = s.serializeToString(d);
 
    } catch (e) {
      str = p.responseXML.xml;
    }
  //  document.getElementById("id2").firstChild.nodeValue = str;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var x2=p.responseXML.getElementsByTagName("navItems");
myNavHolder = new Array();
for (i=0;i<x2.length;i++)
{ 
myNavHolder[i] = new Array();
myNavHolder[i][0]=x2[i].getElementsByTagName("title")[0].childNodes[0].nodeValue;
myNavHolder[i][1]=x2[i].getElementsByTagName("url")[0].childNodes[0].nodeValue;
myNavHolder[i][2]=x2[i].getElementsByTagName("target")[0].childNodes[0].nodeValue;
myNavHolder[i][4]=x2[i].getElementsByTagName("theID")[0].childNodes[0].nodeValue;
var x21=x2[i].getElementsByTagName("subnavItems");
myNavHolder[i][3] = new Array();
for (a=0;a<x21.length;a++){
myNavHolder[i][3][a] = new Array();
myNavHolder[i][3][a][0]=x21[a].getElementsByTagName("title")[0].childNodes[0].nodeValue;
myNavHolder[i][3][a][1]=x21[a].getElementsByTagName("url")[0].childNodes[0].nodeValue;
myNavHolder[i][3][a][2]=x21[a].getElementsByTagName("target")[0].childNodes[0].nodeValue;
myNavHolder[i][3][a][4]=x21[a].getElementsByTagName("theID")[0].childNodes[0].nodeValue;
}
}

myNav = "<div>";
myNav+="<div id=\"nav_start\"></div>";

for(i=0;i<myNavHolder.length;i++){
myNav+="<div class=\"nav_bar\" onMouseOver=\"overNav("+myNavHolder[i][4]+");\" onMouseOut=\"checkNav("+myNavHolder[i][4]+");\" onClick=\"goURL('"+myNavHolder[i][1]+"');\" id=\"nav_"+myNavHolder[i][4]+"\">"+myNavHolder[i][0]+"</div>";
}

myNav+="<div class=\"g_clear\"></div></div>";

for(i=0;i<myNavHolder.length;i++){
			myNav+="<div  id=\"subnav_"+myNavHolder[i][4]+"\" style=\"display:none;\">";
			myNav+="<div class=\"subnav\" onMouseOver=\"overSubNav();\" onMouseOut=\"checkNav("+myNavHolder[i][4]+");\">";
				var subLength = myNavHolder[i][3].length;
				for(a=0;a<subLength;a++){
					myNav+="<div id=\"subItem_"+myNavHolder[i][3][a][4]+"\" class=\"subnav_item\" onMouseOut=\"checkSubNavOut("+myNavHolder[i][3][a][4]+")\" onMouseOver=\"checkSubNav("+myNavHolder[i][3][a][4]+")\" onClick=\"goURL('"+myNavHolder[i][3][a][1]+"');\">"+myNavHolder[i][3][a][0]+"</div>";
				}
			myNav+="</div></div>";
}

document.getElementById("rightNav").innerHTML = myNav;

totolNavs = myNavHolder.length;
setMarker();
	
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////	
  }  
}
// p.onload would also work in Mozilla
p.onreadystatechange = myfunc;
try {
  // Needed for Mozilla if local file tries to access an http URL
  netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
} catch (e) {
  // ignore
}
p.open("GET", "/nav_xml_t1.xml");
p.send(null);

////////////// end load xml
}


mynavTime = "";

/////////////////////////////////////////////// nav rollovers
function checkNav(theItem){
activeNav = theItem;
mynavTime = window.setInterval(navOut,1000);
}

function overNav(theItem){
//cancel old
if(theMarker!="") {
document.getElementById("subnav_"+theMarker).style.display = "none";
}
if(mynavTime!=""){
clearInterval(mynavTime);
for(i=0;i<totolNavs;i++){
var tempItem = "nav_"+ myNavHolder[i][4];
document.getElementById(tempItem).className="nav_bar";
var setSub = "subnav_"+myNavHolder[i][4];
document.getElementById(setSub).style.display = "none";
}
var subItem = "subnav_"+theItem;
var navItem = "nav_"+theItem;
document.getElementById(navItem).className="nav_bar";
document.getElementById(subItem).style.display = "none";
if(document.getElementById("subnav_extras")){
document.getElementById("subnav_extras").style.display = "inline";
}
}
// set new
var setOver = "nav_"+theItem;
var setSub = "subnav_"+theItem;
document.getElementById(setOver).className="nav_bar_over";
document.getElementById(setSub).style.display = "inline";
if(document.getElementById("subnav_extras")){
document.getElementById("subnav_extras").style.display = "none";
}
}

function navOut(){
for(i=0;i<totolNavs;i++){
var tempItem = "nav_"+ myNavHolder[i][4];
document.getElementById(tempItem).className="nav_bar";
var setSub = "subnav_"+myNavHolder[i][4];
document.getElementById(setSub).style.display = "none";
}
var setSub = "subnav_"+activeNav;
var setNav = "nav_"+activeNav;
document.getElementById(setNav).className="nav_bar";
document.getElementById(setSub).style.display = "none";
if(document.getElementById("subnav_extras")){
document.getElementById("subnav_extras").style.display = "inline";
}
clearInterval(mynavTime);

setMarker();
}

function setMarker(){
if(theMarker!="") {
document.getElementById("nav_"+theMarker).className="nav_bar_over";
document.getElementById("subnav_"+theMarker).style.display = "inline";
if(document.getElementById("subnav_extras")){
document.getElementById("subnav_extras").style.display = "none";
}
}

if(theSubMarker!="") {
document.getElementById("subItem_"+theSubMarker).className="subnav_item_over";
}
}

function checkSubNav(theMarked){
document.getElementById("subItem_"+theMarked).className="subnav_item_over";
}
function checkSubNavOut(theMarked){
document.getElementById("subItem_"+theMarked).className="subnav_item";
if(theSubMarker!="") {
document.getElementById("subItem_"+theSubMarker).className="subnav_item_over";
}
}

function overSubNav(){
if(mynavTime!=""){
clearInterval(mynavTime);
}
}

function goURL(theURL){
document.location.href = theURL;
}

function dynoFields(theTarget,searchText,setBack){
var checkItem = document.getElementById(theTarget).value;
if(checkItem == searchText){
 document.getElementById(theTarget).value = "";
}
if(setBack == "setBack"){
if(checkItem == "" || checkItem == " "){
 document.getElementById(theTarget).value = searchText;
}
}
}

// added 31/04/2008
function showWeather(showLayer,showLink){ document.getElementById("wcape").style.display = "none"; document.getElementById("wdbn").style.display = "none"; document.getElementById("wjhb").style.display = "none";
 document.getElementById("wlcape").className = ''; document.getElementById("wldbn").className = ''; document.getElementById("wljhb").className ='';
 document.getElementById(showLink).className = "blueUnder"; document.getElementById(showLink).blur(); 
 document.getElementById(showLayer).style.display = "inline"; setCookie('iWeather',showLayer,365);}

function initiateWeather(){iWeather=getCookie('iWeather');if (iWeather!=null && iWeather!=""){}else{iWeather = "wcape";}
if(iWeather=="wcape"){ showWeather('wcape','wlcape'); } else if(iWeather=="wdbn"){ showWeather('wdbn','wldbn'); } else if(iWeather=="wjhb"){ showWeather('wjhb','wljhb');}}





function MM_jumpMenuGo(objId,targ,restore){ //v9.0
  var selObj = null;  with (document) { 
  if (getElementById) selObj = getElementById(objId);
  if (selObj) eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0; }
}




function spawn_window(content,spawn,sizing)
{window.open(content,spawn,sizing);}



function startPopEvent(PopEvent)
  {
    var desktop=window.open(PopEvent,"_blank","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,width=600,height=350,resizable");
  }



function startPop(PopEvent)
  {
    var desktop=window.open(PopEvent,"_blank","toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,width=500,height=350,resizable");
  }


 function doIt()
 {
  window.open('http://www.iafrica.com/pls/cms/sharenet_search?sname='+document.form1.sname.value+'&fcode='+document.form1.fcode.value.toUpperCase());
 }
 
digg_bgcolor = '#fff';
digg_skin = 'icon';
digg_window = 'new';



var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

	var v_arr = new Array(4)

	v_arr[1] = "MR";
	v_arr[2] = "ME";
	v_arr[3] = "MC";

	var nxtblock = 2;
	var v_timeout = 13000;

function fade_next()
{
	setuserBlock1(v_arr[nxtblock],'c_userBlock_tag' + nxtblock)
}

$(document).ready(function(){
    $("#c_userBlock_holder").append("<IFRAME SRC=\"http://ad.doubleclick.net/adi/N3643.iafr/B3590720.2;sz=298x120;ord=[timestamp]?\" WIDTH=298 HEIGHT=120 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR='#000000'> <SCRIPT language='JavaScript1.1' SRC=\"http://ad.doubleclick.net/adj/N3643.iafr/B3590720.2;abr=!ie;sz=298x120;ord=[timestamp]?\"> </SCRIPT> <NOSCRIPT> <A HREF=\"http://ad.doubleclick.net/jump/N3643.iafr/B3590720.2;abr=!ie4;abr=!ie5;sz=298x120;ord=[timestamp]?\"> <IMG SRC=\"http://ad.doubleclick.net/ad/N3643.iafr/B3590720.2;abr=!ie4;abr=!ie5;sz=298x120;ord=[timestamp]?\" BORDER=0 WIDTH=298 HEIGHT=120 ALT=\"Click here\"></A> </NOSCRIPT> </IFRAME>");
//	$("#c_userBlock_holder").append("<div id=\"c_tab_advertising\"> <div id=\"ad_outsurance_tag\"> <a href=\"http://ad.doubleclick.net/jump/N3643.iafr/B3590720;sz=298x80;ord=0123456789?\" target=\"_blank\"> <img src=\"http://ad.doubleclick.net/ad/N3643.iafr/B3590720;sz=298x80;ord=0123456789?\" width=\"298\" height=\"80\" border=\"0\" alt=\"Click here\" /></a> </div> <div id=\"ad_outsurance\">  Forz <a href=\"http://www.outsurance.co.za/default.asp?ID=158\" target=\"_blank\">car insurance</a>, <a href=\"http://www.outsurance.co.za/default.asp?ID=364\" target=\"_blank\">home insurance</a> and <a href=\"http://www.outsurance.co.za/default.asp?ID=4\" target=\"_blank\">commercial insurance</a>. </div> </div>");
	tmout = setTimeout("fade_next()", v_timeout);
});

var nfds = 0;
