var SITE='http://www.lns.cornell.edu/~vk/';
function siteUrl(section,url) {
   return SITE+section+'/'+url;
}
function titleMenu(tag) {
    var section='';
    workMenu = [
            { text:"Introduction", url:siteUrl(section,'introduction.html') },
            { text:"Personal", url:siteUrl(section,'.html') },
            { text:"Photos", url:siteUrl(section,'.html') }
        ]
   commonMenu(tag,workMenu);
}
function commonMenu(tag,iMenu) {
    var oMenu = new YAHOO.widget.MenuBar("mymenubar", 
                { trigger:document
                } );
    oMenu.addItems(iMenu);
    oMenu.render(tag);
}
function showTag(tag) {
   var id=document.getElementById(tag);
   id.className="show";
}
function callBack() {
  showTag("title2");
  drawBox("title2");
}
function callBack1() {
  showTag("title1");
  drawBox("title1");
}
function drawLine(tag,where,length,end) {   
   var attributes;
   if(where=='h') {
      attributes = {width: {to: length}}
   } else if(where=='-h') {
      attributes = {width: {from: end, to: length}}
   } else if(where=='v') {
      attributes = {height: {to: length}}
   } else if(where=='-v') {
      attributes = {height: {from: end, to: length}}
   }
   var anim = new YAHOO.util.Anim(tag, attributes );
   anim.onComplete.subscribe(callBack);
   anim.duration = 3; // 3 sec.
   anim.animate();
};
function drawBox(tag) {   
   var attributes = {
      color: { to: '#000' },
      //backgroundColor: { to:  'rgb(192,192,192)' },
      backgroundColor: { to:  '#F0F0F0' },
      borderTopColor: { to: '#dcdcdc' },
      borderRightColor: { to: '#dcdcdc' },
      borderBottomColor: { to: '#dcdcdc' },
      borderLeftColor: { to: '#dcdcdc' }
   };
   
   var anim = new YAHOO.util.ColorAnim(tag, attributes, YAHOO.util.Easing.bounceIn);
   anim.duration = 3;
   anim.onComplete.subscribe(callBack1);
   anim.animate();
};
function callBack2() {
  showTitle("centerBox2",'callBack3');
  var id=document.getElementById('title_table1');
  id.className="menu";
}
function callBack3() {
  showTitle("centerBox3",'callBack4');
  var id=document.getElementById('title_table2');
  id.className="menu";
}
function callBack4() {
  var id=document.getElementById('title_table3');
  id.className="menu";
}
function showTitle(tag,f) {   
   var attributes = {
      color: { to: '#707070' }
   };
   
   var anim = new YAHOO.util.ColorAnim(tag, attributes, YAHOO.util.Easing.bounceIn);
   anim.duration = 3;
   if(f=='callBack2') {
   anim.onComplete.subscribe(callBack2);
   } else if(f=='callBack3') {
   anim.onComplete.subscribe(callBack3);
   } else if(f=='callBack4') {
   anim.onComplete.subscribe(callBack4);
   }
   anim.animate();
};
