


$(function() { 
    $('h4').media(function(el, options) { 
        options.caption = false; 
        options.height = '40px'; 
        options.width = '295px';
        options.src = '/flash/h4.swf'; 
        options.flashvars.txt = $(el).text(); 
    }); 
});


$(function() { 
    $('h5').media(function(el, options) { 
        options.caption = false; 
        options.height = '25px'; 
        options.width = '295px';
        options.src = '/flash/h2.swf'; 
        options.flashvars.txt = $(el).text(); 
   }); 

});

function ajaxFunction(a)
	{  
	var xmlHttp;
	try
		{    
  		// Firefox, Opera 8.0+, Safari   
		xmlHttp=new XMLHttpRequest();
  		}
	catch (e)
		{    
		// Internet Explorer    
		try
			{     
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      	
			}
		catch (e)
      		{
	  		try
       			{        
	   			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
	   			}
     		catch (e)
        		{        
				alert("Your browser does not support AJAX!");        
				return false;        
				}      
			}    
		}
		xmlHttp.onreadystatechange=function()
  			{
     		if(xmlHttp.readyState==4)
        		{
				setDivContents("dropdown",xmlHttp.responseText)

       			}
			}
			xmlHttp.open("GET","/ajax/projects.jsp?id="+a,true);
    		xmlHttp.send(null);  
		}

/* sets the html content of a specified DIV id - cross browser compatible */
function setDivContents(divName, string){
//salert(string);
	var type	=	getBrowser();
	var obj		=	getObjectReference(divName);
	if(type == "IE"){
		obj.innerHTML	=	string;
	}else if(type == "NN"){
		obj.document.open();
		obj.document.write(string);
		obj.document.close();
	}else if(type == "MO" || type == "OP"){
		obj.innerHTML	=	string;
	}
}

/* Returns the type of browser on the client side */
function getBrowser(){
	var type	=	"IE";//set the default type according to most common
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById){
		type	=	"OP";
	}
	if (document.all){
		type	=	"IE";
	}
	if (document.layers){
		type	=	"NN";
	}
	if (!document.all && document.getElementById){
		type	=	"MO";
	}
	return type;
}

/* get object reference according to browser - mainly used for styling objects */
function getObjectReference(divName){
	var type	=	getBrowser();
	var object	=	false;
	if(type == "IE"){
		object = document.getElementById(divName);
		//object = document.all[divName];
	}else if(type == "NN"){
		object = document.layers[divName];
	}else if(type == "MO" || type == "OP"){
		object = document.getElementById(divName);
	}
	return object;
}



function validateFilter(a){
	var isValid = false
	for(x=0; x<a.length;x++){
		if(a[x].checked == true){
			isValid = true
		}
	}
	if(isValid==false){
		alert("Please select at least one camp for the filter");
	}else{
		document.campFilter.submit();
	}
}


function validateEnquiry(a){
	if(a.travel[0].checked==false && a.travel[1].checked==false){
		alert("Please specify if you have traveled with Wilderness Safaris in the past.");	
	}else if(a.travel[0].checked==true && a.tourcompany.value==""){
		alert("Please specify the tour company you travelled with.");
		a.tourcompany.focus();
	}else if (a.fullname.value==""){
		alert("Please enter your full name.");	
		a.fullname.focus();
	}else if(a.country.selectedIndex==0){
		alert("Please select your country of residence.");	
		
	}else if (a.address1.value==""){
		alert("Please enter mailing address.");	
		a.address1.focus();
	}else if (a.city.value==""){
		alert("Please enter your city.");	
		a.city.focus();
	}else if (a.zip.value==""){
		alert("Please enter your zip/postal code.");	
		a.zip.focus();
	}else if (a.province.value==""){
		alert("Please enter your province.");	
		a.province.focus();
	}else if (a.email.value==""){
		alert("Please enter your email address.");	
		a.email.focus();
	}else if(a.Home.value=="" && a.Work.value=="" && a.Cell.value==""){
		alert("Please enter a contact number");		
		
	}else{
		a.submit();	
	}

	
	
}

function go(a){
	if(a.selectedIndex>0){
		location=a.value
	}
}
         


