
// centered window pop
// sample: <a href="newPage.html" onclick="CenteredWindow(this.href,'name','200','100','yes');return false">link</a>

var win = null;
function CenteredWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

// show and hide divs
// sample: onClick="expandcontent('name of div')"

var previoustab=""
function expandcontent(cid){
if (document.getElementById){
if (previoustab!="")
document.getElementById(previoustab).style.display="none"
if (cid!=""){
document.getElementById(cid).style.display="block"
previoustab=cid
}
}
}


$(document).ready(function() {

  // form clearing
  $(".loginfield").live("focus",function() {
    if(this.value == this.defaultValue) {
      this.value = '';
    }
  });
  $(".loginfield").live("blur",function() {
    if(this.value == '') {
      this.value = this.defaultValue;
    }
  });


});


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


$(document).ready(function() {
  $(".league_check").change(function() {
    if($(this).attr("checked") == true) {
      // Show the subtable
      tid = $(this).attr("id");
      $("#" + tid + "_sub").fadeIn();
    } else {
      // Hide the subtable
      tid = $(this).attr("id");
      $("#" + tid + "_sub .check").attr("checked", false);
      $("#" + tid + "_sub").fadeOut();
    }
  });
  $(".date_check").change(function() {
    if($(this).attr("checked") == true) {
      // Show the subtable
      tid = $(this).attr("id");
      $("#" + tid + "_sub").fadeIn();
    } else {
      // Hide the subtable
      tid = $(this).attr("id");
      $("#" + tid + "_sub .check").attr("checked", false);
      $("#" + tid + "_sub").fadeOut();
    }
  });

  $(".field").change(function() {
    if($(this).attr("checked") == true) {
      $("#FieldAll").attr("checked", false);
    }
  });
  $("#FieldAll").change(function() {
    if($(this).attr("checked") == true) {
      $(".field").attr("checked", false);
    }
  });
  $(".date").change(function() {
    if($(this).attr("checked") == true) {
      $("#DateAll").attr("checked", false);
    }
  });
  $("#DateAll").change(function() {
    if($(this).attr("checked") == true) {
      $(".date").attr("checked", false);
      $(".date_sub_table").fadeOut();
    }
  });
  $(".type").change(function() {
    if($(this).attr("checked") == true) {
      $("#AllTypes").attr("checked", false);
    }
  });
  $("#AllTypes").change(function() {
    if($(this).attr("checked") == true) {
      $(".type").attr("checked", false);
    }
  });
  $("#AllBoys").change(function() {
    if($(this).attr("checked") == true) {
      $(".boys").attr("checked", false);
      $(".boys_sub_table").fadeOut();
    }
  });

  $(".boys").change(function() {
    if($(this).attr("checked") == true) {
      $("#AllBoys").attr("checked", false);
    }
  });
  $(".boys_sub").change(function() {
    if($(this).attr("checked") == true) {
      //alert($(this).attr("id"));
      tid = $(this).attr("id");
      tid = tid.split("-");
      $("#all_" + tid[0]).attr("checked", false);
    }
  });
  $("#AllGirls").change(function() {
    if($(this).attr("checked") == true) {
      $(".girls").attr("checked", false);
      $(".girls_sub_table").fadeOut();
    }
  });

  $(".girls").change(function() {
    if($(this).attr("checked") == true) {
      $("#AllGirls").attr("checked", false);
    }
  });
  $(".girls_sub").change(function() {
    if($(this).attr("checked") == true) {
      //alert($(this).attr("id"));
      tid = $(this).attr("id");
      tid = tid.split("-");
      $("#all_" + tid[0]).attr("checked", false);
    }
  });
  $(".all_sub").change(function() {
    if($(this).attr("checked") == true) {
      //alert($(this).attr("id"));
      tid = $(this).attr("id");
      tid = tid.split("_");
      $(".sub_" + tid[1]).attr("checked", false);
    }
  });


});

