	var site_url = 'http://www.science.iupui.edu/';
	
	function req(url, via, target, pars){
		$(target).innerHTML = '<p><strong>Loading Content...</strong></p>';
			var request = new Ajax.Updater(
						{success: target}, 
						url, 
						{
							method: via, 
							parameters: pars, 
							onFailure: reportError
						});	
	}//END HTTPREQ


	function reportError(request){
		alert('Sorry. There was an error.');
	}//END REPORT ERROR
	
	
	
	function information_request_validation(){

		var validated = new Array();
			
			validated[0] = not_empty("first_name");
			validated[1] = not_empty("last_name");
			validated[2] = not_empty("street_address");
			validated[3] = not_empty("city");
			validated[4] = state_selected('state');
			validated[5] = is_mail('email_address');
			validated[6] = is_phone('phone_number');
			validated[7] = is_birthday('date_of_birth');
			validated[8] = is_zip_code("zip_code");
			validated[9] = not_empty("country");
			validated[10] = is_selected("direct_to"); 
			validated[11] = not_empty("info_request");
			validated[11] = not_empty("captcha_string");
						
		var test_count = validated.length;
		var passed = false;
		
			for(i=0;i<test_count; i++){
				if(!eval(validated[i])){
					passed = false;
					break;
				}else{
					passed = true;
				}
			}
			
		if (passed){
			//alert("The entire form validated!");
			$('information_request_form').submit();
		}else{
			//alert("Something did not validate");
			information_request_validation_failed(false);
		}
	}
	
	function information_request_validation_failed(flag){
		var x = 0;
		var y = 0;
		
			if (flag){
				alert("Validated");
			}else{
				scroll(x,y);
			}
	}//END information_request_test
	
	function not_empty(id){
		var str = $(id).value;
			if (str != ""){
				$(id).style.background = '#FFF';
				return true;
			}else{
				$(id).style.background = '#FF0000';
				return false;
			}
	}//END not_empty
	
	
	function is_uid(id){
		var str = $(id).value;
		var filter = /^\d\d\d\d\d\d\d\d\d\d$/;
			if (!filter.test(str)){
				$(id).style.background = '#FF0000';
				return false;
			}else{
				$(id).style.background = '#FFF';
				return true;
			}
	}//END is_phone
	
		
	function is_phone(id){
		var str = $(id).value;
		var filter = /^\d\d\d-\d\d\d-\d\d\d\d$/;
			if (!filter.test(str)){
				$(id).style.background = '#FF0000';
				return false;
			}else{
				$(id).style.background = '#FFF';
				return true;
			}
	}//END is_phone
	
	function state_selected(id){
		if ($(id).selectedIndex == 0) {
			$(id).style.background = '#FF0000';
			return false;
		}else{
			$(id).style.background = '#FFF';
			return true;
		}
	}//END IF


	function is_selected(id){
		if ($(id).selectedIndex == -1) {
			$(id).style.background = '#FF0000';
			return false;
		}else{
			$(id).style.background = '#FFF';
			return true;
		}
	}//END IF

	function default_selected(id){
		if ($(id).selectedIndex == 0) {
			$(id).style.background = '#FF0000';
			return false;
		}else{
			$(id).style.background = '#FFF';
			return true;
		}
	}//END IF
	

	function alert_selection(id){
			var ind = $(id).selectedIndex;
			var val = $(id).options[ind].value;
			alert(val);
	}//END IF	
		
	function is_mail(id){
		var str = $F(id);
		var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		if (!filter.test(str)) {
			$(id).style.background = '#FF0000';
			return false;
		}else{
			$(id).style.background = '#FFF';
			return true;			
		}
	}//END is_mail
	
	
		function is_birthday(id){
		var str = $(id).value;
		var filter = /^\d\d-\d\d-\d\d$/;
			if (!filter.test(str)){
				$(id).style.background = '#FF0000';
				return false;
			}else{
				$(id).style.background = '#FFF';
				return true;
			}
	}//END is_phone
	
	function is_zip_code(id){
		var str = $(id).value;
		var filter_five_digit = /^\d\d\d\d\d$/;
		var filter_nine_digit = /^\d\d\d\d\d-\d\d\d\d$/;
		var flag = false;
		
		if (filter_five_digit.test(str)){
			flag = true;
		}
		if (filter_nine_digit.test(str)){
			flag = true;
		}
		if (!flag){
			$(id).style.background = '#FF0000';
			return false;
		}else{
			$(id).style.background = '#FFF';
			return true;
		}
	
	}//END is_zip_code
	
	
	var captcha_append_code;
	function new_captcha_image(){
		var chars = 'abcdefghijklmnopqrstuvwxyz';
		var n = chars.length;
		var rnd =( Math.floor ( Math.random ( ) * n  ) );
		
		if (captcha_append_code != rnd){
			$('captcha_img').src = 'http://www.science.iupui.edu/forms/captcha/captcha.class.php?'+ chars[rnd];			
		}
		captcha_append_code = rnd;
	}

	
	function validate_honors_ceremony_reg(){
		
		var validated = new Array();
		if ($('reg_type').value == 'student'){
			validated[0] = not_empty("fullname");
			validated[1] = not_empty("major");
			validated[2] = is_phone("phone");
			validated[3] = is_mail("mail");
			if ($('invite_teacher').selectedIndex == 1){
				validated[4] = not_empty("teacher_name");
				validated[5] = not_empty("teacher_hs");
				validated[6] = not_empty("hs_city");
				validated[7] = not_empty("hs_state");
			}
		}
		
		if ($('reg_type').value == 'staff'){
			validated[0] = not_empty("fullname");
			validated[1] = not_empty("department");
			validated[2] = is_phone("phone");
			validated[3] = is_mail("mail");
		}

		if ($('reg_type').value == 'hs_teacher'){
			validated[0] = not_empty("fullname");
			validated[1] = not_empty("highschool");
			validated[2] = not_empty("subject");
			validated[3] = not_empty("invited_by");
			validated[4] = is_phone("phone");
			validated[5] = is_mail("mail");
		}			
			
		if ($('reg_type').value == 'friend'){
			validated[0] = not_empty("fullname");
			validated[1] = is_phone("phone");
			validated[2] = is_mail("mail");
		}			
		var test_count = validated.length;
		var passed = false;
		
			for(i=0;i<test_count; i++){
				if(!eval(validated[i])){
					passed = false;
					break;
				}else{
					passed = true;
				}
			}
			
		if (passed){
			//alert("The entire form validated!");
			$('honors_ceremony_form').submit();
		}else{
			//alert("Something did not validate");
			//information_request_validation_failed(false);
		}		

	}

	function catalystsubscribe(){
		var validated = new Array();
			
			validated[0] = not_empty("f_name");
			validated[1] = not_empty("l_name");
			validated[2] = is_mail("mail");
			validated[3] = not_empty("captcha_string");
						
		var test_count = validated.length;
		var passed = false;
		
			for(i=0;i<test_count; i++){
				if(!eval(validated[i])){
					passed = false;
					break;
				}else{
					passed = true;
				}
			}
			
		if (passed){
			//alert("The entire form validated!");
			$('ecatalyst_subscribe').submit();
		}else{
			//alert("Something did not validate");
			information_request_validation_failed(false);
		}		
	}

	function squash(id){
		var flag = $(id).style.visibility;
		if (flag == 'visible'){
			$(id).style.visibility = 'hidden';
			$(id).style.height = '0px'
		}
		else {
			$(id).style.visibility = 'visible';
			$(id).style.height = 'auto';
		}
	}
	
	/*
	 * SEARCH WIDGET
	 * 
	 */
	
	function search_widget_results(){
		var URL = 'http://'+ document.location.host + '/';
		
		var searchString = $('searchInput').value;
			$('sci_search_widget').innerHTML = '';
			if(searchString == ''){
				$('sci_search_widget').style.visibility = 'hidden';
			}else{
				$('sci_search_widget').style.visibility = 'visible';
			}
			if(searchString.length > 1){
				req(URL+'metasearch/script.php','get','sci_search_widget','q='+searchString);
			}
	}
	
	function search_box_defaults(id){
		$(id).setAttribute("autocomplete", "off");
		($(id).value == 'Search SOS')?$(id).value = '':false;
	}
