/*GLOBAL OBJECTS*/
	//FORUM ELEMENTS
	var obj2D,obj7D,obj30D,objDay,objMonth,objYear,objInclude,objName,objHome,objKeyword,objPosition,objSearch;

	//HIGHLIGHT OBJECTS
	var hQuick,hAdvanced,hDeath,hInclude,hName,hHome,hKeyword;


	function loadObjects(){
		obj2D=(document.getElementById) ? document.getElementById('byesterday') : eval("document.all['byesterday']");
		obj7D=(document.getElementById) ? document.getElementById('b7days') : eval("document.all['b7days']");
		obj30D=(document.getElementById) ? document.getElementById('b30days') : eval("document.all['b30days']");
		
		objDay=(document.getElementById) ? document.getElementById('date') : eval("document.all['date']");
		if( objDay == null){objDay=document.search.date;}

		objMonth=(document.getElementById) ? document.getElementById('month') : eval("document.all['month']");
		if( objMonth == null){objMonth=document.search.month;}

		objYear=(document.getElementById) ? document.getElementById('year') : eval("document.all['year']");
		if( objYear == null){objYear=document.search.month;}

		objInclude=(document.getElementById) ? document.getElementById('include') : eval("document.all['include']");
		if( objInclude == null){objInclude=document.search.include;}

		objName=(document.getElementById) ? document.getElementById('lastname') : eval("document.all['lastname']");
		if( objName == null){objName=document.search.lastname;}

		objHome=(document.getElementById) ? document.getElementById('home') : eval("document.all['home']");
		if( objHome == null){objMonth=document.search.home;}

		objKeyword=(document.getElementById) ? document.getElementById('keyword') : eval("document.all['keyword']");
		if( objKeyword == null){objKeyword=document.search.keyworth;}

		objPosition=(document.getElementById) ? document.getElementById('position') : eval("document.all['position']");
		if( objPosition == null){objPosition=document.search.position;}

		objSearch=(document.getElementById) ? document.getElementById('searchtype') : eval("document.all['searchtype']");
		if( objSearch == null){objSearch=document.search.searchtype;}

			hQuick=(document.getElementById) ? document.getElementById('q_srch') : eval("document.all['q_srch']");
			hAdvanced=(document.getElementById) ? document.getElementById('adv_srch') : eval("document.all['adv_srch']");
			hDeath=(document.getElementById) ? document.getElementById('death_area') : eval("document.all['death_area']");
			hInclude=(document.getElementById) ? document.getElementById('include_area') : eval("document.all['include_area']");
			hName=(document.getElementById) ? document.getElementById('name_area') : eval("document.all['name_area']");
			hHome=(document.getElementById) ? document.getElementById('home_area') : eval("document.all['home_area']");
			hKeyword=(document.getElementById) ? document.getElementById('keyword_area') : eval("document.all['keyword_area']");
	}	


	function setType(str){
		/*EVERY CLICK RESETS THE SEARCH*/
		objPosition.value=1;
		if( str=="adv" ){
			if(hQuick.src!="http://www.lifestorynet.com/image/search/s1out.jpg"){hQuick.src="http://www.lifestorynet.com/image/search/s1out.jpg";}
			if(hAdvanced.src!="http://www.lifestorynet.com/image/search/s2on.jpg"){hAdvanced.src="http://www.lifestorynet.com/image/search/s2on.jpg";}
			if(hDeath.className!="ds"){hDeath.className="ds";}
			if(hInclude.className!="is"){hInclude.className="is";}
				if(objInclude.value=="lifetails"){objHome.value=0;}
				if(objName.value.length>=1){if(hName.className!="ns"){hName.className="ns";}}
				else{hName.className="notselected";}
				if(objHome.value>=1){if(hHome.className!="hs"){hHome.className="hs";}}
				else{hHome.className="notselected";}
				if(objKeyword.value.length>=1){if(hKeyword.className!="ks"){hKeyword.className="ks";}}
				else{hKeyword.className="notselected";}

			if(objYear.style.display=="none" && obj2D.src!="http://www.lifestorynet.com/image/search/selectoption.gif" && obj30D.src!="http://www.lifestorynet.com/image/search/selectoption.gif"){
				obj2D.src="http://www.lifestorynet.com/image/search/option.gif";
				obj7D.src="http://www.lifestorynet.com/image/search/selectoption.gif";
				obj30D.src="http://www.lifestorynet.com/image/search/option.gif";
				objDay.value=7;
			}
				
			objSearch.value="advanced";
			checkTime();			
		}else{
			hAdvanced.className="ans";
			hDeath.className="notselected";
			hInclude.className="notselected";
			hName.className="notselected";
			hHome.className="notselected";
			hKeyword.className="notselected";
			if(hQuick.src!="http://www.lifestorynet.com/image/search/s1on.jpg"){hQuick.src="http://www.lifestorynet.com/image/search/s1on.jpg";}
			if(hAdvanced.src!="http://www.lifestorynet.com/image/search/s2out.jpg"){hAdvanced.src="http://www.lifestorynet.com/image/search/s2out.jpg";}
			objSearch.value="quick";
		}

	}


	function checkTime(){
		if(obj2D.src=="http://www.lifestorynet.com/image/search/selectoption.gif"){objDay.value=2;}
		if(obj7D.src=="http://www.lifestorynet.com/image/search/selectoption.gif"){objDay.value=7;}
		if(obj30D.src=="http://www.lifestorynet.com/image/search/selectoption.gif"){objDay.value=30;}
	}


	function swapday(sel,val){
		obj2D.src="http://www.lifestorynet.com/image/search/option.gif";
		obj7D.src="http://www.lifestorynet.com/image/search/option.gif";
		obj30D.src="http://www.lifestorynet.com/image/search/option.gif";
			sel.src="http://www.lifestorynet.com/image/search/selectoption.gif";
		objDay.value=val;
		setType("adv");
		objMonth.value=0;
		objYear.value=="NONE";
		objYear.style.display='none';
	}


	function expandTime(){
		setType("adv");
		obj2D.src="http://www.lifestorynet.com/image/search/option.gif";
		obj7D.src="http://www.lifestorynet.com/image/search/option.gif";
		obj30D.src="http://www.lifestorynet.com/image/search/option.gif";
		
		if( objMonth.value>=1 && objMonth.value<=12 ){
			/*MONTH WITHIN A SPECIFIC YEAR SEARCH*/
			if( objYear.value=="NONE" || objYear.value=="UNKNOWN" ){objYear.value=2007;}
		}else{
			/*A FULL YEAR SEARCH*/
			if( objYear.value=="NONE" ){
				var y=new Date();
				objYear.value=y.getFullYear();
				objDay.value=0;
			}
		}
		
		objYear.style.display='inline';		
	}


	function subenter(myfield,e,n){
		var keycode;
		if (window.event) keycode = window.event.keyCode;
		else if (e) keycode = e.which;
		else return true;

		/*DETECT ENTER "RETURN" KEY*/
		/*ELSE MAKE SURE AREA IS HIGHLIGHTED*/
		if (keycode == 13){
			srch();
			return false;
		}else{
			return true;
		}
	}

	function srch(){
		//window.alert(objSearch.value);
		document.search.submit();
		//window.alert("Perform a(n) "+objSearch.value);
	}
