


function launch_journey(section) {
	
	tb_show("","/flash/journey.shtml?section="+section+"TB_iframe=true&height=508&width=719")
	}


var protected_load_url

$(function() {
	
	
	var entryLIs = $(".colEntryPoints .col li").css({"opacity":0,"margin-left":"-80px"})
	
	if($.browser.safari) {$("body").addClass("safari")}
	
	
	
	if(window.parent) {
		if(window.parent!=window) {
			$(".hide-if-frame").css("display","none")
			$(".window-close").click(function() {
			
				
				parent.$("#TB_closeWindowButton").click()
				parent.preCheckAuthentication()
				return false
			
			})
		}
	}
	
	
	
	
	$("#nav ul ul").siblings("a").addClass("has-children").parent().addClass("has-children")
	
	
	if($("a.protected").size()) {
		preCheckAuthentication()
	}
	
	
	$("a.protected").click(function() {
	
		protected_load_url = this.href+"&download_title="+escape($(this).text())
		
		if(checkAuthTimeDif()) {location.href=protected_load_url}
		
		
		else {
			$.ajax({
			   
				url:"/ajax/protected.shtml",
				data:{ran:(new Date()).getTime()},
				success:handleProtectionAjax,
				failure:launchLogin,
				dataType:"xml"
				   
				   
			})
		}
		
		return false
	
	})
	
	
	
	
			
	//nextEntryLI()
		
	

		   
})


var entryLiIndex = 0

function nextEntryLI() {
	
	$(".colEntryPoints .col li").eq(entryLiIndex-1).css("margin-left","0px;")
	
	$(".colEntryPoints .col li").eq(entryLiIndex).animate({opacity:1,marginLeft:0},500,"swing",nextEntryLI)
	entryLiIndex++
	
	
}



function checkAuthTimeDif() {
	
	if(!authenticated) {return false}
	else {
		var now = new Date()
		var timeDif = now.getTime()-authenticated.getTime()
		timeDif = timeDif/1000
		timeDif = timeDif/60
		if(timeDif<10) {return true}
		
		else {return false}
		
	}
	
	
}

function launchProtected() {
	location.href=protected_load_url
}


function launchLogin() {
	
	tb_show("","/login.shtml?TB_iframe=true&amp;height=405&amp;width=733")
	
}

function preCheckAuthentication() {
	
	//alert("preChecking")
	
	$.ajax({
			   
		url:"/ajax/protected.shtml",
		data:{ran:(new Date()).getTime()},
		success:handleProtectionAjaxPre,
		dataType:"xml"
		   
		   
	})
}

function handleProtectionAjax(data) {
	
	if($("success",data).size()) {
		authenticated = new Date()
		launchProtected()
	}
	else {launchLogin()}
}


var authenticated

function handleProtectionAjaxPre(data) {
	
	if($("success",data).size()) {
	
	authenticated = new Date()
	
		
	}

}


function getURL(url) {
	location.href=url
}






		


		
		