// Home Page Tour Slider
$(function(){
	$("#step-0").click(function(){
		$("#slider").animate({marginLeft:'0px'},'0');
	});

	$("#step-1").click(function(){
		$("#slider").animate({marginLeft:'-960px'},'0');
	});	   

	$("#step-2").click(function(){
		$("#slider").animate({marginLeft:'-1920px'},'0');
	});

	$("#step-3").click(function(){
		$("#slider").animate({marginLeft:'-2880px'},'0');
	});

	$("#step-4").click(function(){
		$("#slider").animate({marginLeft:'-3840px'},'0');
	});
});


// Invite a Friend Pop Up
var popupStatus = 0;

function loadPopup(){
	if(popupStatus==0){
		$("#iaf-bg").css({
			"opacity": "1"
		});
		$("#iaf-bg").fadeIn("slow");
		$("#iaf").fadeIn("slow");
		popupStatus = 1;
	}
}

function disablePopup(){
	if(popupStatus==1){
		$("#iaf-bg").fadeOut("slow");
		$("#iaf").fadeOut("slow");
		popupStatus = 0;
	}
}

function centerPopup(){
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#iaf").height();
	var popupWidth = $("#iaf").width();
	$("#iaf").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});

	$("#backgroundPopup").css({
		"height": windowHeight
	});
}

$(document).ready(function(){
	$("#taf").click(function(){  
		centerPopup();  
		loadPopup();  
	});

	$("#iaf-close").click(function(){
		disablePopup();
	});

	$("#iaf-bg").click(function(){
		disablePopup();
	});

	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			disablePopup();
		}
	});
});

// Examen response field slide control
$(document).ready(function(){
	if ('Explorer' != BrowserDetect.browser) {
		$(window).scroll(function(){
			if  ($(window).scrollTop() > $(".slideclear").offset({ scroll: false }).top){
				$("#responseform").css("position", "fixed");
				$("#responseform").css("top", "0");
			}
			if  ($(window).scrollTop() <= $(".slideclear").offset({ scroll: false }).top){
				$("#responseform").css("position", "relative");
				$("#responseform").css("top", $(".slideclear").offset);
			}
		});
	}
});


// Search and Export box slider.
$(document).ready(function(){

	$("#exportslide").click(function () {
		$("#searchbox").hide();
		$("#exportboxcollapsed").hide();
		$("#exportbox").show();
		$("#searchboxcollapsed").show();
	});

	$("#searchslide").click(function () {
		$("#exportbox").hide();
		$("#searchboxcollapsed").hide();
		$("#searchbox").show();
		$("#exportboxcollapsed").show();
	});
});

/*
$(document).ready(function(){
	$("#exportslide").click(function () {
		$("#searchboxcollapsed").animate({width:'toggle'},"fast");
		$("#searchbox").animate({width:'toggle'},"fast");
		$("#exportboxcollapsed").animate({width:'toggle'},"fast");
		$("#exportbox").animate({width:'toggle'},"fast");
	});
});

$(document).ready(function(){
	$("#searchslide").click(function () {
		$("#searchboxcollapsed").animate({width:'toggle'},"fast");
		$("#searchbox").animate({width:'toggle'},"fast");
		$("#exportboxcollapsed").animate({width:'toggle'},"fast");
		$("#exportbox").animate({width:'toggle'},"fast");
	});
});
*/

// Show Change Email Alert
//$(document).ready(function(){
//	$("input#email").focus(function () {
//		$("div#alert").fadeIn("fast");
//	});
//});






