// JavaScript Document

$(document).ready(showNoLinkBorders);
$(document).ready(showButtonWhenRefererExists);

/*
Mission
*/
function go_modal()
{
}

/*
Remove A tag borders
*/
function showNoLinkBorders()
{
	$("a").focus(function(){
		this.blur();
	});
}

/*
fancyzoom
*/
$(document).ready(function(){
	$("a.zoomtarget").each(function(){
		$(this).fancyZoom({directory: '../_includes/js/jquery/fancyzoom_image'});
	})
});


/* 
recruiting_message toglle 
*/
$(document).ready(function(){
	$(".recruiting_message_list h3").toggle(
		function(){
			$(this).next().slideDown("fast");
		},
		
		function(){
			$(this).next().slideUp("fast");
		}
	);
});

/*
FAQ toggle
*/
$(document).ready(function(){
	$("span").toggle(
		function(){
			$(this).next().removeClass("hide");
		},
		
		function(){
			$(this).next().addClass("hide");
		}
	);
});

/*
Freshmans inner page
*/
function imageTransition()
{
}

/*
quicknavi
*/
function showButtonWhenRefererExists()
{
	var refererString;
	var position;
	
	/*
	$("#navi_prev")
		.load(function(){
			
			refererString = document.referrer;
			position	  = parseInt( refererString.indexOf("voice") );
			
			// show buttons when referer doesn't include 'voice'
			if( position<0 ){
				$("#navi_prev").removeClass("hide");
				}
			})
	
		.mouseover(function(){
			$("#navi_prev").attr("src","../../_includes/images/common/navi_prev_on.gif");
			})
	
		.mouseout(function(){
			$("#navi_prev").attr("src","../../_includes/images/common/navi_prev_off.gif");
			})
	
		.click(function(){						
			window.back();				   
			})
	*/
}

/*
each_voice crossfader
*/

/*
$(document).ready(function(){
	
	var $path_off;
	var $path_on;
	var $amount;

	//total images
	$amount = $(".each_voice").find("img").length;

	$(".each_voice .left a").each(function(index){
	   
	   //add ID
	   $unique_id = "id_"+Math.random() * 10000000000000000000;
	   $(this).attr("id",$unique_id);
	   
	   //lookup and set image paths
	   $path_off = $("#"+$unique_id+" img").attr("src");	   
	   $path_on  = $path_off.replace("_off","_on");
	   $sleepinit= 18; //time for initial sleep
	   $sleepsec = $sleepinit + index;
	   $delay	 = $sleepinit + $amount + 1;
	   
	   //start crossSlide
	   $(this).crossSlide({
			sleep:$sleepsec,
			fade:1
			},[
				{ src: $path_off },
				{ src: $path_on,	time: $delay  }
			]
			);	
	   });
});
*/

/* Top of Page */

function backToTop() { 
var x1 = x2 = x3 = 0; 
var y1 = y2 = y3 = 0; 
if (document.documentElement) { 
x1 = document.documentElement.scrollLeft || 0; 
y1 = document.documentElement.scrollTop || 0; 
} 
if (document.body) { 
x2 = document.body.scrollLeft || 0; 
y2 = document.body.scrollTop || 0; 
} 
x3 = window.scrollX || 0; 
y3 = window.scrollY || 0; 
var x = Math.max(x1, Math.max(x2, x3)); 
var y = Math.max(y1, Math.max(y2, y3)); 
window.scrollTo(Math.floor(x / 2), Math.floor(y / 2)); 
if (x > 0 || y > 0) { 
window.setTimeout("backToTop()", 25); 
} 
} 
