
function newPetFinderSubmit()
{			
	
     var animal = (document.getElementById("animal")).value;     									   
     var breed = (document.getElementById("breed")).value;
     var age = (document.getElementById("age")).value;
     var size = (document.getElementById("size")).value;
     var gender = (document.getElementById("sex")).value;
     var location = (document.getElementById("location")).value;
     if(location == ""){
     	alert("Plase enter Zip/Postal.")
     	return false;
     }else{
     	var source = '/iams/en_US/jsp/angel2/AdoptAPet_SearchList.jsp?animal='+animal+'&breed=' + breed + '&age='+age + '&size='+size + '&sex=' + gender+'&location=' + location;
     	f = document.getElementById("searchForm");
     	f.action = source;
	  	f.submit();
		addSearchData(animal,breed,age,size,gender,location);		
		
		return true;		
     }     
        
}

function addSearchData(animal,breed,age,size,gender,location){
	//alert('IN addSearchData');
	if(!animal){		
		//animal = 'dog';
		animal = '';
	}	
	Set_Cookie('animal',animal);
	
	if(!breed){		
		breed = '';
	}		
	Set_Cookie('breed',breed);
	
	if(!age){		
		age = '';
	}	
	Set_Cookie('age',age);
	
	if(!size){		
		size = '';
	}
	Set_Cookie('size',size);
	
	
	if(!gender){		
		gender = '';
	}
	Set_Cookie('gender',gender);
	
	if(!location){		
		location = '';
	}
	Set_Cookie('location',location);
	
	//alert('OUT addSearchData');
	
}

function newLoadSearchData()
{
	 //alert("IN laod data");
	 var cookieData='';
	 var animal = (document.getElementById("animal"));     									   
     var breed = (document.getElementById("breed"));
     var age = (document.getElementById("age"));
     var size = (document.getElementById("size"));
     var gender = (document.getElementById("sex"));
     var location = (document.getElementById("location"));	
     
    
    if(animal){
     	cookieData = Get_Cookie('animal');  
     	//alert(cookieData);
     	if(cookieData == null || cookieData =='null'){
				//cookieData = 'dog';
				cookieData = '';
		}		
     	animal.value = cookieData;   	
     }    
     
     if(breed){
     	cookieData = Get_Cookie('breed');  
     	//alert(cookieData);
     	if(cookieData == null || cookieData =='null'){
				cookieData = '';
		}
     	breed.value = cookieData;
     }
     
     if(age){
     	cookieData = Get_Cookie('age');  
     	//alert(cookieData);
     	if(cookieData == null || cookieData =='null'){
				cookieData = '';
		}
     	age.value = cookieData ;     	
     }
     
     if(size){
     	cookieData = Get_Cookie('size');  
     	//alert(cookieData);
     	if(cookieData == null || cookieData =='null'){
				cookieData = '';
		}
     	size.value = cookieData;     	
     }
     
     if(gender){
     	cookieData = Get_Cookie('gender');  
     	//alert(cookieData);
     	if(cookieData == null || cookieData =='null'){
				cookieData = '';
		}
     	gender.value = cookieData; 
     }
     
     if(location){
     	cookieData = Get_Cookie('location');  
     	//alert(cookieData);
     	if(cookieData == null || cookieData =='null'){
				cookieData = '';
		}		
     	location.value = cookieData;    	
     } 
	 //alert("out laod data");		
}



