// JavaScript Document
/*
This script has been developed by:
Name: 		Deon Pheiffer
Company: 	Private

This is a javascript to vailidate which browser version is currently been used
Add this script to the top of your page

This script validates which browser it needs to run the script, It
will pass a value of (strPass) as true OR false so just validate
this varible to parse what ever.

In the body tag of the html file call it by adding this
statement;
onload="checkBrowser();"
*/


//Set these 2 varibles for IE and Mozzila firefox
//minMIE = Microsoft Interet Explorer 7
//minNet = Netscape (Mozilla Firefox)
	var minMIE = 6;
	var minNet = 5;
	
	///////////////////////////////////////////////////////////////////////
	//NO NEED TO EDIT BETWEEN THESE LINE THIS LINE
	///////////////////////////////////////////////////////////////////////
	//This section picks up all browser varibles
	this.name = navigator.appName;
	this.codename = navigator.appCodeName;
	this.version = navigator.appVersion
	this.platform = navigator.platform;
	this.javaEnabled = navigator.javaEnabled();
	this.screenWidth = screen.width;
	this.screenHeight = screen.height;
	
	var strPass = true;
	var Platform = this.platform;
	
	if(this.name = "Microsoft Internet Explorer")
		{	
			var version = parseInt(this.version.indexOf("MSIE")+5);
			var versionNumber =	parseInt(navigator.appVersion.substring(version,25));
			if(versionNumber < minMIE)
				{strPass=false;}
		}
	else if (this.name = "Netscape")
		{
			var versionNumber =	navigator.appVersion.substring(0,4);
			if(versionNumber < minNet){var strPass=false;}
		}
	///////////////////////////////////////////////////////////////////////
	//END OF NON-EDITABLE REGION
	///////////////////////////////////////////////////////////////////////
	
	//this checks and sees if the latest version specified at the top
	//are working, just comment this out if you don't want the pop-up boxes
	//if(strPass){
		//alert(strPass + "This browser can vaildate!");	
	//}else{
		//alert(strPass + "This browser cannot vaildate!")
	//}
//******END SCRIPT******************	

function ValidateRegForm(){
			<!--
			var valid = false
			var name = document.subscribeform.name.value
			var surname = document.subscribeform.surname.value
			var email = document.subscribeform.email.value
		
			if (email == ""){
			
				alert ("Please supply a vaild email address!")
				return valid;
			}
			else{
				//check if the address has certain information
					if (email.indexOf("@") == -1 || email.indexOf(".") == -1) 
					{
						alert("Email address is not valid!");
						return valid;
					}
			}	
			
			if (surname == ""){
			
				alert ("Please supply a vaild surname!")
				return valid;
			
			}
			
			if (name == ""){
			
				alert ("Please supply a vaild name!")
				return valid;
			
			}
			//-->
		}


		//Step 2: Define a "callback" function to process the data returned by the Ajax request:
		function processGetPost()
		{
			var myajax=ajaxpack.ajaxobj
			var myfiletype=ajaxpack.filetype
			
			if (myajax.readyState == 4)
				{ //if request of file completed
				if (myajax.status==200 || window.location.href.indexOf("http")==-1)
					{ //if request was successful or running script locally
						if (myfiletype=="txt")
							//alert(myajax.responseText)
							document.getElementById("middlecontent").innerHTML = myajax.responseText
						else
							alert(myajax.responseXML)
						}

			}
				else if (myajax.readyState == 1)
				{ //if request of file is still loading
					//document.getElementById("middlecontent").innerHTML = "Loading Content..."
					document.getElementById("middlecontent").innerHTML = "<img src='images/loading.gif'></img>"
				}
				else if (myajax.readyState == 0)
				{ //if request of file completed
					document.getElementById("middlecontent").innerHTML = "Content Failed to load."
				}
		}
		
		function processGetVideo()
		{
			var myajax=ajaxpack.ajaxobj
			var myfiletype=ajaxpack.filetype
			
			if (myajax.readyState == 4)
				{ //if request of file completed
				if (myajax.status==200 || window.location.href.indexOf("http")==-1)
						{ //if request was successful or running script locally
						if (myfiletype=="txt")
							//alert(myajax.responseText)
							document.getElementById("testimonials").innerHTML = myajax.responseText
						else
							alert(myajax.responseXML)
						}
					}
				else if (myajax.readyState == 1)
				{ //if request of file completed
					document.getElementById("testimonials").innerHTML = "<img src='images/loading.gif'></img>"
				}
		}
		
		
		
		function processGetSub()
		{
			var myajax=ajaxpack.ajaxobj
			var myfiletype=ajaxpack.filetype
			
			if (myajax.readyState == 4)
				{ //if request of file completed
				if (myajax.status==200 || window.location.href.indexOf("http")==-1)
						{ //if request was successful or running script locally
						if (myfiletype=="txt")
							//alert(myajax.responseText)
							document.getElementById("InnerPageContent").innerHTML = myajax.responseText
						else
							alert(myajax.responseXML)
						}
					}
				else if (myajax.readyState == 1)
				{ //if request of file completed
					document.getElementById("InnerPageContent").innerHTML = "<img src='images/loading.gif'></img>"
				}
		}
		
		
		
		//preload the images
		if (document.images)
		{
		  preload_image_object = new Image();
		  // set image url
		  image_url = new Array();
		  image_url[0] = "images/leftNavigation/whatNedbankCanOffer_over.jpg";
		  image_url[1] = "images/leftNavigation/aboutFranchising_over.jpg";
		  image_url[2] = "images/leftNavigation/franchisors_over.jpg";
		  image_url[3] = "images/leftNavigation/franchisees_over.jpg";
		  image_url[4] = "images/leftNavigation/contactUs_over.jpg";
		  image_url[5] = "images/leftNavigation/legalInformation_over.jpg";
		  image_url[6] = "images/subnavigation/financeSolutions_over.jpg";
		  image_url[7] = "images/subnavigation/transactional_over.jpg";
		  image_url[8] = "images/subnavigation/valueAdded_over.jpg";
		  image_url[9] = "images/leftNavigation/legalInformation_over.jpg";
	
		   var e = 0;
		   for(e=0; e<=8; e++){ 
			 preload_image_object.src = image_url[e];
			}
			 //alert("Images loaded ("+ image_url[e] + ")");
		}
	
		//Left side menu bar
		//Image ID's
		var imageids = new Array();
		imageids[0] = "what";
		imageids[1] = "about";
		imageids[2] = "franchisors";
		imageids[3] = "franchisees";
		imageids[4] = "contacts";
		imageids[5] = "legal";
		imageids[6] = "faq";
			
		var imageSRC = new Array();
		imageSRC[0] = "images/leftNavigation/whatNedbankCanOffer_out.jpg";
		imageSRC[1] = "images/leftNavigation/aboutFranchising_out.jpg";
		imageSRC[2] = "images/leftNavigation/franchisors_out.jpg";
		imageSRC[3] = "images/leftNavigation/franchisees_out.jpg";
		imageSRC[4] = "images/leftNavigation/contactUs_out.jpg";
		imageSRC[5] = "images/leftNavigation/legalInformation_out.jpg";
		imageSRC[6] = "images/leftNavigation/legalInformation_out.jpg";
		
		//Right side menu bar
		var Rightimageids = new Array();
		Rightimageids[1] = "testimonialsbutton";
		//Rightimageids[1] = "mailinglistbutton";
		Rightimageids[2] = "interestinglinksbutton";
		Rightimageids[3] = "toolsbutton";
		
		var RightimageSRC = new Array();
		RightimageSRC[1] = "images/rightNavigation/testimonials_out.jpg";
		//RightimageSRC[1] = "images/rightNavigation/joinMailingList_out.jpg";
		RightimageSRC[2] = "images/rightNavigation/interestingLinks_out.jpg";
		RightimageSRC[3] = "images/rightNavigation/tools_out.jpg";
		
		function Swapimageright(rightimageRollname, rightimageid)
		{
			
		if(strPass){
					//loop through the recordset and change the images			
					for (z=1; z<=3; z++)
					{
					
						if (Rightimageids[z]==rightimageid)
							{
								document.getElementById(rightimageid).src = rightimageRollname;
							}
						else
							{
								document.getElementById(Rightimageids[z]).src = RightimageSRC[z];
							}
					}
				
		}
}
		
function Swapimage(imageRollname, imageid)
		{
if(strPass){
			//loop through the recordset and change the images			
			for (i=0; i<=5; i++)
			{
			
				if (imageids[i]==imageid)
					{
						document.getElementById(imageid).src = imageRollname;
					}
				else
					{
						document.getElementById(imageids[i]).src = imageSRC[i];
					}
			}
		}
}
		
		
		//Right side menu bar
		var subimageids = new Array();
		subimageids[0] = "valueadded";
		subimageids[1] = "transactional";
		subimageids[2] = "finance";
		
		var SubImage = new Array();
		SubImage[0] = "images/subnavigation/valueAdded_out.jpg";
		SubImage[1] = "images/subnavigation/transactional_out.jpg";
		SubImage[2] = "images/subnavigation/financeSolutions_out.jpg";

	function SwapSubmenu(subRollname, subid)
		{
if(strPass){
			//loop through the recordset and change the images			
			for (q=0; q<=2; q++)
			{
			
				if (subimageids[q]==subid)
					{
						document.getElementById(subid).src = subRollname;
					}
				else
					{
						document.getElementById(subimageids[q]).src = SubImage[q];
					}
			
			}
		
		}
}
function printpage(){
window.print();}




function ExpandDV(arrowbutton)
{
		Currentheight = document.getElementById("testimonials").style.height;
		//alert(Currentheight);
		
		if (Currentheight == "263px")
		{
			document.getElementById("testimonials").style.height = "282px";
			collapse1.slideup()
		}
		
		else if (Currentheight == "0px")
		{
			collapse1.slideup()
		}
		else if (Currentheight == "282px")
		{
			document.getElementById("testimonials").style.height = "263px";
			collapse1.slideup()
		}
		
}
	
	
	
	
	
	
	
