/* collapsible menu config */
$(document).ready(function() {
	// Collapse everything but the first menu:
	$("#menu > li > a").not(".Expand").find("+ ul").slideUp(1);
				
	// Expand or collapse:
	$("#menu > li > a").click(function() {
		$(this).find("+ ul").slideToggle("fast");
	});
})

/* interface config */
$(function(){
	$(".ptp a").click(function(){
	$('#header').ScrollTo(1000, 'easeout');
	return false;
	});
});



/* new mark */
function NewMark(y, m, d) {
    oldDay = new Date(y + "/" + m + "/" + d);
    newDay = new Date();
    n = (newDay - oldDay) / (1000 * 60 * 60 * 24);
    if (n <= 15)
        document.write('<img src="http://kansai-robot.net/img/new.gif" alt="new!" class="new">');
}




/* curvy corners */

  window.onload = function()
  {
      /*
      The new 'validTags' setting is optional and allows
      you to specify other HTML elements that curvyCorners
      can attempt to round.

      The value is comma separated list of html elements
      in lowercase.

      validTags: ["div", "form"]

      The above example would enable curvyCorners on FORM elements.
      */
      settings = {
          tl: { radius: 5 },
          tr: { radius: 5 },
          bl: { radius: 5 },
          br: { radius: 5 },
          antiAlias: true,
          autoPad: true,
          validTags: ["div","ul","span"]
      }

      /*
      Usage:

      newCornersObj = new curvyCorners(settingsObj, classNameStr);
      newCornersObj = new curvyCorners(settingsObj, divObj1[, divObj2[, divObj3[, . . . [, divObjN]]]]);
      */
      var myBoxObject = new curvyCorners(settings, "rcBox");
      myBoxObject.applyCornersToAll();
  }
  
  
  
/* preload images */

	function preload(imgs){
	 for(var i = 0; i < imgs.length; i++){
	   var imgObj = new Image();
	   imgObj.src = imgs[i];
	 }
	}
	preload(["../img/hbar.gif", "../img/lnavli1_bttm.gif", "../img/lnavli1_01.gif", "../img/lnavli1_02.gif", "../img/lnavli1_03.gif", "../img/lnavli1_04.gif", "../img/lnavli1_01c.gif", "../img/lnavli1_02c.gif", "../img/lnavli1_03c.gif", "../img/lnavli1_04c.gif", "../img/lnavli2.gif", "../img/stepmenu1on.gif", "../img/stepmenu2on.gif", "../img/stepmenu3on.gif", "../img/stepmenu4on.gif", "../img/project_tab.gif", "../img/ptab3on.gif", "../img/ptab4.gif", "../img/ptab4on.gif", "../img/pjnobg.gif", ]);

/* back to top */
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);
  }
}