function date_change()
{
if($('#roster_week_selector').val() == "choose")
{
$('#pick_date').removeClass('noDisplay');
$('#pick_date').css('display', 'inline');
} else {
$('#pick_date').addClass('noDisplay');
{ if($(this).attr("value")!="") {$("#html_roster_selector").submit();}}
}
}
function use_custom_date(dateText)
{
if($('#pick_date').val() != "")
{
roster_week = $('#pick_date').val().replace(/\//g,"_");
window.location.href = "http://" + window.location.hostname + '/roster/roster.php?roster_date=' + roster_week;
}
}
function show_msg(element)
{
var elid = element.attr('id');
if(messages[elid]!==undefined)
{
var msg = messages[elid];
var position = element.position();
var doc_width = $(document).width();
var doc_height = $(document).height();
msg = "
";
$('#update_msg').css('top', 0);
$('#update_msg').css('left', 0);
$('#update_msg').html(msg);
var upd_width = $('#update_msg').width();
var upd_height = $('#update_msg').height();
var upd_padding = 10;
if((position.left + element.width() + upd_width + upd_padding) > doc_width)
{
$('#update_msg').css('left', position.left - upd_width - upd_padding);
} else {
$('#update_msg').css('left', position.left + element.width() + upd_padding);
}
if((position.top + upd_height) > doc_height)
{
$('#update_msg').css('top', position.top + element.height() - upd_height);
} else {
$('#update_msg').css('top', position.top);
}
$('#update_msg').css('display', 'block');
}
}
function hide_msg()
{
$('#update_msg').css('display', 'none');
}
function move(move_direction)
{
var url = "";
switch (move_direction) {
case "next_wk":
url = $('#next_wk_link').attr('href');
break;
case "last_wk":
url = $('#last_wk_link').attr('href');
break;
default:
url = "/roster/index.php"
}
if(url != "/roster/index.php")
{
window.location.href = location.protocol + "//" + window.location.hostname + url;
} else {
//alert('Please select a roster date');
}
}