$(document).ready(function(){

	$('#feature').innerfade({
		animationtype:'fade', // Type of animation 'fade' or 'slide' (Default: 'fade')
		speed:'normal', // Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast. Default: 'normal')
		timeout:'5000', // timeout: Time between the fades in milliseconds (Default: '2000'), 
		type:'sequence', // type: Type of slideshow: 'sequence', 'random' or 'random_start' (Default: 'sequence')
		containerheight:'340', // containerheight: Height of the containing element in any css-height-value (Default: 'auto'),
		runningclass:'innerfade', // runningclass: CSS-Class which the container get?s applied (Default: 'innerfade')
		children:'' // children: optional children selector (Default: null)
	});

	$('#homepage_lead_form input[type="text"]').each(function(){
		val=$(this).attr('value');
	}).focus(function(){
		$(this).attr('value','');
	}).blur(function(){
		if(val==''){
			$(this).attr('value',val);
		}
	});


	$.get("/lib/ajax/hot_deals.php", {}, function(data){
		$("#homepage_hot_deals_wrap div#homepage_hot_deals_newsticker_wrap").append(data).find("ul").newsTicker();
	});

	//
	//setTeasers();
	//showItem(1,'headline',true);
	//initSwitch();

	//setTimeout("tb_show(null, '#?TB_inline&height=400&width=600&inlineId=last_minute_thickbox', false);",4000);

	if($('#geo_country').val() == 'CA')
	{
		setTimeout("tb_show(null, '#?TB_inline&height=400&width=600&inlineId=geo_thickbox', false);",2000);
	}

	//////////////////////////////]=  Find Your School  [//////////////////////////////

	$('#homepage_find_your_school_input').keyup(function(){
		$("#homepage_find_your_school_input").autocomplete("/lib/ajax/find_school.php", {width:212, delay:40, minChars:3, maxItemsToShow:20});
	});

	$('#homepage_find_your_school_submit').click(function(){
		//alert("SFgf");
		window.location = "/lib/ajax/find_school.php?school_name="+$("#homepage_find_your_school_input").val();
		return false;
	})

	// set initial value
	$("#homepage_find_your_school_input").val("Type your school's name here");
	// on focus, clear value
	$("#homepage_find_your_school_input").focus(function(){
		if($(this).val()=="Type your school's name here"){
			$(this).val("");
			$(this).css({color:"#000"});
			//return false;
		}
	});
	// on blur, if empty, restore value
	$("#homepage_find_your_school_input").blur(function(){
    if ($(this).val()=="") {
			$(this).val("Type your school's name here");
			$(this).css({color:"#999"});
			//return false;
		}
	});

	////////////////////////////////]=	School Reservations [///////////////////////////////////
	$(".schools_reservation").change(function(){
		window.location = "/trip_finder/schools_reservations.php?college_id="+$(".schools_reservation").val();
	});


	//////////////////////////////]=  Free Spring Break  [//////////////////////////////
	// set initial value
	$("#homepage_free_spring_break_input").val("Enter your email address to win");

	// on focus, clear value
	$("#homepage_free_spring_break_input").focus(function(){
		if($(this).val()=="Enter your email address to win"){
			$(this).val("");
			$(this).css({color:"#000"});
			return false;
		}
	});

	// on blur, if empty, restore value
	$("#homepage_free_spring_break_input").blur(function(){
    if ($(this).val()=="") {
			$(this).val("Enter your email address to win");
			$(this).css({color:"#999"});
			return false;
		}
	});


	$("#homepage_free_spring_break_wrap #homepage_free_spring_break_submit").click(function(event){
		event.preventDefault();
		if($("#homepage_free_spring_break_input").val() != 'Enter your email address to win'){
			$.ajax({
				type:"GET",
				url:"/lib/ajax/newsletter_signup.php",
				data:"email_address=" + $("#homepage_free_spring_break_input").val(),
				success: function(data){
					$("#homepage_free_spring_break").html("");
					$("#homepage_free_spring_break").append(data);
				}
			});
		}else{
			alert("Your Email Address is Required");
		}
	});
});

