
/** Rollover Images **/

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
    
    // Beginning of image inserts
    
    //Top Nav
		Home_over = newImage("images/Home-over.jpg");
		Award_over = newImage("images/Award-over.jpg");
		About_Us_over = newImage("images/About_Us-over.jpg");
		Contact_Us_over = newImage("images/Contact_Us-over.jpg");
		
    //Side Nav
		accommodation_over = newImage("images/accommodation-over.jpg");
		adventure_experiences_over = newImage("images/adventure_experiences-over.jpg");
		news_articles_over = newImage("images/news_articles-over.jpg");
		rates_bookings_over = newImage("images/rates_bookings-over.jpg");
		tsitsikamma_forest_birdlife_over = newImage("images/tsitsikamma_forest_birdl-13.jpg");
		links_over = newImage("images/links-over.jpg");
        
     // End of image inserts
     
		preloadFlag = true;
	}
}


/** Drop down menus - Transmenus **/

		function init() {
			if (TransMenu.isSupported()) {
				TransMenu.initialize();
                
//Menu 1
				//menu1.onactivate = function() { document.getElementById("AfricanTravel").className = "other"; };
				//menu1.ondeactivate = function() { document.getElementById("AfricanTravel").className = "other"; };

//Menu 2
				//menu2.onactivate = function() { document.getElementById("About_Us-over").className = "other"; };
				//menu2.ondeactivate = function() { document.getElementById("About_Us-over").className = "other"; };

//Menu 3
				menu3.onactivate = function() { document.getElementById("About_Us").className = ""; };
				menu3.ondeactivate = function() { document.getElementById("About_Us").className = ""; };
				
				
				
				
				
				
				
				
								menu2.onactivate = function() { document.getElementById("Adventure").className = ""; };
				menu2.ondeactivate = function() { document.getElementById("Adventure").className = ""; };

//Menu 4
				//menu4.onactivate = function() { document.getElementById("IndianOceanIslands").className = "other"; };
				//menu4.ondeactivate = function() { document.getElementById("IndianOceanIslands").className = "other"; };


//Menu 5
				//menu5.onactivate = function() { document.getElementById("Honeymoons").className = "other"; };
				//menu5.ondeactivate = function() { document.getElementById("Honeymoons").className = "other"; };

//Menu 6
				//menu6.onactivate = function() { document.getElementById("WorldTravel").className = "other"; };
				//menu6.ondeactivate = function() { document.getElementById("WorldTravel").className = "other"; };
		}
}





/** Pop up Window **/

	var detailsWindow1a;
    var detailsWindow1b;
    var detailsWindow2;
    var timerID1a;
    var timerID1b;
    var timerID2;
    
    function openPortrait(theURL)
	{
    
        clearTimeout(timerID1a);

        detailsWindow1a=window.open (theURL,"PortWindow1a","width=510,height=771");
        detailsWindow1a.focus();

        timerID1a = setTimeout("detailsWindow1a.close()",30000);

       
       
	}
        function openPortrait2(theURL)
	{
		clearTimeout(timerID1b);
         
        detailsWindow1b=window.open (theURL,"PortWindow1b","width=265,height=400");
        detailsWindow1b.focus();

        timerID1b = setTimeout("detailsWindow1b.close()",30000);
        
	}
    function openLandscape(theURL)
	{
		clearTimeout(timerID2);

        detailsWindow2=window.open (theURL,"LandWindow2","width=620,height=620");
        detailsWindow2.focus();

        timerID2 = setTimeout("detailsWindow2.close()",30000);
        
	}

    
    
    
/** Anchor fix with Flash **/

var thisPagePath = removePath(window.location.href);

function removePath(fileName)
{
var fileNameStart = fileName.lastIndexOf("/") + 1;
fileName = fileName.substr(fileNameStart);
return fileName;
}


//function reposition()
//{

var anchorStart = thisPagePath.lastIndexOf("#");
//alert(anchorStart);

if (anchorStart != -1)
{
var anchorPath = thisPagePath.substr(anchorStart);
//alert(anchorPath);

if (document.all) {
setTimeout("window.location.hash = anchorPath;",1000);
}

}
//}
//}





/* Form validate */



function validate_woodcutters()
	{
		
        var data = document.enqForm;
        var txtReturn = "";
        
        var MainInfoFlag = true;
		
        if (data.Name.value == "")
		{
			txtReturn = txtReturn + "\t - Please enter your Name. \n";  
		}
        
        if (data.Surname.value == "")
		{
			txtReturn = txtReturn + "\t - Please enter your Surname. \n";  
		}
          
        // Contact details start  
              
        if ((data.TelW.value == "") && (data.Mobile.value == "") && (data.TelH.value == ""))
		{
			txtReturn = txtReturn + "\t - Please enter your Work Tel No. OR Home Tel No. OR Mobile No. \n";  
		    MainInfoFlag = false;
        }       

        	if (data.Email.value == "")
		{
			txtReturn = txtReturn + "\t - Please enter your Email Address. \n";  
		} 

var EmailCheckFlag = true;
    
	if( (data.Email.value != "") )
	{
	if(data.Email.value.indexOf ("@", 0) == -1 || data.Email.value.indexOf ("." , 0) == -1)
	{
        txtReturn = txtReturn + "\t - Please enter a valid Email Address. \n";
        EmailCheckFlag = false;
	}
    }
    
            if (data.Country.value == "unselected")
		{
			txtReturn = txtReturn + "\t - Please enter your Country. \n";  
		}
            if (data.Contact.value == "unselected")
		{
			txtReturn = txtReturn + "\t - Please enter the method you would prefer to be contacted by. \n";  
		}
            
         //Contact Details end   
              
                
        
        
           //Period of stay                  
              
        var PeriodFlag1 = true;         
        if (data.Day1.value == "unselected" || data.Month1.value == "unselected" || data.Year1.value == "unselected")
		{
			txtReturn = txtReturn + "\t - Please complete your Booking Date. \n";  
            PeriodFlag1 = false;  
		}  
        
          
        // Storms River  

            if (data.numAdults.value == "")
		{
			txtReturn = txtReturn + "\t - Please enter the Number of Adults on your tour. \n";  
		}

            if (data.numKids.value == "")
		{
			txtReturn = txtReturn + "\t - Please enter the Number of Children on your tour. \n";  
		}           
               
       // if (data.chkWoodcutters.checked==false)
		//{
		//	txtReturn = txtReturn + "\t - Please select a Woodcutters Journey with Arrival time \n";  
       // }     
           
		 if (data.chkTerms.checked == false)
		{
			txtReturn = txtReturn + "\t - Please read the terms and conditions and check the check box \n";  
         }           
         

       
           
               
         
        
        //Focus or Submission
		
		if (txtReturn == "")
		{
			data.submit();
		}
		else
        {
        alert ("The information could not be submitted: \r\n\n" + txtReturn);
			
        if (data.Name.value == "" || data.Name.value == "Your name!")
		{
			data.Name.focus(); 
            data.Name.select(); 
            return;
		}

        if (data.Surname.value == "" || data.Surname.value == "Your name!")
		{
			data.Surname.focus(); 
            data.Surname.select(); 
            return;
		}
        else if (data.Email.value == "" || EmailCheckFlag == false)
		{
			data.Email.focus(); 
            data.Email.select(); 
            return;
		}
        else if (data.TelW.value == "" && MainInfoFlag == false)
		{
			data.TelW.focus(); 
            data.TelW.select(); 
            return;
		}
        else if (data.TelH.value == "" && MainInfoFlag == false)
		{
			data.TelH.focus(); 
            data.TelH.select(); 
            return;
		}
        else if (data.Mobile.value == "" && MainInfoFlag == false)
		{
			data.Mobile.focus(); 
            data.Mobile.select();
            return; 
		}
        else if (data.Country.value == "")
		{
			data.Mobile.focus(); 
            data.Mobile.select();
            return; 
		}

        else if (PeriodFlag1 == false)
		{
			data.Day1.focus(); 
            return;
		}

        else if (data.numAdults.value == "")
		{
			data.numAdults.focus(); 
            return;
		}

        else if (data.numKids.value == "")
		{
			data.numKids.focus(); 
            return;
		}

    //    else if (data.chkWoodcutters.value == "")
		//{
			//data.chkWoodcutters.focus(); 
        //    return;
		//}

          
        
        
        
}
		}
		
		
function validate_enquiry()
	{
		
        var data = document.enqForm;
        var txtReturn = "";
        
        var MainInfoFlag = true;
		
        if (data.Name.value == "")
		{
			txtReturn = txtReturn + "\t - Please enter your Name. \n";  
		}
        
        if (data.Surname.value == "")
		{
			txtReturn = txtReturn + "\t - Please enter your Surname. \n";  
		}
          
        // Contact details start  
              
        if (data.TelH.value == "")
		{
			txtReturn = txtReturn + "\t - Please enter your Tel No. \n";  
		    MainInfoFlag = false;
        }       

        	if (data.Email.value == "")
		{
			txtReturn = txtReturn + "\t - Please enter your Email Address. \n";  
		} 

var EmailCheckFlag = true;
    
	if( (data.Email.value != "") )
	{
	if(data.Email.value.indexOf ("@", 0) == -1 || data.Email.value.indexOf ("." , 0) == -1)
	{
        txtReturn = txtReturn + "\t - Please enter a valid Email Address. \n";
        EmailCheckFlag = false;
	}
    }
    
            if (data.Country.value == "unselected")
		{
			txtReturn = txtReturn + "\t - Please enter your Country. \n";  
		}
            if (data.Contact.value == "unselected")
		{
			txtReturn = txtReturn + "\t - Please enter the method you would prefer to be contacted by. \n";  
		}
            
         //Contact Details end   
              
                
        
        
   
        
        //Focus or Submission
		
		if (txtReturn == "")
		{
			data.submit();
		}
		else
        {
        alert ("The information could not be submitted: \r\n\n" + txtReturn);
			
        if (data.Name.value == "" || data.Name.value == "Your name!")
		{
			data.Name.focus(); 
            data.Name.select(); 
            return;
		}

        if (data.Surname.value == "" || data.Surname.value == "Your name!")
		{
			data.Surname.focus(); 
            data.Surname.select(); 
            return;
		}
        else if (data.Email.value == "" || EmailCheckFlag == false)
		{
			data.Email.focus(); 
            data.Email.select(); 
            return;
		}
       else if (data.TelH.value == "" && MainInfoFlag == false)
		{
			data.TelH.focus(); 
            data.TelH.select(); 
            return;
		}
       else if (data.Country.value == "")
		{
			data.Mobile.focus(); 
            data.Mobile.select();
            return; 
		}

             
        
        
}
		}
		
		
		

	
function validate_canopy_booking()
	{
		
        var data = document.enqForm;
        var txtReturn = "";

		 if (data.chkTerms.checked == false)
		{
			txtReturn = txtReturn + "\t - Please read the terms and conditions and check the check box \n";  
         }  
   
        
        //Focus or Submission
		
		if (txtReturn == "")
		{
			//data.submit();
			window.open('https://www.nightsbridge.co.za/bridge/Search?bbid=12251');
		}
		else
        {
        alert ("The information could not be submitted: \r\n\n" + txtReturn);

}
		}
		
		
		
