<!-- HIDE SCRIPT FROM OLD BROWSERS
var IE, timer;
IE = (document.all) ? 1 : 0;

function imgover(imgname)
{
	imgname.src = 'images/'+imgname.name+'_ro.gif';
	hideMenu1(2);
	showMenu1(imgname.name);
	clearTimeout(timer);
}

function imgout(imgname)
{
	imgname.src = "images/"+imgname.name+".gif";
//	timerImg = setTimeout('hideImg(this.name)', 500);
	timer = setTimeout('hideMenu1(1)', 1000);
}

function hideImg(imgname)
{
	alert(imgname);
//	imgname.src = "images/"+imgname.name+".gif";
}
		
function doMenu(option)
{
	alert(option.name);
}

function doRO(obj,act)
{
	switch (act)
	{
	case 0:
	//	obj.style.backgroundColor='d0d0d0';
		obj.style.backgroundColor='E9D3B0';
	//	obj.style.color='red';
		break;
	case 1:
	//	obj.style.color='';
		obj.style.backgroundColor='';
		window.status='';
		break;
	}
}

function menuText(nextMenu,imgnum,optionNo,optionVal)
{
	optionValSplit = optionVal.split(",");
	if (optionValSplit.length < 2) { optionValSplit[1] = ""; optionValSplit[2] = "0"; }
	if (optionValSplit[1] == "") { linkText = ""; cursorText = ""; statusText=""; } else { linkText = "onclick='javascript:goHere(&quot;"+optionValSplit[1]+"&quot;);'"; cursorText = "style='cursor:hand;'"; statusText="window.status=&quot;"+optionValSplit[0]+"&quot;";  } // style='color:#004178;'
	if (optionValSplit[2] == "0") { showMenuText = ""; showArrowText = "&nbsp;"; } else { showMenuText = "showMenu"+nextMenu+"("+imgnum+","+optionNo+");"; showArrowText = "<img src='IMAGES/menu_left_arrow.gif' width=14 height=15 border=0>"; }
	var menuTextVal = "<tr onmouseover='javascript:doRO(this,0);hideMenu1("+nextMenu+");"+showMenuText+" "+statusText+"' onmouseout='javascript:doRO(this,1);' "+linkText+"><td class='menu' width='14'>"+showArrowText+"</td><td class='menu' "+cursorText+">"+optionValSplit[0]+"</td></tr>";
//	alert(menuTextVal);
	return menuTextVal;
}

function showMenu1(imgname)
{
	var options = new Array();
	var menu1text = new String("");
	var imgnum = imgname.charAt(imgname.length - 1);
	switch (imgname)
	{
	case "option01":
		options[0] = "Civic (Citizens),services_citizens.asp,1";
		options[1] = "Immigration(Foreigners),services_foreigners.asp,1";
		options[2] = "Guidelines,guidelines.asp,0";
		options[3] = "Specifications,specs.asp,0";
	//	options[4] = "Tariffs";
		newPosy=72;
		break;
	case "option02":
	    
		//options[0] = "Talk to us,contact_form.asp,0";
		options[0] = "Contact details,contact.asp,0";
		options[1] = "Regions & offices,regions.asp,1";
		options[2] = "Ports of entry,ports_entry.asp,1";
		options[3] = "Missions abroad,missions_abroad.asp,0";
		options[4] = "Hotlines for enquiries: Immigration Act 2002,immigration_hotlines.asp,0";
		newPosy=88;
		break;
	case "option03":
		options[0] = "Official forms & documents,forms.asp,1";
		options[1] = "Important Acts,important_acts.asp,0";
		options[2] = "Draft legislation,legislation_draft.asp,0";
	//	options[3] = "Consular Code ??";
		newPosy=104;
		break;
	case "option04":
		options[0] = "Vision & Mission,vision_mission.asp,0";
		options[1] = "Organisational structure,organ_structure.asp,0";
		options[2] = "Strategic Plan,strat_plan.asp,0";
		options[3] = "Leadership,ministry.asp,0";
		options[4] = "Statutory Bodies,stat_bodies.asp,0";
		options[5] = "Vacancies,vacancy_view.asp,0";
		newPosy=120;
		break;
	case "option05":
		//options[0] = "HANIS,projects.asp#project2,0";
		options[0] = "Projects,dha_projects.asp,0";
		newPosy=136;
		break;
	case "option06":
		options[0] = "Frequently Asked Questions,faq.asp,0";
		options[1] = "Search,search.asp,0";
		options[2] = "Related links,rel_links.asp,0";
		options[3] = "Site map,sitemap.asp,0";
		options[4] = "Public Holidays,holidays.asp,0";
		options[5] = "Disclaimer,disclaimer.asp,0";
		newPosy=152;
		break;
	case "option07":
		options[0] = "Media releases,media_releases.asp,0";
		options[1] = "Speeches,speeches.asp,0";
		options[2] = "General Notices,notices.asp,0";
		options[3] = "Presentations,presentations.asp,0";
		newPosy=168;
		break;
	}
	
	for (var x = 0; x < options.length; x++)
	{
		var y = x + 1;
		var menuTextVal = menuText(2,imgnum,y,options[x]);
		menu1text = menu1text+menuTextVal;
	}
	
	switch (IE)
	{
	case 1:
	//	if (document.body.scrollTop > 81) { newPosy = newPosy + (document.body.scrollTop - 81); }
		document.all['menu1'].style.top=""+newPosy+"px";
		document.all['menu1'].innerHTML="<table border='0' width='100%' cellpadding='1' cellspacing='0' bordercolor='black'>"+menu1text+"</table>";
		document.all['menu1'].style.visibility="visible";
		break;
	case 0:
		document.menu1.top=newPosy;
		document.menu1.document.open();
		document.menu1.document.write("<table border='0' width='140' cellpadding='0' cellspacing='0' bordercolor='black' bgcolor='White'>"+menu1text+"</table>");
		document.menu1.document.close();
		document.menu1.visibility="show";
		break;
	}
}

function showMenu2(a,b)
{
//	alert(obj.name);
	var options = new Array();
	var menu2text = new String("");
//	var imgname = obj.name
//	var imgnum = imgname.charAt(imgname.length - 1);
	
	switch (a)
	{
	case 1:
		switch (b)
		{
		case 1:
		//	menu2text = "<tr onmouseover='javascript:doRO(this,0);showMenu3(this,1);' onmouseout='javascript:doRO(this,1);'><td class='menu' width='15'><img src='IMAGES/menu_left_arrow.gif' width=14 height=15 border=0></td><td class='menu'>Citizens</td></tr><tr onmouseover='javascript:doRO(this,0);showMenu3(this,2);' onmouseout='javascript:doRO(this,1);'><td class='menu' width='15'><img src='IMAGES/menu_left_arrow.gif' width=14 height=15 border=0></td><td class='menu'>Citizens</td></tr>";
			options[0] = "Identity,services_citizens.asp?topic=identity,0";
			options[1] = "Travel documents,services_citizens.asp?topic=travel,0";
			options[2] = "Citizenship,services_citizens.asp?topic=Citizenship,0";
			options[3] = "Birth,services_citizens.asp?topic=Birth,0";
			options[4] = "Adoption,services_citizens.asp?topic=Adoption,0";
			options[5] = "Marriage,services_citizens.asp?topic=Marriage,0";
			options[6] = "Death,services_citizens.asp?topic=Death,0";
			options[7] = "Amendments,services_citizens.asp?topic=Amendments,0";
			addY = 0;
			break;
		case 2:
			options[0] = "Visas,services_foreigners.asp?topic=visas,0";
			options[1] = "Temporary residence,services_foreigners.asp?topic=temp,0";
			options[2] = "Permanent residence,services_foreigners.asp?topic=permanent,0";
			options[3] = "Refugees & asylum,services_foreigners.asp?topic=refugee,0";
			addY = 18;
			break;
		}
		break;
	case 2:
		switch (b)
		{
		case 1:
			options[0] = "test21";
			addY = 0;
			break;
		case 3:
			options[0] = "Eastern Cape,regional_offices.asp?region=1,0";
			options[1] = "Free State,regional_offices.asp?region=2,0";
			options[2] = "Gauteng East,regional_offices.asp?region=3,0";
			options[3] = "Gauteng West,regional_offices.asp?region=4,0";
			options[4] = "KwaZulu-Natal,regional_offices.asp?region=5,0";
			options[5] = "Mpumalanga,regional_offices.asp?region=6,0";
			options[6] = "Northern Cape,regional_offices.asp?region=7,0";
			options[7] = "Limpopo Province,regional_offices.asp?region=8,0";
			options[8] = "North West,regional_offices.asp?region=9,0";
			options[9] = "Western Cape,regional_offices.asp?region=10,0";
			addY = 32;
			break;
		case 4:
			options[0] = "Land border posts,land_border_posts.asp,0";
			options[1] = "Airports,airports.asp,0";
			options[2] = "Harbours,harbours.asp,0";
			addY = 50;
			break;
		}
		break;
	case 3:
		switch (b)
		{
		case 1:
			options[0] = "Identity,forms.asp?topic=identity,0";
			options[1] = "Travel documents,forms.asp?topic=travel,0";
			options[2] = "Citizenship,forms.asp?topic=Citizenship,0";
			options[3] = "Birth,forms.asp?topic=Birth,0";
			options[4] = "Marriage,forms.asp?topic=Marriage,0";
			options[5] = "Death,forms.asp?topic=Death,0";
			options[6] = "Amendments,forms.asp?topic=Amendments,0";
			options[7] = "Visas,forms.asp?topic=visas,0";
			options[8] = "Temporary residence,forms.asp?topic=temp,0";
			options[9] = "Permanent residence,forms.asp?topic=permanent,0";
			addY = 0;
			break;
		}
		break;
	case 4:
		switch (b)
		{
		case 5:
			options[0] = "Civic Services,civic_services.asp,0";
			options[1] = "Immigration Services,migration_services.asp,0";
			options[2] = "Management Services,management_services.asp,0";
			options[3] = "Human Resources,hr.asp,0";
			options[4] = "Legal Services,legal_services.asp,0";
			options[5] = "Financial Management,fin_management.asp,0";
			//options[6] = "Information Technology,it.asp,0";
			//options[7] = "Government Printing Works,gov_printing_works.asp,0";
			addY = 64;
			break;
		}
		break;
	}
	
	for (var x = 0; x < options.length; x++)
	{
		var y = x + 1;
		var menuTextVal = menuText(3,b,y,options[x]);
		menu2text = menu2text+menuTextVal;
	}
	
	newPosy = document.all['menu1'].style.posTop + 3 + addY;
	document.all['menu2'].style.top=""+newPosy+"px";
	document.all['menu2'].innerHTML="<table border='0' width='100%' cellpadding='1' cellspacing='0' bordercolor='black'>"+menu2text+"</table>";
	document.all['menu2'].style.visibility="visible";
}

function showMenu3(obj,a,b,c)
{
	switch (a)
	{
	case 1:
		menu3text = "<tr onmouseover='javascript:doRO(this,0);' onmouseout='javascript:doRO(this,1);'><td class='menu' width='15'>&nbsp;</td><td class='menu'>Citizens</td></tr>";
		addY = 0;
		break;
	case 2:
		menu3text = "<tr onmouseover='javascript:doRO(this,0);' onmouseout='javascript:doRO(this,1);'><td class='menu' width='15'>&nbsp;</td><td class='menu'>Citizens</td></tr>";
		addY = 18;
		break;
	}
	
	newPosy = document.all['menu2'].style.posTop + 3 + addY;
	document.all['menu3'].style.top=""+newPosy+"px";
	document.all['menu3'].innerHTML="<table border='0' width='100%' cellpadding='1' cellspacing='0' bordercolor='black'>"+menu3text+"</table>";
	document.all['menu3'].style.visibility="visible";
}

function hideMenu1(x,imgname)
{
	switch (IE)
	{
	case 1:
		if (x < 2) { document.all['menu1'].style.visibility="hidden"; }
		if (x < 3) { document.all['menu2'].style.visibility="hidden"; }
		if (x < 4) { document.all['menu3'].style.visibility="hidden"; }
		break;
	case 0:
		if (x < 2) { document.menu1.visibility="hide"; }
	//	if (x < 3) { document.menu2.visibility="hide"; }
	//	if (x < 4) { document.menu3.visibility="hide"; }
		break;
	}

}

function doPosi()
{
	switch (IE)
	{
	case 1:
		pWidth = document.body.clientWidth;
		document.all['menu1'].style.left = (pWidth - 130 - 158);
		document.all['menu2'].style.left = (pWidth - 128 - 158 - 158);
		document.all['menu3'].style.left = (pWidth - 126 - 158 - 158 - 138);
		
		doScroll();
		
		var photoDiv = eval("'"+document.all.photo+"'")
		if (photoDiv != "undefined"){
			if (pWidth < 750){
				document.all.photo.style.visibility="hidden";
			}
			else{
				document.all.photo.style.visibility="visible";
			}
		}
		
		break;
	case 0:
		pWidth = window.innerWidth;
		document.menu1.left = (pWidth - 145 - 138);
		break;
	}
}

function doPosiExtra()
{
	switch (IE)
	{
	case 1:
		pWidth = document.body.clientWidth
		document.all['extra'].style.left = (pWidth - 135);
		break;
	case 0:
		pWidth = window.innerWidth;
		document.extra.left = (pWidth - 145);
		break;
	}
}

function doPrint()
{
	wloc = ''+window.location;
//	verander hier sodat URL vars reg hanteer word en dat 'n nuwe window oopmaak
	locArray = wloc.split("#");
	locArray2 = locArray[0].split("?");
//	IE = (document.all) ? 1 : 0;
	urlVars = (locArray2.length > 1) ? locArray2[1]+'&print=1' : 'print=1';
//	alert(locArray2[0]+'?'+urlVars);
	var newWin = open(''+locArray2[0]+'?'+urlVars,'print','height=200,width=200,titlebar=0,dependent=1');
}

//function doLoad(x) { if (x==1) { window.print(); window.close(); } else { doPosi(); }}
function doLoad(x,y) { if (x==1) { window.print(); window.close(); } else { doFocus(y); }}
function doBlur(x) { if (x==1) { window.close();}}

function doFocus(y)
{
	if (IE == 1) 
	{
		wloc = ''+window.location
		if (wloc.indexOf("contact_form.asp") > 0)
		{
			//actionVar = ''+y
			//alert(actionVar);
			if (y == 0) { document.forms['talktous'].elements['name'].focus(); }
		}
		else 
			{ 
			//	alert(wloc.indexOf("#"));
				if (wloc.indexOf("#") < 1) { document.forms['search'].elements['keywords'].focus(); }
			}
	}
}

function goBack()
{
	alert(window.referer);
//	window.location = ''+window.referer;
}

function goHere(x)
{
//	if (y==1) { x = ""+x+" target='_blank'"; }
//	alert(x);
//	hideMenu(1);

//	window.location = x;

	var curHost = document.location.host;
	//alert('http://'+curHost+'/'+x);
	document.location = 'http://'+document.location.host+'/'+x;
}

function doRegion(x)
{
	var newMap = new String("");
	newMap = (x!=0) ? "images/maps/sa_map_provinces_"+x+".gif" : "images/maps/sa_map_provinces.gif";
//	alert(newMap);
	if (IE == 1) { document.all['map'].src=''+newMap; } else { document.map.src=''+newMap; }
}

function doScroll()
{
	if (document.all['extra'])
	{
		if (document.body.scrollTop < 190)
			document.all['extra'].style.pixelTop = 190;
		else
		{
			maxScroll = document.body.scrollHeight - 120 - document.all['extra'].clientHeight;
			if (document.body.scrollTop < maxScroll)
				document.all['extra'].style.pixelTop = (document.body.scrollTop);
			else { document.all['extra'].style.pixelTop = (document.body.scrollHeight - 120 - document.all['extra'].clientHeight) }
		}
	}
//	window.status = document.all['extra'].style.pixelTop+' '+document.all['extra'].clientHeight;
}

function doSearch(canReturn)
{
	var canSubmit = 0;
	var fieldVal = new String("" + document.forms['search'].elements['keywords'].value);
	if (fieldVal == "")
	{
		alert('Please enter a term or phrase to search for.\r\n\r\nTip: Enclose phrases in quotation marks, e.g. \"identity document\".');
		document.forms['search'].elements['keywords'].focus();
		if (canReturn == 1)
		{
			return false;
		} 
	}
	else { canSubmit = 1; }
	
	if (canSubmit == 1)
	{
		document.forms['search'].submit();
	}
}


function errorMail()
{
	wloc = ''+window.location
	locArray = wloc.split(";");
//	alert(locArray[1]);
	window.location = 'http://www.home-affairs.gov.za/contact_form.asp?id=master&subject=Details of error&errorDetail=Page: '+locArray[1];
}

// END HIDING FROM OLD BROWSERS -->
