var MYGROWUP_TAG_START = "<<MyGrowUp::";
var MYGROWUP_TAG_END = ">>";
var MYGROWUP_DIVIDER = "@@@@";
var itemDisplayStatus = 0;  // control if first time click item-icon
var gViewModeTile = 0;
var gViewModeDetail = 1;
var gItemInfoStatus_open=1;
var gItemInfoStatus_close=0;
var itemInfoStatus = gItemInfoStatus_open;  // if display info box in detail show
var lastItem = null;  // hlight icon
var iconBarWidth=750;
var mInfoWidth=320;
var maxPeriodTitle=70;
var maxPeriodList=40;
var iconHeightWhenScroll = "120px";
var iconWidth = 130;
var iconExtraWidth = 0;
var itemListTimeLineDiff=20;
var tagItemStart=false;
var workshopStart=false;
var clickItemStart=false;
var gStartInfoStatus=0; // control map display speed in minfopanel
//var sharefbstr1Len = 4;
//var sharefbstr2Len = 5;
var mPictX=0;
var mPictY=0;

function gotoItemList(url,userId,periodId) {
  periodList_setCookie(userId,periodId);
  location.href = url;
}
function setScrollTop(y) {
  document.documentElement.scrollTop = y;
  document.body.scrollTop=y;;
/*
 if( document.body!=null && document.body.scrollTop!=null) {
   //DOM compliant
   document.body.scrollTop=y;
 } else if( document.documentElement!=null && document.documentElement.scrollTop!=null ) {
   //IE6 standards compliant mode
   document.documentElement.scrollTop=y;
 }
 else if( typeof( window.pageYOffset ) == 'number' ) {
   //Netscape compliant
   window.pageYOffset=y;
 }
*/
}
function setColor(colorCode) {
  setCookie(themeCookieName,colorCode);
  location.reload();
}
function hlightIcon(o) {
  if (lastItem!=null)  lastItem.style.background='transparent url("images/bg/itemBg.gif") no-repeat left top';
  o.style.backgroundImage='url("images/bg/itemBg_h.gif")';
  lastItem = o;
}

function toggleHlightIcon(o,flag) {
  if (flag) {
    o.style.backgroundImage='url("images/bg/itemBg_h.gif")';
  }
  else {
    o.style.backgroundImage='url("images/bg/itemBg.gif")';
  }
}
function downloadDoc( f,o) {
  window.open(f);
  hlightIcon(o);
}


function playYt(key,o) {
  theMGUItemList.currVideoKey=key;
  mshow("mPictContainer");
  if (itemDisplayStatus==0) {
    itemDisplayStatus = 1;
    $("itemDiv").style.width=(iconWidth*theMGUItemList.getItemSize()+iconExtraWidth)+"px";
    $("itemDiv").style.height=iconHeightWhenScroll;
    $("itemDiv").parentNode.style.height=iconHeightWhenScroll;
    $("itemDiv").parentNode.style.overflowY="hidden";
    $("itemDiv").parentNode.style.overflowX="scroll";
  }

  itemList_setScrollBar();
  hlightIcon(o);
  itemList_setInfoStatus();
  var s = '<div class="vbox"></div>';
  s+='<div class="vboxin"  id="vboxin">';
  s += '<object width="600" height="400" id="ytplayer">';
  s += '<param name="movie" value="http://www.youtube.com/v/'+key+'&rel=0&autoplay=1&enablejsapi=1"></param> ';
  s += '<param name="wmode" value="transparent"></param> ';
  s += '<embed src="http://www.youtube.com/v/'+key+'&rel=0&autoplay=1&enablejsapi=1" type="application/x-shockwave-flash" id="ytplayer"';
  s += 'wmode="transparent" width="600" height="400"></embed></object> ';
  s += '<div class="label t4" style="width:600px" id="ytNote'+key+'"><a href="javascript:ytNotification(\''+key+'\')">If you see "We\'re sorry, this video is no longer available" on the player...</a></div>';
  s += '<div class="label t4 dispnone" style="width:600px" id="ytNoteDetail'+key+'">If you see "We\'re sorry, this video is no longer available" on the player, it means the video is set to "Private" by owner. If you are the owner, you can <a href="javascript:$(\'hbtnclick'+key+'\').click();">Click</a> here to login to see it.</div><input type="button" class="dispnone" id="hbtnclick'+key+'" onclick="ytLogin(event)">';
  s += '</div>';
  $("mPict").innerHTML = s;
  $("mPict").onclick=null;
  $("mPict").title="";
  $("mPict").style.cursor="auto";
}
function ytLogin(e) {
  $('lpbox').innerHTML ='<iframe src="frmYtLogin.jsp" frameborder="0" width="580" height="330"></iframe>';
  $('lpbox').style.left = '0px';
  var l = browser.isIE ? -350 : 50;
  $('lpbox').style.top = (getCursor(e)[1]+l)+'px';
  mhide('vboxin');
  mshow('lpbox');
}
function ytNotification(key) {
  mhide('ytNote'+key);
  mshow('ytNoteDetail'+key);
}

function playMSVideo(key,o) {
  mshow("mPictContainer");
  if (itemDisplayStatus==0) {
    itemDisplayStatus = 1;
    $("itemDiv").style.width=(iconWidth*theMGUItemList.getItemSize()+iconExtraWidth)+"px";
    $("itemDiv").style.height=iconHeightWhenScroll;
    $("itemDiv").parentNode.style.height=iconHeightWhenScroll;
    $("itemDiv").parentNode.style.overflowY="hidden";
    $("itemDiv").parentNode.style.overflowX="scroll";
  }
  itemList_setScrollBar();
  hlightIcon(o);
  itemList_setInfoStatus();
  var s = '<embed src="http://lads.myspace.com/videos/vplayer.swf"'+
          'flashvars="m='+key+'&v=2&type=video" type="application/x-shockwave-flash" width="430" height="346"></embed>';
  $("mPict").innerHTML = s;
  $("mPict").onclick=null;
  $("mPict").title="";
  $("mPict").style.cursor="auto";
}
function playMovie(f,o) {
  mshow("mPictContainer");
  if (itemDisplayStatus==0) {
    itemDisplayStatus = 1;
    $("itemDiv").style.width=(iconWidth*theMGUItemList.getItemSize()+iconExtraWidth)+"px";
    $("itemDiv").parentNode.style.height=iconHeightWhenScroll;
    $("itemDiv").parentNode.style.overflowY="hidden";
    $("itemDiv").parentNode.style.overflowX="scroll";
  }
  itemList_setScrollBar();
  hlightIcon(o);
  itemList_setInfoStatus();

  var ext= !isEmptyString(f) ? f.substr(f.lastIndexOf(".")+1).toLowerCase() : "";
  if (isEmptyString(ext)) return;
  if (ext=="flv") {
    $("mPict").innerHTML=
   ' <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="556" height="450"'+
   '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"'+
   '  id="FLVPlayer">'+
   '  <param name="movie" value="FLVPlayer_Progressive.swf" />'+
   '  <param name="allowScriptAccess" value="sameDomain" />'+
   '  <param name="salign" value="lt" />'+
   '  <param name="quality" value="high" />'+
   '  <param name="scale" value="noscale" />'+
   '  <param name="wmode" value="transparent" />'+
   '  <param name="FlashVars"'+
   '  value="&skinName=clearSkin_3&streamName='+f+'&autoPlay=true&autoRewind=false"'+
   '  />'+
   '  <embed src="FLVPlayer_Progressive.swf"'+
    ' flashvars="&skinName=clearSkin_3&streamName='+f+'&autoPlay=true&autoRewind=false"'+
    ' quality="high" scale="noscale" name="FLVPlayer" wmode="transparent"'+
    ' salign="LT" width="556" height="450" type="application/x-shockwave-flash"'+
    ' pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
    ' </object>';
  }
}
function playMp3(f,o) {
  mshow("mPictContainer");
  if (itemDisplayStatus==0) {
    itemDisplayStatus = 1;
    $("itemDiv").style.width=(iconWidth*theMGUItemList.getItemSize()+iconExtraWidth)+"px";
    $("itemDiv").parentNode.style.height=iconHeightWhenScroll;
    $("itemDiv").parentNode.style.overflowY="hidden";
    $("itemDiv").parentNode.style.overflowX="scroll";
  }
  itemList_setScrollBar();
  hlightIcon(o);
  itemList_setInfoStatus();

  var ext= !isEmptyString(f) ? f.substr(f.lastIndexOf(".")+1).toLowerCase() : "";
  if (isEmptyString(ext)) return;
  if (ext=="mp3"  || ext=="wma") {
    $("mPict").innerHTML='<object'+
    ' id="MediaPlayer" width="400" height="50" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"'+
    ' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"'+
    ' standby="Loading Microsoft Windows Media Player components..."'+
    ' type="application/x-oleobject">'+
    ' <param name="FileName" value="'+f+'">'+
    ' <param name="AnimationatStart" value="true">  '+
    ' <param name="TransparentatStart" value="true"> '+
    ' <param name="AutoStart" value="true">             '+
    ' <param name="ShowControls" value="1"> '+
    ' <param name="ShowStatusBar" value="1">  '+
    ' <param name="autoSize" value="false">  '+
    ' <embed type="application/x-mplayer2"  '+
    '  pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&"'+
    '  src="'+f+'"'+
    '  name=MediaPlayer showcontrols=1 width=400 height=50>'+
    ' </embed>'+
  '</object>';
  }
}
function getPPItem() {
  return lastItem.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
}
var ajaxLoading = false;
var isBig = false;
function prevPict(currIdx) {
  if (ajaxLoading) return;
  if (currIdx==null) {
    currIdx = theMGUItemList.currItemIndex;
  }
  var nextIdx = parseInt(currIdx)-1;
/*
  if (nextIdx<0 && theMGUItemList.currPageNum ==1) return;
  if (nextIdx>=0)
*/                           
    theMGUItemList.setCurrItemIndex(nextIdx);
  if ($("pp"+nextIdx)) {
    var imgObj = $("pp"+nextIdx).getElementsByTagName("img")[0];
    if (!isBig) {
      setTimeout(function(){
        showPict(imgObj,theMGUItemList.theMGUItems[theMGUItemList.currItemIndex].itemId);
        itemList_setScrollBar();
        map_displayItemLocation();
      },10);
    }
    else {
      $('currIndex').innerHTML = getCurrItemIndexDisplay();
      itemList_bigPhoto(nextIdx);
    }
  }
  else {
    if (theMGUItemList.prevPageNum<1) {
      theMGUItemList.prevPageNum=theMGUItemList.lastPageNum;
    }
     itemList_getPageItems(theMGUItemList.prevPageNum , -1);
  }
  if ($("pp"+(parseInt(currIdx)+2))) {
    var o = $("pp"+(parseInt(currIdx)+2)).getElementsByTagName("img")[0];
    var theItem = theMGUItemList.theMGUItems[nextIdx];
    if (isBig && theItem && theItem.bigPhoto)
      $('dummyNext').src=smallToLarge(o.src) ;
    else
      $('dummyNext').src=smallToMedium(o.src) ;
  }

}

function nextPict(currIdx) {
  if ($('adItemlist')) $('adItemlist').src="/growup/itemlistAds.html?r="+getRandom(10);
  if (ajaxLoading) return;
  if (currIdx==null) {
    currIdx = theMGUItemList.currItemIndex;
  }
  var nextIdx = parseInt(currIdx)+1;
  theMGUItemList.setCurrItemIndex(nextIdx);
  if ($("pp"+nextIdx)) {
    var imgObj = $("pp"+nextIdx).getElementsByTagName("img")[0];
    if (!isBig) {
      setTimeout(function(){
        showPict(imgObj,theMGUItemList.theMGUItems[theMGUItemList.currItemIndex].itemId);
        itemList_setScrollBar();
        map_displayItemLocation();
      },10);
    }
    else {
      $('currIndex').innerHTML = getCurrItemIndexDisplay();
      itemList_bigPhoto(nextIdx);
    }
  }
  else { // next page
       itemList_getPageItems(theMGUItemList.nextPageNum, 1);
  }
  if ($("pp"+(parseInt(currIdx)+2))) {
    var o = $("pp"+(parseInt(currIdx)+2)).getElementsByTagName("img")[0];
    var theItem = theMGUItemList.theMGUItems[nextIdx+1];
    if (isBig && theItem && theItem.bigPhoto)
      $('dummyNext').src=smallToLarge(o.src);
    else    {
      $('dummyNext').src=smallToMedium(o.src);
    }
  }
}
function hidePict() {
  if ($("mPict"))  {
    $("mPict").innerHTML="";
    $("mInfo").innerHTML="";
    mhide("mPictContainer");
  }
  $("itemDiv").style.width="auto";
  $("itemDiv").style.height="auto";
  $("itemDiv").parentNode.style.height="auto";
  $("itemDiv").parentNode.style.overflowX="auto";

  mshow('actionBar');

  itemDisplayStatus = 0;
  itemList_setInfoStatus();

  if (isSlideShow) {
    isSlideShow = false;
    clearTimeout(timer);
  }
}
var lastItemId = 0;
function preloadMid(src, itemId, smallImgSrc) {
  mhide('btName_'+lastItemId);
  $('mPict').innerHTML='<img src="'+src+'" lowsrc='+smallImgSrc+'>';
  itemList_tagNameLayout(itemId);
  lastItemId=itemId;
}
function showPict(o,itemId) {
  ajaxLoading = false;
  mshow("mPictContainer");
  ishow('nextLink');
  ishow('prevLink');
  var firstTimeClickIcon = false;
  if (itemDisplayStatus==0) {   // firstTimeClickIcon
    firstTimeClickIcon = true;
    itemDisplayStatus = 1;
    $("itemDiv").style.width=(iconWidth*theMGUItemList.getItemSize()+iconExtraWidth)+"px";
    $("itemDiv").parentNode.style.height=iconHeightWhenScroll;
    $("itemDiv").parentNode.style.overflowY="hidden";
    $("itemDiv").parentNode.style.overflowX="scroll";
  }
  if (o) {
    var src = smallToMedium(o.src) ;
    setTimeout(function(){
   $("dummy").innerHTML='<img src="'+src+'" lowsrc="'+o.src+'" onload="preloadMid(\''+src+'\','+itemId+',\''+o.src+'\')">';
    hlightIcon($('iOuter'+theMGUItemList.currItemIndex));
},10);
    preloadMid(src,itemId,o.src);

  }
  mhide('actionBar');

  setTimeout(function() {   
    if (firstTimeClickIcon) {
      itemInfoStatus=gItemInfoStatus_close;
    }
    itemList_setInfoStatus();
    if (firstTimeClickIcon) itemList_setScrollBar();
  }, 500);
  return firstTimeClickIcon;
}
function searchValidate(from) {
  var id = from==0 ? "sk" : "sk1";
  if (trim($(id).value).length<3) {
    alert("Please input more than 3 characters.");
    return false;
  }
  else
    return true;
}
function dl() {
  document.getElementById('detail').style.display='block';
}
function itemList_setInfoStatus() {
  gStartInfoStatus=0;
  var idx = theMGUItemList.currItemIndex;
  var item = theMGUItemList.getCurrItem();

  if (itemInfoStatus==gItemInfoStatus_open) {
    if (idx>-1) {
      if ($("mInfo") && $("info"+idx))
        $("mInfo").innerHTML= $("info"+idx).innerHTML;
      setTimeout(function () {
        if ($('tagUrls'+theMGUItemList.getCurrItem().itemId) &&
            $('_tagUrls'+theMGUItemList.getCurrItem().itemId))
        $('tagUrls'+theMGUItemList.getCurrItem().itemId).innerHTML=
                $('_tagUrls'+theMGUItemList.getCurrItem().itemId).innerHTML;
        if ($('tagPUrls'+theMGUItemList.getCurrItem().itemId) &&
            $('_tagPUrls'+theMGUItemList.getCurrItem().itemId))
        $('tagPUrls'+theMGUItemList.getCurrItem().itemId).innerHTML=
                $('_tagPUrls'+theMGUItemList.getCurrItem().itemId).innerHTML;
      },100);
      itemList_showActionListInInfo();
      $("mInfoPanel").style.width=mInfoPanelWidth+"px";
      $("mInfoPanel").style.height="auto";
      $('mComm').innerHTML='';
    }
  }
  else {
    $("mInfo").innerHTML="";
    $("mInfoPanel").style.width="20px";
    $("mInfoPanel").style.height="20px";
    $("mInfoPanel").style.overflow="hidden";
    mhide("mInfoClose");
    setCookie(itemlisDetailInfoCookieName,0);
    gStartInfoStatus=1;
  }
}
function itemList_toggleItemInfo(inComment) {
  if (inComment==null) inComment=false;
  $('mComm').innerHTML='';
  $('mComm').style.height='auto';
  var idx = theMGUItemList.currItemIndex;
  if (itemInfoStatus==gItemInfoStatus_open) {
    if (inComment) {
      $("mInfoPanel").style.width=mInfoPanelWidth+"px";
      $("mInfoPanel").style.height="auto";
      mhide('mCommTitle');
    }
    else {
      itemInfoStatus=gItemInfoStatus_close;
      $("mInfo").innerHTML="";
      $("mInfoPanel").style.width="20px";
      $("mInfoPanel").style.height="20px";
      $("mInfoPanel").style.overflow="hidden";
      mhide("mInfoClose");
      setCookie(itemlisDetailInfoCookieName,0);
    }
    vhide('iMap');
  }
  else {
    itemInfoStatus=gItemInfoStatus_open;
    $("mInfo").innerHTML=$("info"+idx).innerHTML;
    itemList_showActionListInInfo();
    $("mInfoPanel").style.width=mInfoPanelWidth+"px";
    $("mInfoPanel").style.height="auto";
    mshow("mInfoClose");
    setCookie(itemlisDetailInfoCookieName,1);
    vshow('iMap');
    map_displayItemLocation();
 }
}
function itemList_setScrollBar() {
  // control scroll bar position
  o =  $('iOuter'+theMGUItemList.currItemIndex).parentNode.parentNode;  // iconsContainer
  if (theMGUItemList.currItemIndex>4)
    o.scrollLeft = parseInt(theMGUItemList.currItemIndex-2)*iconWidth;
  if ($('periodListDiv'))
    mhide('periodListDiv');
}
/*
function displayEvent(o,display) {
  if (display) {
    $('img').src = o.src;
    $('img').alt = o.alt;
    var left = document.body.getElementsByTagName("div")[0].offsetLeft;
    $("eventBox").style.left = left+'px';
    $("eventBox").style.top = '4px';
    mshow("eventBox");
    $('tip').innerHTML = o.alt;
  }
  else {
    mhide("eventBox");
  }
 }
*/


function suggestion() {
  var url = "suggestion.htm";
  if (growupWin!=null) growupWin.close();
  growupPopup(url, "suggestionWin",470,400);
}

var growupWin = null;

function notifyByEmail() {
  var url = "notifyByEmail.htm?rdm="+new Date().getTime();
  if (growupWin!=null) growupWin.close();
  growupPopup(url, "shareToWin",670,540);
}
function growupPopup(url,name,w,h) {
  if (w==null) w=500;
  if (h==null) h=300;
  growupWin = window.open(url,name,"scrollbars=0,toolbar=0,resizable=0,menubar=0,width="+w+",height="+h);
}
function plineNav(dir,speed) {
  var movedW = $('scrollable0').offsetLeft*(-1);
  var leftW = $('scrollable0').offsetWidth + $('scrollable0').offsetLeft;
  var dt = speed==1?120:isFB?350:isBB||isMS||isOK?450:600;   //facebook
  dt = dir>0 ? -1*(Math.min(dt,leftW)):Math.min(dt,movedW);
  new Effect.Move('scrollable0',{x:dt,y:0,duration:2});
  setTimeout(function(){
    var movedW = $('scrollable0').offsetLeft*(-1);
    var leftW = $('scrollable0').offsetWidth + $('scrollable0').offsetLeft;
    if (movedW>0) mshow('leftNav');else mhide('leftNav');
    if (leftW>$('periodIconOuter').offsetWidth) mshow('rightNav');else mhide('rightNav')

  },2000);
}
function setPeriodLine() {
  var currPIdx = theMGUItemList.currPeriodIndex;
  var pSize = theMGUItemList.getPeriodSize();
  var pLineLeft = 280;
  var navButtonWidth = 46;
  if (theMGUItemList.getPeriodSize()>12) {
    if ($('periodIconOuter')) $('periodIconOuter').style.width=(getWindowWidth()-pLineLeft)+'px';
  }
  if ($('periodIconOuter') && $('periodIconOuter').offsetWidth<$('scrollable0').offsetWidth) {
    mshow('rightNav');
  }
    if (getCookie(timelineDisplay)!=0) {
      openPeriodLine('title');
    }

}

function pline_mov(year, isEnd) {
  Element.hide('callout');
  if (isEnd==null) isEnd = false;
  if (isEnd) {
    $("periodLine").style.background="url(images/periodLine.gif)";
  }
  else {
    var o = $('pline'+year);
    o.style.background="url(images/periodLine.gif) repeat-x"
  }
}
function pline_mou(year, isEnd) {
  hideTip();
  if (isEnd==null) isEnd = false;
  if (isEnd) {
    $("periodLine").style.background="url(images/periodLine_w.gif)";
  }
  else {
    var o = $('pline'+year);
    o.style.background="url(images/periodLine_w.gif) repeat-x"
  }
}
/*
function pline_click(year,i) {
  gotoUrl(viewLink+'?userId='+theMGUItemList.userId+'&periodId='+periodIds[i]);
}
*/
//============================== index.jsp
var di=0; // for guap
function demo_2() {
  $('anibox').style.width=$('outer').offsetWidth + "px";
  $('ani').style.left=$('outer').offsetWidth + "px";

}
function demo_1() {
  new Effect.Move('demopline', { x: 430, y: 0, transition: Effect.Transitions.sinoidal });
  guap('baby',1);guap('p1',1);guvshow('year1',1);
  gushow('baby',2);
  guap('baby2',2);guap('p3',2);guvshow('year2',2);
  guap('baby3',3);guap('p4',3);guvshow('year3',2);
  guap('baby7',4);guap('p6',4);guvshow('year4',3);
  guap('baby10',5);guap('p7',5);guvshow('year5',4);
  guvshow('year6',4);guvshow('year7',5);

  guhide('security_grey',7);
  gushow('security',8);
  guap('sec1',8);
  guap('sec2',9);
  guap('sec3',10);
  guap('sec4',11);

  guhide('file_grey',13);
  gushow('file',14);
  guap('fi1',14);
  guap('fi2',15);
  guap('fi3',16);
  guap('fi4',17);
  guap('fi5',18);
  guap('fi6',19);
  guap('fi7',20);

  guvshow('playagain',21);
  gushow('greyCover',22);
  doMainAni();
}
function replay_demo()
{
  guhide('greyCover',0);
	gufa('baby', 0);
	gufa('baby2', 0);
	gufa('baby3', 0);
	gufa('baby7', 0);
	gufa('baby10', 0);
  gushow('security_grey',1);
  gufa('security',0);
  gufa('sec1',0);
  gufa('sec2',0);
  gufa('sec3',00);
  gufa('sec4',0);

  gushow('file_grey',1);
  guhide('file',0);
  guhide('fi1',0);
  guhide('fi2',0);
  guhide('fi3',0);
  guhide('fi4',0);
  guhide('fi5',0);
  guhide('fi6',0);
  guhide('fi7',0);
	demo_1();
}
var mainAniTimer=null;
function doMainAni() {
  new Effect.Move('ani', { x: -25, y: 0 ,duration:1, transition:Effect.Transitions.linear});
  if ($('ani').offsetLeft*(-1)>$('ani').offsetWidth) {
    $('ani').style.left=$('outer').offsetWidth + "px";
  }
  mainAniTimer = setTimeout(function() {doMainAni()},1000);
}
function startani() {
  doMainAni();
}
function stopani() {
  clearTimeout(mainAniTimer);
}
//============================== end index.jsp

function checkAll(o,id,textId) {
  if (id==null) id="tagTable";
  var toCheck = false;
  if (o.src.indexOf("uncheck")>-1) {
    o.src="images/checkall.gif";
    o.title="Click it to uncheck all";
    o.alt="Uncheck All";
    toCheck = true;
    if (textId!=null) $(textId).innerHTML="Uncheck All";
  }
  else {
    o.src="images/uncheckall.gif";
    o.title="Click it to check all";
    o.alt="Check All";
    if (textId!=null) $(textId).innerHTML="Check All";
  }
  var objs = $(id).getElementsByTagName("input");
  for (var i=0;i<objs.length;i++)
    objs[i].checked = toCheck;
}

function allItems(tabType,url,userId) {               
    gotoUrl(url+"?userId="+userId+"&t="+tabType+"&all=1");
}
function latestUploaded(userId, tabType, itemId) {
  var sItemId = itemId==null?'':'&itemId='+itemId;
  gotoUrl("publicTagViewList.htm?userId="+userId+"&t="+tabType+"&all=1&sort="+gSORT_BY_CREATED_DATE+"&dir="+gSORT_DESC+sItemId+'&isComment=false');
}
function latestComments(userId, tabType, targetId, ctype) {
  var sItemId = ctype!=gCOMMENT_TYPE_ITEM?'':'&itemId='+targetId;
  var sPeriodId = ctype!=gCOMMENT_TYPE_PERIOD?'':'&periodId='+targetId;
  var sUrl = "publicTagViewList.htm?userId="+userId+"&t="+tabType+"&all=1&sort="+gSORT_BY_CREATED_DATE+"&dir="+gSORT_DESC+sItemId+"&isComment=true";
  if (ctype==gCOMMENT_TYPE_PERIOD)
   sUrl = "publicItemList.htm?userId="+userId+"&t="+tabType+sPeriodId+"&isComment=true";
  if (ctype!=gCOMMENT_TYPE_USER)
    gotoUrl(sUrl);
}

// scroll the element horizontally based on its width and the slider maximum value
function scrollHorizontal(value, element, slider) {
//  element.scrollLeft = Math.round(value/slider.maximum*(element.scrollWidth-element.offsetWidth));
//  var x = Math.round(value/slider.maximum*(element.scrollWidth-element.offsetWidth));
  var x = Math.round(element.offsetWidth * value/slider.maximum);
  new Effect.Move(element,{x:-1*x,y:0});
}


function togglePeriodLine(from) {
  if (from==null) return;
  if ($('periodIconOuter').offsetLeft<0) {
    openPeriodLine(from);
  }
  else {
    closePeriodLine();
  }
  mhide('callout');
}
function closePeriodLine() {
  changImgSrc($('plmenu'),'images/arrow/menu_down.gif');
  $('timeLineMenu').style.backgroundImage="url(images/arrow/menu_down.gif)";
  $('periodIconOuter').style.left='-2140px';
  mhide('dummyHolder');
  mhide('timelineDot');
  setCookie(timelineDisplay ,0);
  $('timeLineMenu').style.border="none";
  $('timeLineMenua').style.borderTop="none";
  $('timeLineMenua').style.borderBottom="none";
  $('timeLineMenu').style.backgroundColor="#fff";
  $('timeLineMenua').style.backgroundColor="#fff";
}
function openPeriodLine(from) {
  changImgSrc($('plmenu'),'images/arrow/menu_up.gif');
  if ($('timeLineMenu')) $('timeLineMenu').style.backgroundImage="url(images/arrow/menu_up.gif)";
  if (from=='title' && $('periodIconOuter')) {
    $('periodIconOuter').style.left='240px';  //140
    $('periodIconOuter').style.top='84px';  //124
    mshow('dummyHolder');
    mshow('timelineDot');
    setCookie(timelineDisplay ,1);
  }
  if ($('timeLineMenu')) {
    $('timeLineMenu').style.borderTop="1px solid #aaa";
    $('timeLineMenu').style.borderRight="1px solid #aaa";
    $('timeLineMenu').style.borderBottom="1px solid #aaa";
    $('timeLineMenua').style.borderTop="1px solid #aaa";
    $('timeLineMenua').style.borderBottom="1px solid #aaa";
    $('timeLineMenu').style.backgroundColor="#eee";
    $('timeLineMenua').style.backgroundColor="#eee";
  }
}
function setMainbodySize() {
  if ($('mainBody').offsetHeight<$('leftBar').offsetHeight)
    $('mainBody').style.height = $('leftBar').offsetHeight+'px';
}
function setAjaxMainbodySize() {
  if ($('mainBody').offsetHeight<$('itemDiv').offsetHeight)
    $('mainBody').style.height = ($('itemDiv').offsetHeight+100)+'px';
}
/*itemlistobj*/
function MGUItemList(userId,periodId,isPublicEdit,isPublic,isOwner,urlQuery,isTagView,currTabType,currTagId,tagDays,isSetCookie,itemSizeAll,isLogin,leftSubTab) {
  this.theMGUItems = new Array();
  this.theMGUIPeriods = new Array();
  this.theMapItemObjs = new Array();
  this.userId=userId;
  this.periodId=periodId;
  this.currPeriodIndex=-1;
  this.currItemIndex=-1;
  this.currTabType = currTabType;
  this.currTagId = currTagId;
  this.viewMode = gViewModeTile;
  this.isPublicEdit=isPublicEdit;
  this.isPublic=isPublic;
  this.isTagView=isTagView;
  this.urlQuery = urlQuery;
  this.getFrom=function() {return replaceStr(this.urlQuery,'&','*');}
  this.isOwner=isOwner;
  this.tagChanged = false;
  this.isLogin = isLogin;
  this.tagDays = tagDays;
  this.nextPageNum=1;
  this.prevPageNum=1;
  this.currPageNum=1;
  this.lastPageNum=1;
  this.lastPageEnd=1;
  this.pageSize=1;
  this.currVideoKey = "";
  this.isSetCookie = isSetCookie;
  this.itemSizeAll = itemSizeAll;
  this.leftSubTab=leftSubTab;
  this.setTagChanged = function(isChanged) {theMGUItemList.tagChanged=isChanged;}
  this.getItemSize = function() {return theMGUItemList.theMGUItems.length;}
  this.getCurrItem = function() {return theMGUItemList.theMGUItems[theMGUItemList.currItemIndex];}
  this.getPeriodSize = function () {return theMGUItemList.theMGUIPeriods.length;}
  this.getCurrPeriod = function () {return theMGUItemList.theMGUIPeriods[theMGUItemList.currPeriodIndex];}
  this.setCurrPeriodIndex = function() {
    for (var i=0;i<theMGUItemList.theMGUIPeriods.length;i++) {
      if (theMGUItemList.theMGUIPeriods[i].periodId ==theMGUItemList.periodId)
        theMGUItemList.currPeriodIndex = i;
    }
  }
  this.setCurrItemIndex=function (idx) {
    theMGUItemList.currItemIndex=parseInt(idx,10);
  }
  this.getSelectedCount=function(){
    var n = 0;
    for (var i=0;i<theMGUItemList.getItemSize();i++) {if (theMGUItemList.theMGUItems[i].selected) n++}
    return n;
  }
}
function MGUIPeriod(periodId, periodName,startYear,imgSrc,itemCount){
  this.periodId=periodId;
  this.periodName=periodName;
  this.startYear=startYear;
  this.imgSrc=imgSrc;
  this.itemCount=itemCount;
}
var scrollTimer = null;
function periodLine_mouse(pId,isOver,pIdx,e) {
  if (isOver==1) {
    var thePeriod = theMGUItemList.theMGUIPeriods[pIdx] ;
    periodLine_callout('<h4"><span class="year">'+thePeriod.startYear+'</span><span class="l20">'+thePeriod.itemCount+'</span><span class="label l2">items</span></h4><h4>'+thePeriod.periodName+'</h4>',thePeriod.periodName);
    $('b'+pId).style.backgroundImage='url(images/periodLine.gif)';
//    $('ipimg'+pId).style.border="1px solid #4685c8";
    $('ipimg'+pId).style.border="1px solid #ff9900";
    $('i'+pId).style.opacity='1';
//    $('i'+pId).style.filter='alpha(opacity=100)';
    var left=getCursor(e)[0]-130;
    periodLine_setCallout(left,156);
 }
  else if (isOver==0){
    if (pId!=theMGUItemList.periodId) {
      $('b'+pId).style.backgroundImage='url(images/periodLine_w.gif)';
      $('ipimg'+pId).style.border="1px solid #fff";
//      $('i'+pId).style.opacity='.35';
//      $('i'+pId).style.filter='alpha(opacity=35)';
    }
    periodLine_setCallout(-3000,0);
  }
  else { // mousemove
    var left=getCursor(e)[0]-130;
    periodLine_setCallout(left,156);
  }
}
function periodLine_callout(s) {
    $$('#calloutc .co_mbox')[0].firstChild.innerHTML = s;
    mshow('calloutc');
    vshow('calloutc');
    return 'calloutc';
}
function periodLine_setCallout(left,top,calloutId) {
  try {
  if (calloutId==null) {
    $('calloutc').style.left = left + 'px';
    $('calloutc').style.top = top + 'px';
  }
  else {
    $(calloutId).style.left = left + 'px';
    $(calloutId).style.top = top + 'px';
  }
  }catch(e){}
}
function resizePaneScroll() {
  var w = getWindowScrollWidth();
  var h = getWindowScrollHeight();
  if ($('editCoverPane').style.display=='block') {
    w = w<1050 ? 1050 : w;
    h = h<1000 ? 1000 : h;
    $('editCoverPane').style.height=h+'px';
    $('editCoverPane').style.width=w+'px';
    if ($('editMain') && w==1050) {
      if ($('editItemPaneIn')) $('editItemPaneIn').style.width='800px';
      $('editItemPane').style.width='1050px';
    }
    else {
      $('editItemPane').style.width=$('editCoverPane').style.width;
      if ($('editItemPaneIn'))  $('editItemPaneIn').style.width=$('editCoverPane').offsetWidth*0.9+'px';
    }
  }
  else { // slideshow
    w = w<860 ? 860 : w;
    h = h<600 ? 600 : h;
    $('coverPane').style.height=h+'px';
    $('coverPane').style.width=w+'px';
  }

}

function periodList_closePop(e) {
  try{
    var target = e.target ? e.target : e.srcElement;
    if (isEmptyString(getParentAll(target,'addPeriodYear'))) {
      mhide('addPeriodYears');
    }
    editItem_closePop(e); 
    vhide('callout');
    mhide('callout');
    if (isEmptyString(getParentAll(target,'calloutb'))) {
      if (target.id!='closeCalloutb') {
        vhide('calloutb');
        mhide('calloutb');
      }
    }
    if (isEmptyString(getParentAll(target,'calloutd'))) {
      if (target.id!='closeCalloutd')
        vhide('calloutd');
    }
    if (isEmptyString(getParentAll(target,'moreMenu')) &&
        isEmptyString(getParentAll(target,'moreMenuLink'))) {
      mhide('moreMenus');
    }
    if (isEmptyString(getParentAll(target,'qAddLink'))) {
      mhide('qAddBox');
    }

    if (tagItemStart) {
      tagItem_click(e);
    }
    if (isEmptyString(getParentAll(target,'img_'))) {
      mhide('bigForList');
    }
  } catch (e){};
}
function readTerm() {
  if (opener) opener.open('term.htm');
  else window.open('term.htm');
}
/*facebook*/
function smallToLarge(src) { // mg: s_ - o_;  fl:'_t.','_b.'; fl & ps:imgmax=144-imgmax=800; fb:'/s','/n'; bb: '/small/', '/large/' and 's.','l.'
  if (src.indexOf('myspace')>-1)
    return replaceStr(src,'s_','l_');
  else if (src.indexOf('hi5.com')>-1)
    return replaceStr(src,'-01.','-02.');
  else
    if (src.indexOf('/small/')==-1)
      return replaceStr(replaceStr(replaceStr(replaceStr(src,'s_','o_'),'_t.','_b.'),'/s','/n'),'imgmax=144','imgmax=800');
    else
      return replaceStr(replaceStr(replaceStr(replaceStr(replaceStr(src,'s_','o_'),'_t.','_b.'),'/small/','/large/'),'imgmax=144','imgmax=800'),'s.','l.');
}
function smallToMedium(src) {
  if (src.indexOf('myspace')>-1)
    return replaceStr(src,'s_','l_');
  else if (src.indexOf('hi5.com')>-1)
    return replaceStr(src,'-01.','-02.');
  else
    if (src.indexOf('/small/')==-1)
      return replaceStr(replaceStr(replaceStr(replaceStr(src,'s_','m_'),'_t.','.'),'/s','/n'),'imgmax=144','imgmax=640');
    else
      return replaceStr(replaceStr(replaceStr(replaceStr(replaceStr(src,'s_','m_'),'_t.','.'),'imgmax=144','imgmax=640'),'s.','l.'),'/small/','/large/');
}
function dwmg() {
  initAppType();
  new Ajax.Request("ajaxAppType.htm?at="+gAPP_TYPE_MYGROWUP);
}

function dwfb() { /*facebook*/
  document.write('<link rel="stylesheet" href="css/fb.css" type="text/css">');
  document.write('<script type="text/javascript" src="js/fb.js"></script>');
  initAppType();
  isFB=true;
  new Ajax.Request("ajaxAppType.htm?at="+gAPP_TYPE_FACEBOOK);
}
function dwbb() {
  document.write('<link rel="stylesheet" href="css/bb.css" type="text/css">');
  document.write('<script type="text/javascript" src="js/bb.js"></script>');
  isBB=true;
  new Ajax.Request("ajaxAppType.htm?at="+gAPP_TYPE_BEBO);
}
function dwms() {
  document.write('<link rel="stylesheet" href="css/ms.css" type="text/css">');
  document.write('<script type="text/javascript" src="js/ms.js"></script>');
  initAppType();
  isMS=true;
  new Ajax.Request("ajaxAppType.htm?at="+gAPP_TYPE_MYSPACE);
}
function dwok() {
  document.write('<link rel="stylesheet" href="css/ok.css" type="text/css">');
  document.write('<script type="text/javascript" src="js/ok.js"></script>');
  initAppType();
  isOK=true;
  new Ajax.Request("ajaxAppType.htm?at="+gAPP_TYPE_ORKUT);
}
function dwhi5() {
  document.write('<link rel="stylesheet" href="css/hi5.css" type="text/css">');
  document.write('<script type="text/javascript" src="js/hi5.js"></script>');
  initAppType();
  isHI5=true;
  new Ajax.Request("ajaxAppType.htm?at="+gAPP_TYPE_HI5);
}
function initAppType() {  // facebook
  isFB=false;
  isBB=false;
  isMS=false;
  isOK=false;
  isHI5=false;
}
function itemList_resizePane() {
  var w = getWindowWidth();
  var h = getWindowHeight();
  if ($('editCoverPane').style.display=='block') {
    w = w<1050 ? 1050 : w;
    h = h<1000 ? 1000 : h;
    $('editCoverPane').style.height=h+'px';
    $('editCoverPane').style.width=w+'px';
  }
  else { // slideshow
    w = w<860 ? 860 : w;
    h = h<600 ? 600 : h;
    $('coverPane').style.height=h+'px';
    $('coverPane').style.width=w+'px';
  }
}
function IdName(id,name) {
  this.id = id;
  this.name = name;
}
function ItemTag(id,name,isFriend,alian,isFeatured) {
  if (alian==null) alian='';
  if (isFriend==null) isFriend=false;
  if (isFeatured==null) isFeatured=false;
  this.id = id;
  this.name = name;
  this.x = 0;
  this.y = 0;
  this.pctX = 0.0;
  this.pctY = 0.0;
  this.isFriend=isFriend;
  this.alian = alian;
  this.isFeatured=isFeatured;
}
function periodList_closeBigSlideRoll() {
  vshow('content');
  mhide('bss');
}
function periodList_bigSlideRoll(userId, isPublicList) {
//  growupPopup("bigSlideRoll.htm?userId="+userId,"bigslideroll",500,400);
  var url = "bigSlideRoll.htm?userId="+userId+"&isPublicList="+isPublicList;
  var inDiv = "bss";
  new Ajax.Updater(inDiv,url,{evalScripts:true,onComplete: function(){
    vhide('content');
    mshow('bss');
  }});
}
// img id: midiIcon, div id: midi
function playMidi(f,iconId) {
  if (isEmptyString(f)) return;
  if (iconId==null) iconId='midiIcon';
  var o = $(iconId);
  if (o.src.indexOf('_off')>-1) {
    $("midi").innerHTML='<object'+
    ' id="MediaPlayer" width="0" height="0" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"'+
    ' codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"'+
    ' standby="Loading Microsoft Windows Media Player components..."'+
    ' type="application/x-oleobject">'+
    ' <param name="FileName" value="'+f+'">'+
    ' <param name="AnimationatStart" value="true">  '+
    ' <param name="TransparentatStart" value="true"> '+
    ' <param name="AutoStart" value="true">             '+
    ' <param name="ShowControls" value="0"> '+
    ' <param name="ShowStatusBar" value="0">  '+
    ' <param name="autoSize" value="false">  '+
    ' <embed type="application/x-mplayer2"  '+
    '  pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&"'+
    '  src="'+f+'"'+
    '  name=MediaPlayer showcontrols=0 width=0 height=0>'+
    ' </embed>'+
  '</object>';
    o.src=replaceStr(o.src,'sound_off','sound_on');
    vshow(iconId);
   }
  else {
    $("midi").innerHTML='';
    o.src=replaceStr(o.src,'sound_on','sound_off');
 }
}
function setJournalDate(d) {
  for (var i=0;i<$('lstMonth').length;i++) {
   if (getMonth(d)==$('lstMonth').options[i].value)
    $('lstMonth').options[i].selected=true;
  }
  for (var i=0;i<$('lstDay').length;i++) {
   if (getDay(d)==$('lstDay').options[i].value)
    $('lstDay').options[i].selected=true;
  }
}

function editItem_closePop(e) {
  var target = e.target ? e.target : e.srcElement;
  if (isEmptyString(getParentAll(target,'editItemTypeTag'))) {
    mhide('categoryList');
  }
}
function shareToFB(url) {
  if (!isEmptyString(url))
    window.open("http://www.facebook.com/sharer.php?u="+escape(url),"mygrowupwindow","width=500,height=400,status=no,toolbar=no,menubar=no,location=no,resizable=no");
}

function loginIncValidate() {
  $('fw').value=location.href;
  if (isEmptyString($('nm').value) || !isValidString($('nm').value,'0123456789abcdefghijklmnopqrstuvwxyz_-')) {
    alert("Invalid username");
    return false;
  }
  if (isEmptyString($('pw').value)) {
    alert("Invalid password");
    return false;
  }
  return true;
}
function periodList_hideComment() {
  mshow('mainBody');
  ahide('mainBody1');
  $('mainBody1').innerHTML='';
}
function periodList_comment(uid,pid,addComment) {
  var url = "ajaxGetComments.htm?userId="+uid+"&tid="+pid+'&ctype='+gCOMMENT_TYPE_PERIOD+'&rdm='+getRandomByDate();
  new Ajax.Updater('mainBody1',url,{evalScripts:true,onComplete: function(){
    mshow('mainBody1');
    $('mainBody1').style.height = Math.max($('mainBody').offsetHeight,$('mainBody1').offsetHeight)+'px';
    mhide('mainBody');
    periodList_refreshComment(addComment);
  }})
}
function periodList_refreshComment(addComment) {
  $('mainBody1').innerHTML ='<h2>Comments on the period:<a href="javascript:periodList_hideComment()" style="font-weight:normal;font-size:11px" class="l20">Hide comments</a></h2>'+$('mainBody1').innerHTML;
  var ret = $('mainBody1').innerHTML;
  if (ret.toLowerCase().indexOf('error')==-1 && ret.toLowerCase().indexOf('exception')==-1 ) {
    setTimeout(function(){changeBrokenImg(iconImgs,'images/noPhoto-100.gif','objs');},100)
    if ($('nocomment') || addComment) {
      mshow('addComm');
      mhide('addCommLink');
    }
  }
  else
    ajaxError();
}
function writeGuestbook() {
  new Effect.BlindDown('writeGuestDiv',{duration:1});
}
function closeWriteGuestbook() {
  $('guestbookCont').value='';
  new Effect.BlindUp('writeGuestDiv',{duration:1});
}
function addGuestbbok(userId) {
  var url = "ajaxAddComment.htm";
  var div = 'guestbook';
  var params = Form.serialize($('guestForm'));
  mhide('writeGuestDiv');
  $('guestbook').innerHTML='<div><img src="images/loading.gif" alt="waiting..." class="l20"></div>'+$('guestbook').innerHTML;
  new Ajax.Updater(div,url,{evalScripts:true,method:'post',parameters:params,onComplete: function(){
    if ($(div).innerHTML.toLowerCase().indexOf('error')==-1 && $(div).innerHTML.toLowerCase().indexOf('exception')==-1 ) {
      $('guestbook').innerHTML=$('duGuestbook').innerHTML;
      vshow('allGuestbook');
      refreshGuestbook(userId);
      if ($('mainBox').style.display=='block')
        allGuestbook(userId,0);
    }
    else {
      ajaxError();
    }
  }});
}
function delGuestbook(userId,commentId) {
  var url = "ajaxDelComment.htm?userId="+userId+'&cid='+commentId+'&ctype='+gCOMMENT_TYPE_USER;
  var div = 'guestbook';
  new Ajax.Updater(div,url,{evalScripts:true,onComplete: function(){
    if ($(div).innerHTML.toLowerCase().indexOf('error')==-1 && $(div).innerHTML.toLowerCase().indexOf('exception')==-1 ) {
      $('guestbook').innerHTML=$('duGuestbook').innerHTML;
      refreshGuestbook(userId);
      allGuestbook(userId,0);
    }
    else {
      ajaxError();
    }
  }});
}

function refreshGuestbook(userId) {
//  $('guestbook').innerHTML='<div id="writeGuestDiv" style="display:none"><form id="guestForm"><input type="hidden" name="userId" value="'+userId+'"><input type="hidden" name="ctype" value="'+gCOMMENT_TYPE_USER+'"><textarea style="width:95%;heihgt:100px;font-size:10px" name="comm" id="guestbookCont"></textarea><div><input type="button" value="Add" style="font-size:9px" onclick="addGuestbbok('+userId+')"><input type="button" value="Cancel" style="font-size:9px" onclick="closeWriteGuestbook()"></div></form></div>'+$('guestbook').innerHTML;
  var ret = $('guestbook').innerHTML;
  if (ret.toLowerCase().indexOf('error')==-1 && ret.toLowerCase().indexOf('exception')==-1 ) {
  }
  else
    ajaxError();
}
function allGuestbook(userId,page) {
  if (page==null) page=0;
  var url = "ajaxGuestbook.htm?userId="+userId+"&p="+page;
  var div = 'mainBox';
  new Ajax.Updater(div,url,{evalScripts:true,onComplete: function(){
    mhide('periodNavPanel');
    $('mainBox').className="guestbook";
    mshow('mainBox');
    location.href = "#top";
  }});
}
function closeGuestbook() {
  ahide('mainBox');
  mshow('periodNavPanel');
}
function periodList_sharePeriod(userId, periodId,e,create) {
  if (create==null) create=false;
  if (create) {
    if (!confirm("Your previous share link will become invalid. Your friends who received this link before will no longer be able to see this period. Continue?")) return;
  }
  var p = create ? '&actionParam=generate' : '';
  var url = "sharePeriodLink.htm?userId="+userId+"&periodId="+periodId+p;  
  var cur = getCursor(e);
  var left=cur[0]-10;
  var top=cur[1];
  new Ajax.Updater("sharePeriodLinkHide",url,{onComplete: function(){
    if ($('pt'+periodId))
      setTimeout(function(){periodList_mouseLine(1,periodId);},10);
    if ($('sharePeriodLinkHide').innerHTML.indexOf('error')>-1) {
      $("sharePeriodLinkHide").innerHTML='';
      mhide("sharePeriodLinkHide");
      ajaxError();
    }
    else {
      $$('#calloutb .co_mboxb')[0].firstChild.innerHTML = $("sharePeriodLinkHide").innerHTML;
      if (!create) {
        mshow('calloutb');
        vshow('calloutb');
        $('calloutb').style.left = left + 'px';
        $('calloutb').style.top = (top-$('calloutb').offsetHeight) + 'px';
      }
    }
  }});
}
function periodList_sharePeriodFB(userId, periodId) {
  var url = "sharePeriodLink.htm?userId="+userId+"&periodId="+periodId;
  new Ajax.Updater("sharePeriodLinkHide",url,{onComplete: function(){
    if ($('pt'+periodId))
      setTimeout(function(){periodList_mouseLine(1,periodId);},10);
    if ($('sharePeriodLinkHide').innerHTML.indexOf('error')>-1) {
      $("sharePeriodLinkHide").innerHTML='';
      mhide("sharePeriodLinkHide");
      ajaxError();
    }
    else {
      shareToFB($("sharePUrl").value);
    }
  }});
}
function periodList_shareSlideRoll(userId, e,create) {
  if (create==null) create=false;
  if (create) {
    if (!confirm("Your previous share link will become invalid. Your friends who received this link before will no longer be able to see your Life Roll. Continue?")) return;
  }
  var p = create ? '&actionParam=generate' : '';
  var url = "shareSlideRoll.htm?userId="+userId+p;
  var cur = getCursor(e);
  var left=cur[0]-10;
  var top=cur[1];
  new Ajax.Updater("sharePeriodLinkHide",url,{onComplete: function(){
    if ($('sharePeriodLinkHide').innerHTML.indexOf('error')>-1) {
      $("sharePeriodLinkHide").innerHTML='';
      mhide("sharePeriodLinkHide");
      ajaxError();
    }
    else {
      $$('#calloutd .co_mboxd')[0].firstChild.innerHTML = $("sharePeriodLinkHide").innerHTML;
      if (!create) {
        $('calloutd').style.left = (left-$('calloutd').offsetWidth+20) + 'px';
        $('calloutd').style.top = (top+10) + 'px';
      }
      vshow('calloutd');
    }
  }});
}
function periodList_shareSlideRollFB(userId) {
  var url = "shareSlideRoll.htm?userId="+userId;
  new Ajax.Updater("sharePeriodLinkHide",url,{onComplete: function(){
    if ($('sharePeriodLinkHide').innerHTML.indexOf('error')>-1) {
      $("sharePeriodLinkHide").innerHTML='';
      mhide("sharePeriodLinkHide");
      ajaxError();
    }
    else {
      shareToFB($("shareLRUrl").value);
    }
  }});
}
function bigPhotoEvent() {
  $('bigPhoto').observe('mouseover',function(e) {
    itemList_showSlideControl(true);
  });
  $('bigPhoto').observe('mouseout',function(e) {
    if (!e.element().down('#bigPhoto'))
      setTimeout(function(){itemList_showSlideControl(false);},2000);
  });
}