	var t;
	var feature	= '#feature_';
	var control	= '#cntrl_';
	var emStr	= 'enter your email';

// initialize variables at last position

	// this the number of slides staring from 1,2,...,n
	var max		= 5;

	// duration of the slide up, 1 sec = 1000
	var duration	= 7000;

	var next	= 2;
	var previous	= 1;
	var current	= 1;

	$('#cntrl_play').hide();

function start_loop() {

	emVal	= $('#hpEmailEntry').val();
	
	if (emVal == emStr) {

		$('#cntrl_play').hide();
		$(control.concat(current)).removeClass("cntrl_active");
		hide_element(feature.concat(current));
		current	= next;

		$(control.concat(next)).addClass("cntrl_active");

		next		= (current == max)?1:current+1;
		previous	= (current == 1)?max:current-1;

		if (current == 5)
			$("#email_form").hide();
		else
			$("#email_form").show();

		show_element(feature.concat(current));
	}

	// loop again in case they back out
	t	= setTimeout("start_loop()",duration);
}



function show_element(div) {
	if(navigator.appName == "Microsoft Internet Explorer") {
		$(div).show();
	} else {
    		$(div).fadeIn("slow");
	}

}

function hide_element(div) {
    $(div).hide();
}

function stop_loop() {
    $('#cntrl_pause').hide();
    $('#cntrl_play').show();
    clearTimeout(t);
}

function switch_pane(div) {
	stop_loop();

	$("#cntrl_1").removeClass("cntrl_active");
	$("#feature_1").hide();
	$("#cntrl_2").removeClass("cntrl_active");
	$("#feature_2").hide();
	$("#cntrl_3").removeClass("cntrl_active");
	$("#feature_3").hide();
	$("#cntrl_4").removeClass("cntrl_active");
	$("#feature_4").hide();
	$("#cntrl_5").removeClass("cntrl_active");
	$("#feature_5").hide();
	$("#email_form").hide();
	current = div - 1;

	$(control.concat(div)).addClass("cntrl_active");
	show_element(feature.concat(div));

}

function hp_email_fix() {
	emObj	= $('#hpEmailEntry');
	emVal	= emObj.val();
	
	if (emVal == emStr)
		emObj.val('');
	else
		if (emVal == '') emObj.val(emStr);
}

$(document).ready(function() {
    t = setTimeout("start_loop()",duration);
});

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   window.location='/search/'+document.getElementById('search').value+'/';
   return false;
   }
else
   return true;
}

function showtxtsearch() {
	document.getElementById('univsrch').style.display = 'none';
	document.getElementById('univbttn').style.display = 'none';
	document.getElementById('txtbooksrch').style.display = 'inherit';
	document.getElementById('txtbttn').style.display = 'inherit';
}
