﻿// JavaScript Document
$(document).ready( function() {
	
	$(".CurPage_id:first").css( { "left" : $(".scott:first .CurPage").offset().left + "px" , "top" : ( $(".scott:first .CurPage").offset().top + 23 ) + "px" } );
	$(".CurPage_id:last").css( { "left" : $(".scott:last .CurPage").offset().left + "px" , "top" : ( $(".scott:last .CurPage").offset().top - 7 - $(".CurPage_id:last").attr("rel") ) + "px" } );

	$("#body").click( function() {
		if ( page_click ) {
			$(".CurPage_id").fadeOut("fast",function() { page_click = false; });
		}
	} );
	$(".scott:first .CurPage").click( function() {
		showpage("first");
	} );
	$(".scott:last .CurPage").click( function() {
		showpage("last");
	} );
	$(window).resize( function() {
		$(".CurPage_id:first").css( { "left" : $(".scott:first .CurPage").offset().left + "px" , "top" : ( $(".scott:first .CurPage").offset().top + 23 ) + "px" } );
		$(".CurPage_id:last").css( { "left" : $(".scott:last .CurPage").offset().left + "px" , "top" : ( $(".scott:last .CurPage").offset().top - 7 - $(".CurPage_id:last").attr("rel") ) + "px" } );
	} );
	$(".CurPage_id li").click( function() {
		$(".scott .CurPage").text($(this).text());
		$(".CurPage_id").fadeOut("fast",function() { page_click = false; window.location.href = "index.asp?CurPage=" + parseInt($(".scott:first .CurPage").text(),10) + $(".scott:first .CurPage").attr("rel") });
	} );

} );

var page_click = false;
function showpage(type) {
	if ( !page_click ) {
		$(".CurPage_id:" + type).fadeIn("fast",function() {
			page_click = true;
		} );
	}
}