/*************************************************************
 All.js is a combination of three different javascript files:

cookies.js 
   - handles getting/setting cookies. Copied from somewhere on the 'net
ac.js      
   - code written by Google Inc for Google Suggest. Don't even try to read it - it has been compressed (and obfuscated) by Google.
googlex.js 
   - Written by me (Jay of Jay's Site.com). This is the main Google X code.

**************************************************************/



/*********************/
/* Begin: cookies.js */
/*********************/
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1) endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
  }
  
  
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)  return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
    }
  return null;
  }
  

function SetCookie (name, value) {
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  //var expires = (argc > 2) ? argv[2] : null;
  curdate = new Date();
  curdate.setDate(curdate.getDate() + 365); // cookie lasts one year
  var expires = curdate;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) +
  ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  ((path == null) ? "" : ("; path=" + path)) +
  ((domain == null) ? "" : ("; domain=" + domain)) +
  ((secure == true) ? "; secure" : "");
  }


function DeleteCookie (name) {
  var exp = new Date();
  exp.setTime (exp.getTime() - 1); // This cookie is history
  var cval = GetCookie (name);
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
  }








/****************/
/* Begin: ac.js */
/****************/
// Note that I did make some probably-unneccessary edits trying to debug a stupid IE problem, but I don't remember which edits they were.

// Input 0
var y="";var Pb=false;var Ba="";var fa=false;var g="";var H="";var n="";var k=-1;var i=null;var Z=-1;var Ia=null;var Na=5;var r="";var Tb="div";var Kb="span";var sa=null;var a=null;var b=null;var jb=null;var xb=null;var W=null;var la=null;var za=false;var fb=new Object();var ea=1;var Ma=1;var va=false;var aa=false;var ua=-1;var gb=(new Date()).getTime();var P=false;var l=null;var Aa=null;var F=null;var N=null;var ca=null;var ka=false;var Ua=false;var q=60;var na=null;var Ha=null;var V=0;var hb=null;var ma=null;var oa=null;var Ea=false;var X=false;

InstallAC=function(frm,fld,sb,pn,rl,hd,sm,ufn){

	sa=frm;a=fld;jb=sb;
	if(!pn)pn="complete.php";
	na=pn;
	var Sb="zh|zh-CN|zh-TW|ja|ko|";
	if(!rl||rl.length<1)rl="en";
	la=yb(rl);
	if(Sb.indexOf(la+"|")==-1){W=true;aa=false;va=false;ka=false}
	else{W=false;aa=true;if(la.indexOf("zh")==0)va=false;ka=true}
	if(!hd)hd=false;Ha=hd;if(!sm)sm="query";y=sm;xb=ufn;
	kc();
	}

;function ub(){za=true;a.blur();setTimeout("sfi();",10);return}
function Ob(){if(document.createEventObject){var Ka=document.createEventObject();Ka.ctrlKey=true;Ka.keyCode=70;document.fireEvent("onkeydown",Ka)}}
function Xb(h){if(!h&&window.event)h=window.event;if(h)ua=h.keyCode;if(h&&h.keyCode==8){if(W&&(a.createTextRange&&(h.srcElement==a&&(ja(a)==0&&qa(a)==0)))){nc(a);h.cancelBubble=true;h.returnValue=false;return false}}}
function Mb(){if(y=="url"){Sa()}da()}
function da(){if(b){b.style.left=zb(a)+"px";b.style.top=Yb(a)+a.offsetHeight-1+"px";b.style.width=Ta()+"px"}}
function Ta(){if(navigator&&navigator.userAgent.toLowerCase().indexOf("msie")==-1){return a.offsetWidth-ea*2}else{return a.offsetWidth}}
function kc(){
	if(vb()){P=true}
	else{P=false}
	if(Pb)F="complete.php";
	else F="/"+na;

	Aa=F+"?hl="+la;
	if(!P){ya("qu","",0,F,null,null)}
	//sa.onsubmit=Qa;
	a.autocomplete="off";
	a.onblur=Wb;a.onfocus=lc;
	if(a.createTextRange)a.onkeyup=new Function("return okuh(event); ");
	else a.onkeyup=okuh;
	//a.onsubmit=Qa;
	g=a.value;Ba=g;
	b=document.createElement("DIV");
	b.id="completeDiv";ea=1;Ma=1;b.style.borderRight="black "+ea+"px solid";
	b.style.borderLeft="black "+ea+"px solid";b.style.borderTop="black "+Ma+"px solid";
	b.style.borderBottom="black "+Ma+"px solid";b.style.zIndex="1";b.style.paddingRight="0";
	b.style.paddingLeft="0";b.style.paddingTop="0";b.style.paddingBottom="0";da();
	b.style.visibility="hidden";b.style.position="absolute";b.style.backgroundColor="white";

	doAppend(document.body,b);

	Wa("",new Array(),new Array());Qb(b);
	var t=document.createElement("DIV");
	t.style.visibility="hidden";t.style.position="absolute";t.style.left="-10000";
	t.style.top="-10000";t.style.width="0";t.style.height="0";
	var L=document.createElement("IFRAME");
	L.completeDiv=b;L.name="completionFrame";L.id="completionFrame";L.src=Aa;
	doAppend(t,L);

	doAppend(document.body,t);
	return;

	if(frames&&(frames["completionFrame"]&&frames["completionFrame"].frameElement))N=frames["completionFrame"].frameElement;else N=document.getElementById("completionFrame");if(y=="url"){Sa();da()}window.onresize=Mb;document.onkeydown=Xb;Ob();

	if(ka){setTimeout("idkc()",10);if(a.attachEvent){a.attachEvent("onpropertychange",Zb)}}

	}
function lc(h){X=true}
function Wb(h){X=false;if(!h&&window.event)h=window.event;if(!za){G();if(ua==9){jc();ua=-1}}za=false}
okuh=function(e){if (!enableAC) return;if(!Ea){Ea=true}n=e.keyCode;ca=a.value;Xa()}
;function jc(){jb.focus()}
sfi=function(){a.focus()}
;function hc(Da){for(var c=0,wa="",Ib="\n\r";c<Da.length;c++)if(Ib.indexOf(Da.charAt(c))==-1)wa+=Da.charAt(c);else wa+=" ";return wa}
function Za(j,oc){var ia=j.getElementsByTagName(Kb);if(ia){for(var c=0;c<ia.length;++c){if(ia[c].className==oc){var Y=ia[c].innerHTML;if(Y=="&nbsp;")return"";else{var A=hc(Y);return A}}}}else{return""}}
function T(j){if(!j)return null;return Za(j,"cAutoComplete")}
function Fa(j){if(!j)return null;return Za(j,"dAutoComplete")}
function G(){document.getElementById("completeDiv").style.visibility="hidden"}
function nb(){document.getElementById("completeDiv").style.visibility="visible";da()}
function Wa(is,cs,ds){fb[is]=new Array(cs,ds)}
sendRPCDone=function(fr,is,cs,ds,pr){if(V>0)V--;var rc=(new Date()).getTime();if(!fr)fr=N;Wa(is,cs,ds);var b=document.getElementById("completeDiv");b.completeStrings=cs;b.displayStrings=ds;b.prefixStrings=pr;Cb(b,b.completeStrings,b.displayStrings);Ya(b,T);if(Na>0)b.height=16*Na+4;else G()}
;function Xa(){if(n==40||n==38)ub();var M=qa(a);var w=ja(a);var U=a.value;if(W&&n!=0){if(M>0&&w!=-1)U=U.substring(0,w);if(n==13||n==3){var f=a;if(f.createTextRange){var u=f.createTextRange();u.moveStart("character",f.value.length);u.select()}else if(f.setSelectionRange){f.setSelectionRange(f.value.length,f.value.length)}}else{if(a.value!=U)R(U)}}g=U;if(Nb(n)&&n!=0)Ya(b,T)}
function Qa(){return Gb(y)}
function Gb(pb){fa=true;if(!P){ya("qu","",0,F,null,null)}G();if(pb=="url"){var Q="";if(k!=-1&&i)Q=T(i);if(Q=="")Q=a.value;if(r=="")document.title=Q;else document.title=r;var dc="window.frames['"+xb+"'].location = \""+Q+'";';setTimeout(dc,10);return false}else if(pb=="query"){submitit();return true}}
newwin=function(){window.open(a.value);G();return false}
;idkc=function(e){if(ka){if(X){eb()}var db=a.value;if(db!=ca){n=0;Xa()}ca=db;setTimeout("idkc()",10)}}
;function yb(Va){if(encodeURIComponent)return encodeURIComponent(Va);if(escape)return escape(Va)}
function Hb(Ub){var I=100;for(var p=1;p<=(Ub-2)/2;p++){I=I*2}I=I+50;return I}
idfn=function(){if(Ba!=g){if(!fa){var lb=yb(g);var ta=fb[g];if(ta){gb=-1;sendRPCDone(N,g,ta[0],ta[1],document.getElementById("completeDiv").prefixStrings)}else{V++;gb=(new Date()).getTime();if(P){qc(lb)}else{ya("qu",lb,null,F,null,null);frames["completionFrame"].document.location.reload(true)}}a.focus()}fa=false}Ba=g;setTimeout("idfn()",Hb(V));return true}
;setTimeout("idfn()",10);var Lb=function(){R(T(this));r=Fa(this);fa=true;Qa()}
;var Ab=function(){if(i)m(i,"aAutoComplete");m(this,"bAutoComplete")}
;var pc=function(){m(this,"aAutoComplete")}
;function xa(D){g=H;R(H);r=H;if(!Ia||Z<=0)return;nb();if(D>=Z){D=Z-1}if(k!=-1&&D!=k){m(i,"aAutoComplete");k=-1}if(D<0){k=-1;a.focus();return}k=D;i=Ia.item(D);m(i,"bAutoComplete");g=H;r=Fa(i);R(T(i))}
function Nb(pa){if(pa==40){xa(k+1);return false}else if(pa==38){xa(k-1);return false}else if(pa==13||pa==3){return false}return true}
function Ya(K,Pa){var f=a;var S=false;k=-1;var B=K.getElementsByTagName(Tb);var O=B.length;Z=O;Ia=B;Na=O;H=g;if(g==""||O==0){G()}else{nb()}var Jb="";if(g.length>0){var c;var p;for(var c=0;c<O;c++){for(p=0;p<K.prefixStrings.length;p++){var cb=K.prefixStrings[p]+g;if(va||(!aa&&Pa(B.item(c)).toUpperCase().indexOf(cb.toUpperCase())==0||aa&&(c==0&&Pa(B.item(c)).toUpperCase()==cb.toUpperCase()))){Jb=K.prefixStrings[p];S=true;break}}if(S){break}}}if(S)k=c;for(var c=0;c<O;c++)m(B.item(c),"aAutoComplete");if(S){i=B.item(k);r=Fa(i)}else{r=g;k=-1;i=null}var mb=false;switch(n){case 8:case 33:case 34:case 35:case 35:case 36:case 37:case 39:case 45:case 46:mb=true;break;default:break}if(!mb&&i){var Oa=g;m(i,"bAutoComplete");var A;if(S)A=Pa(i).substr(K.prefixStrings[p].length);else A=Oa;if(A!=f.value){if(f.value!=g)return;if(W){if(f.createTextRange||f.setSelectionRange)R(A);if(f.createTextRange){var u=f.createTextRange();u.moveStart("character",Oa.length);u.select()}else if(f.setSelectionRange){f.setSelectionRange(Oa.length,f.value.length)}}}}else{k=-1;r=g}}
function zb(s){return kb(s,"offsetLeft")}
function Yb(s){return kb(s,"offsetTop")}
function kb(s,na){var wb=0;while(s){wb+=s[na];s=s.offsetParent}return wb}
function ya(z,Y,ab,tb,qb,cc){var Vb=z+"="+Y+(ab?"; expires="+ab.toGMTString():"")+(tb?"; path="+tb:"")+(qb?"; domain="+qb:"")+(cc?"; secure":"");document.cookie=Vb}
function Sa(){var Ga=document.body.scrollWidth-220;Ga=0.73*Ga;a.size=Math.floor(Ga/6.18)}
function qa(o){var M=-1;if(o.createTextRange){var ha=document.selection.createRange().duplicate();M=ha.text.length}else if(o.setSelectionRange){M=o.selectionEnd-o.selectionStart}return M}
function ja(o){var w=0;if(o.createTextRange){var ha=document.selection.createRange().duplicate();ha.moveEnd("textedit",1);w=o.value.length-ha.text.length}else if(o.setSelectionRange){w=o.selectionStart}else{w=-1}return w}
function nc(f){if(f.createTextRange){var u=f.createTextRange();u.moveStart("character",f.value.length);u.select()}else if(f.setSelectionRange){f.setSelectionRange(f.value.length,f.value.length)}}
function m(d,z){ob();d.className=z;if(Ua){return}switch(z.charAt(0)){case "m":d.style.fontSize="13px";d.style.fontFamily="arial,sans-serif";d.style.wordWrap="break-word";break;case "l":d.style.display="block";d.style.paddingLeft="3";d.style.paddingRight="3";d.style.height="16px";d.style.overflow="hidden";break;case "a":d.style.backgroundColor="white";d.style.color="black";if(d.displaySpan){d.displaySpan.style.color="green"}break;case "b":d.style.backgroundColor="#3366cc";d.style.color="white";if(d.displaySpan){d.displaySpan.style.color="white"}break;case "c":d.style.width=q+"%";d.style.cssFloat="left";break;case "d":d.style.cssFloat="right";d.style.width=100-q+"%";if(y=="query"){d.style.fontSize="10px";d.style.textAlign="right";d.style.color="green";d.style.paddingTop="3px"}else{d.style.color="#696969"}break}}
function ob(){q=65;if(y=="query"){var Fb=110;var bb=Ta();var Db=(bb-Fb)/bb*100;q=Db}else{q=65}if(Ha){q=99.99}}
function Qb(j){ob();var ec="font-size: 13px; font-family: arial,sans-serif; word-wrap:break-word;";var gc="display: block; padding-left: 3; padding-right: 3; height: 16px; overflow: hidden;";var mc="background-color: white;";var Bb="background-color: #3366cc; color: white ! important;";var Eb="display: block; margin-left: 0%; width: "+q+"%; float: left;";var Ra="display: block; margin-left: "+q+"%;";if(y=="query"){Ra+="font-size: 10px; text-align: right; color: green; padding-top: 3px;"}else{Ra+="color: #696969;"}E(".mAutoComplete",ec);E(".lAutoComplete",gc);E(".aAutoComplete *",mc);E(".bAutoComplete *",Bb);E(".cAutoComplete",Eb);E(".dAutoComplete",Ra);m(j,"mAutoComplete")}
function Cb(j,cs,Rb){while(j.childNodes.length>0)j.removeChild(j.childNodes[0]);for(var c=0;c<cs.length;++c){var v=document.createElement("DIV");m(v,"aAutoComplete");v.onmousedown=Lb;v.onmouseover=Ab;v.onmouseout=pc;var ra=document.createElement("SPAN");m(ra,"lAutoComplete");var Ca=document.createElement("SPAN");Ca.innerHTML=cs[c];var ga=document.createElement("SPAN");m(ga,"dAutoComplete");m(Ca,"cAutoComplete");v.displaySpan=ga;if(!Ha)ga.innerHTML=Rb[c];

doAppend(ra,Ca);
doAppend(ra,ga);
doAppend(v,ra);
doAppend(j,v);

}}
function doAppend(toelm,elm) {
toelm.appendChild(elm);
return;


  }
function E(z,rb){if(Ua){var J=document.styleSheets[0];if(J.addRule){J.addRule(z,rb)}else if(J.insertRule){J.insertRule(z+" { "+rb+" }",J.cssRules.length)}}}
function vb(){var C=null;try{C=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{C=new ActiveXObject("Microsoft.XMLHTTP")}catch(sc){C=null}}if(!C&&typeof XMLHttpRequest!="undefined"){C=new XMLHttpRequest()}return C}
function qc(ac){
        if (!enableAC) return;
	if(l&&l.readyState!=0){l.abort()}l=vb();
	if(l){
	  l.open("GET","complete.php?qu="+ac,true);
	  l.onreadystatechange=function(){
	    if(l.readyState==4&&l.responseText){
	      if(l.responseText.charAt(0)=="<"){V--}
	      else{eval(l.responseText)}
	      }
	    }
	  l.send(null)
	  }
        }
function R(ib){a.value=ib;ca=ib}
function Zb(h){if(!h&&window.event)h=window.event;if(!Ea&&(X&&h.propertyName=="value")){if(fc()){eb();setTimeout("ba("+ma+", "+oa+");",30)}}}
function fc(){var ic=a.value;var La=ja(a);var Ja=qa(a);return La==ma&&(Ja==oa&&ic==hb)}
function eb(){hb=a.value;ma=ja(a);oa=qa(a)}
ba=function(La,Ja){if(La==ma&&Ja==oa){bc()}}
;function bc(){ub();xa(k+1)}












/*********************/
/* Begin: googlex.js */
/*********************/
/* This is the main Google X Code */


// Check the user's cookie for which dock type to display (there's Text-Only, Wave, and Single Zoom)
dockstyle=GetCookie("dockstyle");
if (dockstyle == "text") textDock=true; // display a text dock
else textDock=false; // the dock is not a text dock

if (dockstyle == "single") realDock=false; // single zoom
  else realDock=true; // wave (true Mac OS X style)

// Define some variables.
// Some of the variables are confusing because this code is based on the original obfuscated Google X code
x=false;
af=Math.floor;
ag=RegExp;
b_2=new Array(13);
s=new Array("null","web","images","groups","news","froogle","local","scholar","video","maps","answers","labs","gmail","more");
lgs=new Array("null","/google-x-logo.gif","http://www.google.com/intl/en_ALL/images/images_hp.gif","null","null","http://froogle.google.com/froogle/images/froogle_110tall.gif","http://local.google.com/images/local_hp_logo.gif","http://scholar.google.com/images/scholar_logo.gif","/googlex_files/video-logo.jpg","null","null","http://googlex.jayssite.com/googlex_files/logo2.gif","null");
aa_2=new Array(11);
ab=10;
t=0;
u=0;
n=0;
o=new Date();
h=5;
m_2=385;
c=0;
w=x;
var title;
var firstHoverOccurred=x;
m_2=385;
p=0;
mc=0;


function gebid(elid) { 
  // Just a quicker reference to document.getElementById. [G]et [E]lement [B]y ID
  return document.getElementById(elid); 
  }

await=0;
var moto;
function dockmouseout(instant) {  // the user moved the mouse away from the dock
  clearTimeout(moto);
  clearTimeout(st); // this timeout, calls dockmouseout (this function), is cleared to prevent any repeat calls
  
  // wait just a little bit (10ms) before continuing to dockmouseout2
  moto=setTimeout("dockmouseout2('"+Number(instant)+"')",10);
  }


function dockmouseout2(instant) {
  clearTimeout(st);
  if (new Date() - lastcall < 50) {  // make sure we wait at least 50 milliseconds before calling it again
    st=setTimeout("dockmouseout()",20); 
    return; 
    }
  lastcall= new Date();
  if (!realDock) return;
  
  if (blankat!=-1 && !(totalIcons<=3 || dragvalue=="more" || dragvalue=="web" || dragopt)) blankat=-2;

  for (i=1;i<totalIcons;i++) {
    targetSizes[i] = 35;
    }
  return;
/*  if (instant===1 && 0) gidle(1);
   else if (!await) {
    setTimeout("gidle(0)",20);
    }
    */
  }

var lastcall= new Date();
var st;
function dockmousemove(instant) {
  clearTimeout(st);
  if (new Date() - lastcall < 50) { st=setTimeout("dockmousemove('"+Number(instant)+"')",20); return; }
  lastcall= new Date();
  //if (!realDock) return;

  var thedk = gebid("thedock");
  trashit=oft=0;
  el=thedk;
  oft += el.offsetTop;
  
  // climb the element hierarchy to discover the element's position relative to the top of the document
  while (el.offsetParent) { el=el.offsetParent; oft += el.offsetTop; }
  
  if (tMouseY+70 < oft) trashit=1;
  if (tMouseY-20 > thedk.offsetHeight+oft) trashit=1;
  if (trashit && (totalIcons<=3 || dragvalue=="more" || dragvalue=="web" || dragopt)) {
    trashit=0;
    return;
    }
  if (trashit) return dockmouseout(instant);

  var ofl=0;
  var el = gebid("image_"+dockSetup[1]);
  ofl += el.offsetLeft;
  while (el.offsetParent) { el=el.offsetParent; ofl += el.offsetLeft; }
  
  var wd = gebid("thedock").offsetWidth;
  wd -= wd%10;
  var clk = tMouseX-ofl;
  if (clk<(wd/2))clk -= 10;
  //else clk += 10;
  
  clk -= clk%3;
  iw = Math.floor(wd/totalIcons) + 2; // iw=average Icon Width based on dock width. +2 for good luck.
  spots=[];
  for (i=1;i<totalIcons;i++) {
    spots[i] = (i-1)*iw + (iw/2);
    var dif=Math.abs(spots[i] - clk);  // based on the image's distance from the mousemove event, the image's size is calculated.
    if (blankat!=-1 && dif < (iw/2)) {
      no=0;
      if (spots[i] < clk && i == blankat+2) blankat = i;
      else if (spots[i] > clk) blankat = i-1;
      else if (Math.abs(blankat-i)>1) blankat=i;
      }
    if (blankat!=-1 && Math.abs(wd-clk)<(iw/2)) {
      blankat=totalIcons-1;
      }
    ui=i;
    if (blankat!=-1 && blankat < i-1) ui=i-1;
    if (realDock) targetSizes[ui] = Math.min(Math.max(35, 75-(dif/2)),70);
    }
  
  if (instant===1) gidle(1);
   else if (!await) {
    await=1;
    setTimeout("gidle(0)",zoomInterval+50);
    }
  }


// these functions are from the original obfuscated Google X code by Google. These functions are still used to change the 'imageTitle' label.
function d(ac){ 
  ac = dockLocation[ac];
  clearTimeout(moto);
  if (!realDock) targetSizes[ac] = 70;
  dockmousemove();
  c=ac;
  oc=c;
  o=new Date();
  if (!await) {
    await=1;
    setTimeout("gidle(0)",zoomInterval);
    }
  }


function e(ac) {
  ac = dockLocation[ac];
  if (!realDock) targetSizes[ac] = 35;
  c=0;
  w=x;
  o=new Date();
  if (!await) {
    await=1;
    setTimeout("gidle(0)",zoomInterval);
    }
  }
  
  
function ae(){
  try { gebid("searchquery").focus(); } catch(e){}
  enableAC=true;
  InstallAC(document.f,document.f.q,document.f.btnG,"search","en");
  for(var j=1;j<b_2.length;j++){
    b_2[j]=35
    }
  for(i=1; i<dockSetup.length; i++){
    aa_2[i]=new Image();
    aa_2[i].src="googlex_files/"+dockSetup[i]+".gif"
    }
  
  // preload large images:
  for(i=1; i<dockSetup.length; i++){
    if (lgs[i]=="null")continue;
    aa_2[i]=new Image();
    aa_2[i].src="googlex_files/"+dockSetup[i]+".gif"
    }
  if (!await) {
    await=1;
    setTimeout("gidle(0)",zoomInterval);
    }
  }
  
  
function handleError() { return true; }
window.onerror = handleError; // i've debugged all run-time errors, but sometimes errors occur if a user clicks something before the page is fully loaded

zoomSpeed=8;
zoomInterval = 10;
blankMoveSpeed=20;
if (!realDock) zoomInterval=10;
dockSetup = defaultDock = ["null","web","images","groups","news","froogle","local","maps","answers","labs","gmail","more"];

if (String(GetCookie("docksetup")) != "null") {
  dockSetup = unescape(GetCookie("docksetup")).split(",");
  }
if (dockSetup.length < 3) dockSetup = defaultDock;
var totalIcons = dockSetup.length;

imageSizes=[];
targetSizes=[];
tcolor=255;
oc=1;
curTitle="Web Search";
var mcounter=0;
for (i=0;i<totalIcons;i++) { imageSizes.push(35); targetSizes.push(35); }


function gidle(instant) { // completely rewritten by Jay of JaysSite.com to accomodate realistic dock style
  var rep=0; // rep is whether or not gidle needs to finish any animation. we'll assume no for now.
  for (i=1; i<totalIcons; i++) { // this loop goes through each icon and animates it a little if needed
    var dif=Math.abs(imageSizes[i] - targetSizes[i]);
    zoomChange=Math.min(zoomSpeed,dif);
    if (instant) zoomChange=dif;
    // resize image:
    if (imageSizes[i] > targetSizes[i]) {
      imageSizes[i]-=zoomChange; rep=1;
      }
    else if (imageSizes[i] < targetSizes[i]) {
      imageSizes[i]+=zoomChange; rep=1;
      }
    else {
      // image didn't need resizing, so skip the rest of this loop
      continue;
      }
    var img=gebid("image_"+dockSetup[i]);
    if (!img) alert(" no image_"+dockSetup[i]+" (i is "+i+", dockSetup[i] is "+dockSetup[i]+")");
    var sz = imageSizes[i];
    if (sz>=50) img.src = "googlex_files/"+dockSetup[i]+".gif";
     else img.src = "googlex_files/"+dockSetup[i]+"-sm.gif";
    img.height=sz;
    img.width=sz;
    }
  if (!title) {
    await=0; // await is a variable that just prevents this from function from executing on every single mousemove
    return; // this prevents an error that may happen before the page is fully loaded
    }

   if (oc>=totalIcons) oc=totalIcons-2;
   if (c>=totalIcons) c=totalIcons-2;
   var nt=(70-imageSizes[oc]) + gebid("thedocktable").offsetTop - 14;
   var mb = gebid("image_"+dockSetup[oc]).style.marginBottom;
   if (mb) {
     mb=mb.replace( /[^0-9]/g,"");
     if (mb.length > 0 && mb < 20) nt -= mb;
     }

   if (nt>130)nt=135;
   //nt += 5;
   title.style.top=nt + "px";

   var stl= gebid("image_"+dockSetup[oc]).offsetLeft - 75 + (gebid("image_"+dockSetup[oc]).offsetWidth/2);
   stl += 5;
   title.style.left= stl + "px";


  if (c>0) {
	  if (curTitle!=document.getElementById("image_"+dockSetup[c]).alt) {

	    title.innerHTML=curTitle=document.getElementById("image_"+dockSetup[c]).alt;
	    }
      }

  var notupd=0;
  if (blankat!=-1 || (c==0 && tcolor<255)) {
    tcolor+=30; // lighter (disappear)
    if (instant) tcolor=255;
    }
  else if (c>0 && tcolor>0) {
    tcolor-=30; // darker (appear)
    if (instant) tcolor=0;
    }
  else notupd=1;

  if (!notupd) {
    tcolor = Math.max(Math.min(tcolor,255),0);
    if (tcolor > 0 && tcolor < 255) rep=1;
    title.style.color = "rgb("+tcolor+","+tcolor+","+tcolor+")";
    if (tcolor==255 || textDock) {
      if (title.style.visibility!="hidden" || textDock) title.style.visibility="hidden";
      }
    else if (title.style.visibility!="visible") {
      title.style.visibility="visible";
      }
    }
//window.status="mcounter="+(++mcounter);

  if (blankat != -1 ) {
     for (i=0;i<dockSetup.length;i++) {

       var nw=0;
       if (i==blankat) nw=80;
       var cb = gebid("blank_"+dockSetup[i]);
       if (!cb) alert("no blank_"+dockSetup[i]+" (i is "+i+")");
       if (cb.style.display=="none" && nw>0) {
          cb.width=0;
          cb.style.display="inline";
          }
        else if (cb.style.display=="inline" && cb.width==0) cb.style.display="none";
       if (cb.width>nw) nw = cb.width - blankMoveSpeed;
       else if (cb.width < nw) nw = cb.width + blankMoveSpeed;
       else continue;
       nw = Math.min(70,Math.max(0,nw))
       rep=1;
       cb.width=nw;
       if (!textDock) cb.height=70;
       }
  	 }

  if (rep||instant) {
    await=1;
    setTimeout("gidle(0)",zoomInterval); // if animations aren't finished yet, plan to come back.
    }
    else await=0;
  }


function submitit() {
  fsub();
  gebid("theform").submit();
  }


var s_al=false;
weathermode=false;


function fsub() {
  // this function just gets rid of unneccessary GMail login form fields if the user isn't logging into GMail.
  // if the user is logging into GMail, it sets a cookie to enable mail notification
  if (s_al) return true;
  if (weathermode) return false;
  s_al=true;
  if (gmailmode) {
    var c_u = gebid("gmuser").value;
    var c_p = gebid("gmpass").value;
    if (c_u.length>=6 || c_p.length>=2) {
      SetCookie("autonotf_user",c_u);
      SetCookie("autonotf_pass",c_p);
      }
    }
  else {
    gebid("gmaillogin").innerHTML="";
    if (gebid("theform").action=="http://www.google.com/dirhp") {
      gebid("theform").action = "http://www.google.com/search";
      gebid("gmaillogin").innerHTML="<input type=hidden name=cat value=gwd/Top>";
      }
    else if (gebid("theform").action=="http://www.google.com/define") {
      gebid("theform").action = "http://www.google.com/search";
      gebid("neari").value="define:"+gebid("searchquery").value;
      gebid("neari").name="q";
      gebid("searchquery").name="";
      gebid("searchquery").value="";
      }
    }
  return true;
  }
  
  
var g_newmail=0;


function new_mail(nnm) {
  g_newmail=1;
  if (gebid("image_gmail")) {
    gebid("image_gmail").alt = "Gmail ("+nnm+")";
    }
  tdText["gmail"] = "Gmail ("+nnm+")";
  if (textDock) {
    gebid("thedock").innerHTML = getDockHTML();
    dockmouseout(1);
    }
  edStuff();
  }
  
  
var gmailmode=false;
var curzip;
weather=[];


function getweather() {
  curzip = gebid("weatherzip").value;
  if (curzip == "") { // user probably wants to clear cookie
    SetCookie("weather","");
    gebid("showweather").innerHTML = "";
    return;
    }
  if (!gebid("fixiebug")) {
    setTimeout("getweather()",500);
    return;
    }

  var sc = document.createElement("script");
  gebid("fixiebug").appendChild(sc);

  sc.src="/getweather.php?zip="+curzip;
  }

function updweather() {
  gebid("weatherzip").focus();
  gebid("weatherzip").select();
  if (typeof weather[curzip] != "undefined") {
    gebid("showweather").innerHTML = weather[curzip] + "<br><font size=-2><a href='http://www.weather.com/activities/other/other/weather/fcst-hrly.html?locid="+curzip+"'>Hourly Forecast</a> - <a href='http://www.weather.com/activities/other/other/weather/tenday.html?locid="+curzip+"'>10 Day Forecast</a></font>";
    SetCookie("weather",curzip);
    }
   else gebid("showweather").innerHTML = "<font color=red>Invalid location</font>";
  }
  

function ns() {
  lg=gebid("logo");
  lg.height=110;
  lg.width=276;
  lg.style.paddingTop="0px";
  document.body.style.backgroundImage="";
  gebid("feellucky").style.display="none";
  gebid("linebreak").style.display="none";
  gebid("inputrow").align="right";
  gebid("searchquery").size=40;
  gebid("sbtn").value="Google Search";

  gebid("extraoptions").style.display="";
  gebid("spacingrow").style.display="";
  gebid("inputrow").colSpan=1;
  gebid("glocal").style.display="none";
  gebid("localhelp").style.display="none";
  gebid("prefslink").innerHTML = "Preferences";
  gebid("prefslink").href = "http://www.google.com/preferences?hl=en";
  gebid("gmaillogin").style.display = "none";
  gebid("moregoogle").style.display="none";
  gebid("weather").style.display="none";
  gebid("normalsearch").style.display = "inline";
  gebid("directorycats").style.display="none";
  try{
     gebid("searchquery").focus();
     }
  catch(e){}
  gebid("theform").method="get";
  enableAC=false;
  gmailmode=false;
  }
  
  
function qs(r,e){
  try{e.returnValue=false;}catch(e){}
  enableMode(r.id);
  return false;
  }
  

var curmode="";


function enableMode(r){
   lg=gebid("logo");
   var cncl=1;
   if (!r.match("a_")) r = "a_"+r;
   if (r=="a_weather") weathermode=true;
    else weathermode=false;
   curmode = r.replace("a_","");
   switch(r) {
     case "a_web":
       lg.src = "/google-x-logo.gif";
       lg.height=102;
       lg.width=355;
       lg.style.paddingTop="10px";
       gebid("feellucky").style.display="inline";
       gebid("linebreak").style.display="inline";
       //document.body.style.backgroundImage="url(grgrad.gif)";
       gebid("adv_search").innerHTML="Advanced Search";
       gebid("adv_search").href="http://www.google.com/advanced_search?hl=en";
       gebid("langtools").innerHTML = "Language Tools";
       gebid("langtools").href = "http://www.google.com/language_tools?hl=en";
       gebid("prefslink").innerHTML = "Preferences";
       gebid("prefslink").href = "http://www.google.com/preferences?hl=en";
       gebid("searchquery").size=55;
       gebid("inputrow").align="center";
       gebid("sbtn").value="Google Search";

       gebid("extraoptions").style.display="";
       gebid("spacingrow").style.display="";
       gebid("inputrow").colSpan=1;
       gebid("glocal").style.display="none";
       gebid("localhelp").style.display="none";
       gebid("gmaillogin").style.display = "none";
       gebid("moregoogle").style.display="none";
       gebid("weather").style.display="none";
       gebid("directorycats").style.display="none";
       gebid("normalsearch").style.display = "inline";
       gebid("theform").method="get";
       gebid("theform").action="http://www.google.com/search";
       enableAC=true;
       gmailmode=false;
       gebid("searchquery").focus();
       break;
     case "a_images":
       lg.src = "/googlex_files/images-logo.gif";
       gebid("adv_search").innerHTML="Advanced Image Search";
       gebid("adv_search").href="http://www.google.com/advanced_image_search?hl=en";
       gebid("langtools").innerHTML = "Image Search Help";
       gebid("langtools").href = "http://www.google.com/help/faq_images.html";
       gebid("theform").action="http://images.google.com/images";
       ns();
       break;
     case "a_print":
       lg.src = "/googlex_files/print-logo.bmp";
       ns();
       gebid("extraoptions").style.display="none";
       gebid("spacingrow").style.display="none";
       gebid("theform").action="http://print.google.com/print";
       document.body.style.backgroundImage="";
       break;
     case "a_froogle":
       lg.src = "/googlex_files/froogle-logo.gif";
       ns();
       gebid("adv_search").innerHTML="Advanced Froogle Search";
       gebid("adv_search").href="http://www.google.com/froogle_advanced_search";
       gebid("langtools").innerHTML = "Froogle Help";
       gebid("langtools").href = "http://www.google.com/froogle/about.html";
       gebid("sbtn").value="Search Froogle";
       gebid("theform").action="http://www.google.com/froogle";
       break;
     case "a_local":
       lg.src = "/googlex_files/local-logo.gif";
       ns();
       gebid("searchquery").size=25;
       gebid("extraoptions").style.display="none";
       gebid("spacingrow").style.display="none";
       gebid("inputrow").colSpan=3;
       gebid("inputrow").align="left";


       gebid("glocal").style.display="inline";
       gebid("localhelp").style.display="inline";
       gebid("theform").action="http://www.google.com/local";

       break;
     case "a_scholar":
       lg.src = "/googlex_files/scholar-logo.gif";
       ns();

       gebid("adv_search").innerHTML="Advanced Scholar Search";
       gebid("adv_search").href="http://scholar.google.com/advanced_scholar_search";
       gebid("langtools").innerHTML = "Scholar Help";
       gebid("langtools").href = "http://scholar.google.com/scholar/about.html";
       gebid("prefslink").innerHTML = "Scholar Preferences";
       gebid("prefslink").href = "http://scholar.google.com/scholar_preferences?prev=/";
       gebid("theform").action="http://scholar.google.com/scholar";
       break;
     case "a_video":
       lg.src = "/googlex_files/video-logo.gif";
       ns();
       document.body.style.backgroundImage="";
       gebid("adv_search").innerHTML="";
       gebid("adv_search").href="";
       gebid("prefslink").innerHTML = "Preferences";
       gebid("prefslink").href = "http://video.google.com/videolineup";
       gebid("langtools").innerHTML = "Google Video Help";
       gebid("langtools").href = "http://video.google.com/video_help.html";
       gebid("theform").action="http://video.google.com/videosearch";
       break;
     case "a_answers":
       lg.src = "http://answers.google.com/answers/answers-logo-lg.gif";
       ns();
       document.body.style.backgroundImage="";
       lg.height=97;
       lg.width=276;
       lg.style.paddingTop="13px";

       gebid("extraoptions").style.display="none";
       gebid("spacingrow").style.display="none";
       gebid("theform").action="http://answers.google.com/answers/search";
       break;
     case "a_gmail":

       lg.src = "googlex_files/logo2.gif";
       lg.height=102;
       lg.width=276;
       lg.style.paddingTop="8px";

       gebid("glocal").style.display="none";
       gebid("localhelp").style.display="none";
       gebid("moregoogle").style.display="none";
       gebid("weather").style.display="none";

       gebid("gmaillogin").style.display = "inline";
       gebid("normalsearch").style.display = "none";
       gebid("extraoptions").style.display="none";
       gebid("spacingrow").style.display="none";
       gebid("inputrow").align="center";
       gebid("directorycats").style.display="none";


       gebid("theform").action="https://www.google.com/accounts/ServiceLoginAuth";
       gebid("theform").method="post";


       if (gebid("gmuser").value.length<6)
         gebid("gmuser").value = GetCookie("autonotf_user");
       if (gebid("gmuser").value=="null")gebid("gmuser").value=""
       if (gebid("gmuser").value.length<6) {
         gebid("gmuser").focus();
         gebid("gmuser").select();
         }
       else {
         gebid("gmpass").focus();
         gebid("gmpass").select();
         }
       gmailmode=true;
       break;
     case "a_catalogs":
       lg.src = "/googlex_files/catalogs-logo.jpg";
       ns();
       document.body.style.backgroundImage="";
       gebid("adv_search").innerHTML="Advanced Catalog Search";
       gebid("adv_search").href="http://catalogs.google.com/advanced_catalog_search";
       gebid("prefslink").innerHTML = "Catalog Help";
       gebid("prefslink").href = "http://catalogs.google.com/googlecatalogs/help.html";
       gebid("langtools").innerHTML = "";
       gebid("langtools").href = "";
       gebid("theform").action="http://catalogs.google.com/catalogs";
       break;
     case "a_directory":
       lg.src = "/googlex_files/directory-logo.gif";
       ns();
       document.body.style.backgroundImage="";
       gebid("adv_search").innerHTML="";
       gebid("adv_search").href="";
       gebid("prefslink").innerHTML = "Preferences";
       gebid("langtools").innerHTML = "Directory Help";
       gebid("langtools").href = "http://www.google.com/dirhelp.html";
       gebid("theform").action="http://www.google.com/dirhp";
       gebid("directorycats").style.display="block";
       break;
     case "a_dictionary":
       lg.src = "/google-x-logo.gif";
       ns();
       lg.height=102;
       lg.width=355;
       lg.style.paddingTop="10px";
       //document.body.style.backgroundImage="url(grgrad.gif)";
       gebid("extraoptions").style.display = "none";
       gebid("spacingrow").style.display = "none";
       gebid("sbtn").value="Get Definitions";
       gebid("theform").action="http://www.google.com/define";
       break;

     case "a_weather":
       ns();
       lg.src = "/google-x-logo.gif";
       lg.height=102;
       lg.width=355;
       lg.style.paddingTop="10px";
       gebid("weather").style.display="block";
       gebid("normalsearch").style.display = "none";
       gebid("extraoptions").style.display = "none";
       gebid("spacingrow").style.display = "none";
       gebid("inputrow").align="center";
       curzip = GetCookie("weather");
       if (curzip != "" && typeof curzip != "undefined" && String(curzip) != "null") {
         gebid("weatherzip").value=curzip;
         getweather();
         }
       gebid("weatherzip").focus();
       gebid("weatherzip").select();

       break;
     case "a_more":
       ns();
       lg.src = "/google-x-logo.gif";
       lg.height=102;
       lg.width=355;
       lg.style.paddingTop="10px";
       gebid("inputrow").align="center";
       gebid("moregoogle").style.display="block";
       gebid("normalsearch").style.display = "none";
       gebid("extraoptions").style.display = "none";
       gebid("spacingrow").style.display = "none";
       if (textDock) gebid("dockstyle").value="text";
        else if (realDock) gebid("dockstyle").value="wave";
        else gebid("dockstyle").value="single";

       // IE only: set nonstandard 'ondragstart' property
        try{
         ds = gebid("moregoogle").getElementsByTagName("a");
         for(n=0;n<ds.length;n++) if (ds[n].tagName) ds[n].ondragstart = function() { return false; }
        }catch(e) {}
       break;
     default: cncl=0;
     }
   if (cncl) {
       try { e.preventDefault(); } catch(e){}
       try { e.returnValue=false;} catch(e){}
       if (textDock) {
         for (i=1; i<dockSetup.length; i++) {
           if (dockSetup[i] == curmode) {
             gebid("a_"+curmode).style.textDecoration = "none";
 	     gebid("a_"+curmode).style.color = "black";
             gebid("a_"+curmode).style.fontWeight = "bold";
             continue;
             }
          gebid("a_"+dockSetup[i]).style.textDecoration = "underline";
          gebid("a_"+dockSetup[i]).style.color = "";
          gebid("a_"+dockSetup[i]).style.fontWeight = "normal";
          }
        }
       }
  else {
    var tg = navURL[r.replace("a_","")];
    if(ag&&window.encodeURIComponent){
      var qe=encodeURIComponent(document.f.q.value);
      if(tg.indexOf("q=")!=-1) {
        tg=r.href.replace(new RegExp("q=[^&$]*"),"q="+qe);
        }
      else {
        if(tg.indexOf("?")>-1)tg+="&q="+qe
        }
      }
    window.location.href=tg;
    }
  }


var dcount=0;
dragImg=false;
isdragging=false;
dragvalue="";
dragopt=0;
blankat=-1;
var sdel=0;
var pdockSetup;


function startDrag(el) {
  if (el) sdel=el;
  if (++dcount < 6 && !el.id.match("opt_")) return;
  dragImg=false;
  pdockSetup=dockSetup;

  gebid("dragimg").style.top=tMouseY-35;
  gebid("dragimg").style.left=tMouseX-35;
  gebid("dragimg").width=
  gebid("dragimg").height=70;

  var wh = el.id.replace("image_","");
  isopt=0;
  if (wh.match("opt_")) isopt=1;

  if (!wh.match("opt_")) {
    dragopt=0;
    gebid("blank_"+wh).style.display="inline";
    if (!textDock) gebid("blank_"+wh).height=70;
    gebid("blank_"+wh).width=70;
    blankat = dockLocation[wh]-1;
    if (typeof tdText[ wh ] != "undefined") ut=tdText[ wh ];
    else ut = labelText[ wh ];
    if (!textDock) gebid("dragimg").src=el.src;
    else gebid("dragimg").innerHTML="<a href='/'>"+ut+"</a>";
    gebid("dragimg").style.display="block";
    } 
  else {
    dragopt=1;
    wh=wh.replace("opt_","");
    if (gebid("blank_"+wh)) {
      gebid("blank_"+wh).style.display="inline";
      if (!textDock) gebid("blank_"+wh).height=70;
      gebid("blank_"+wh).width=70;
      blankat = dockLocation[wh]-1;
      }
    else blankat = -2;

    if (typeof tdText[ wh ] != "undefined") ut=tdText[ wh ];
      else ut = labelText[ wh ];
    if (!textDock) gebid("dragimg").src="/googlex_files/"+wh+".gif";
     else gebid("dragimg").innerHTML="<a href='/'>"+ut+"</a>";
    gebid("dragimg").style.display="block";
    }
  try {
    rn = gebid("a_"+wh);
    rn2 = gebid("blank_"+wh);
    rn.parentNode.removeChild(rn);
    rn2.parentNode.removeChild(rn2);
    if (blankat!=-2){
      gebid("blank_"+dockSetup[blankat]).style.display="inline";
      if (!textDock) gebid("blank_"+dockSetup[blankat]).height=70;
      gebid("blank_"+dockSetup[blankat]).width=80;
      }
    newds=[];
    for (i=0;i<dockSetup.length;i++) if (dockSetup[i]!=wh) newds.push(dockSetup[i]);
    dockSetup=newds;
    totalIcons--;
    }
  catch(e){ oc=c=totalIcons-2;}
  for (i=1; i<dockSetup.length; i++) { dockLocation[ dockSetup[i] ] = i;  }

  dragvalue=wh;
  isdragging=true;
  }
  
  
var tMouseX, tMouseY;


function trackMouse(e) {
  if (!e) e=window.event;
  tMouseX=e.clientX;
  tMouseY=e.clientY+ document.body.scrollTop;
  if (isdragging) {
    if (!textDock) {
      gebid("dragimg").style.top=(tMouseY-35) + "px";
      gebid("dragimg").style.left=(tMouseX-35) + "px";
      }
    else {
      gebid("dragimg").style.top=(tMouseY-10) + "px";
      gebid("dragimg").style.left=(tMouseX-(gebid("dragimg").offsetWidth/2)) + "px";
      }
    if (document.body.scrollTop>0 && (e.clientY-35) < 20) document.body.scrollTop -= 15;
    }
  if (dragImg) {
    startDrag(sdel);
    }
  }
  
  
var preloadpoof = new Image();
preloadpoof.src = "/poof.gif";


function mouseUp() {
  if (!isdragging) return;
  dragImg=false;
  dcount=0;
  isdragging=false;
  c=-1;
  var thedk = gebid("thedock");
  oft=0;
  el=thedk;
  oft += el.offsetTop;
  while (el.offsetParent) { el=el.offsetParent; oft += el.offsetTop; }
  trashit=0;
  if (tMouseY+70 < oft) trashit=1;
  if (tMouseY-30 > thedk.offsetHeight+oft) trashit=1;
  if (totalIcons<=3 || dragvalue=="more" || dragvalue=="web" || dragopt) trashit=0;
  if (blankat==-2) { trashit=1; }
  n_s=[];
  if (!trashit) {
    gebid("dragimg").style.display="none";
    totalIcons++;
    for (i=0; i<dockSetup.length; i++) {
      n_s.push(dockSetup[i]);
      if (i == blankat) n_s.push(dragvalue);
      }
    //alert("old: "+dockSetup+"\nnew:"+n_s);
    dockSetup = n_s;
    }
  for (i=1; i<dockSetup.length; i++) { dockLocation[ dockSetup[i] ] = i;  }

  for (i=imageSizes.length;i<=totalIcons;i++) { imageSizes.push(35); targetSizes.push(35); }
  blankat=-1;
  thedk.innerHTML = getDockHTML();
  if (trashit && !dragopt) {
    if (!textDock) gebid("dragimg").src="/poof.gif";
     else gebid("dragimg").innerHTML = "<img height=70 width=70 src=/poof.gif>";
    gebid("dragimg").height=
    gebid("dragimg").width=70;
    gebid("dragimg").style.display="block";
    gebid("dragimg").style.top=(tMouseY-35) + "px";
    gebid("dragimg").style.left=(tMouseX-35) + "px";
    if (!textDock) setTimeout('gebid("dragimg").src="";gebid("dragimg").style.display="none";',200);
     else setTimeout('gebid("dragimg").innerHTML="";gebid("dragimg").style.display="none";',200);
    if (String(pdockSetup) == String(defaultDock)) alert("You just dragged an item off of the toolbar. If you ever want it back, you can find it by clicking the 'More...' toolbar button.");
    }
  if (!trashit) dockmousemove(1);
   else dockmouseout(1);
  SetCookie("docksetup",dockSetup.join(","));
  }
  
  
document.body.onmousemove = trackMouse;
document.body.onmouseup = mouseUp;
sy = 0; inc = 5; up = true;
var xx;


function edStuff() {
  setInterval('move()', 30);
  }
  
  
function move() {
  if (!gebid("image_gmail")) return;
  xx = gebid('image_gmail');
  if (gebid("image_gmail").height>55 || c==11) {
    xx.style.marginBottom="0px";
    return;
    }
  if(sy>25){inc=1}else if(sy>20){inc=2}else if(sy>15){inc=3}else if(sy>10){inc=4}else{inc=5}if(up){sy+=inc}else{sy-=inc}if(sy>=30){up=false}else if(sy<=0){up=true}
  if(gebid("image_gmail").height>35){xx.style.marginBottom=Math.max(0,sy/2)}else{xx.style.marginBottom=sy}
  }
	
	
function setHP(e) {
  gebid("hp").setHomePage('http://googlex.jayssite.com/');
  //return false;
  }


dockLocation=[];
labelText = [];
labelText["web"]="Web Search";
labelText["images"]= "Images";
labelText["groups"]= "Groups";
labelText["news"]= "News";
labelText["froogle"]= "Froogle";
labelText["local"]= "Local";
labelText["scholar"]= "Scholar";
labelText["video"]= "Video";
labelText["maps"]= "Maps";
labelText["answers"]= "Answers";
labelText["labs"]= "Labs";
labelText["gmail"]= "Gmail";
labelText["more"]= "More...";

labelText["alerts"] = "Alerts";
labelText["catalogs"] = "Catalogs";
labelText["directory"] = "Directory";
labelText["mobile"] = "Mobile";
labelText["special"] = "Special...";
labelText["university"] = "University";
labelText["features"] = "Tips...";

labelText["dictionary"] = "Dictionary";
labelText["blogger"] = "Blogger";
labelText["orkut"] = "Orkut";
labelText["print"] = "Print";
labelText["weather"] = "Weather";

tdText=[];
tdText["web"] = "Web";
tdText["more"] = "<b>more &raquo;</b>";
tdText["local"] = "Local<sup style='color:red;text-decoration:none;'>New!</sup>";

navURL = [];
navURL["groups"] = "http://groups-beta.google.com/?";
navURL["news"] = "http://news.google.com/nwshp?hl=en&amp;gl=us";
navURL["maps"] = "http://maps.google.com/maps?hl=en";
navURL["labs"] = "http://labs.google.com/";
navURL["more"] = "http://www.google.com/options/index.html";

navURL["alerts"] = "http://www.google.com/alerts";
navURL["mobile"] = "http://mobile.google.com/";
navURL["special"] = "http://www.google.com/options/specialsearches.html";
navURL["university"] = "http://www.google.com/options/universities.html";
navURL["features"] = "http://www.google.com/help/features.html";
navURL["blogger"] = "http://www.blogger.com/";
navURL["orkut"] = "http://www.orkut.com/";

var tr;


function getDockHTML() {
  var tr="<img id=blank_"+ dockSetup[0] +" src='/clearpixel.gif' height=0 width=0 style='display:none'>";
  if (textDock) {
    gebid("iconrow").height ="35"
    gebid("dockheightcp").style.height = "35px";
    }
   else {
     gebid("iconrow").height = "75"
     gebid("dockheightcp").style.height = "75px";
     }
  for (i=1; i<dockSetup.length; i++) {
    if (dockSetup[i] == "blank") {
      tr += "<img id=image_blank src=/clearpixel.gif height=35 width=35>";
      continue;
      }
    dockLocation[ dockSetup[i] ] = i;
    if (!textDock) {

      tr += "<a ondragstart='return false' class='q' id='a_"+ dockSetup[i] +"' onclick='return qs(this,event)' href='/' target='_top'>";
      tr += "<img onmousemove='if(dragImg)startDrag(this)' onmouseup='dragImg=false;dcount=0;' onmousedown='dragImg=true;return false' id='image_"+ dockSetup[i] + "' onmouseover=d('"+ dockSetup[i] +"') onmouseout=e('"+ dockSetup[i] +"')  alt='"+ labelText[dockSetup[i]] +"' src='googlex_files/"+ dockSetup[i] +"-sm.gif' border='0' height='35' width='35'></a>";
      tr += "<img id=blank_"+ dockSetup[i] +" src='/clearpixel.gif' height=0 width=0 style='display:none'>";
      }
      else {

        if (typeof tdText[ dockSetup[i] ] != "undefined") ut=tdText[ dockSetup[i] ];
         else ut = labelText[ dockSetup[i] ];
        tr += "<font size=-1><a ondragstart='return false' class='q' id='a_"+ dockSetup[i] +"' onclick='return qs(this,event)' href='/' target='_top'>";
        tr += "<span onmousemove='if(dragImg)startDrag(this)' onmouseup='dragImg=false;dcount=0;' onmousedown='dragImg=true;return false' id='image_"+ dockSetup[i] + "' onmouseover=d('"+ dockSetup[i] +"') onmouseout=e('"+ dockSetup[i] +"')  alt='"+ labelText[dockSetup[i]] +"' id='image_"+ dockSetup[i] + "' >"+
            ut+"</span></a></font>&nbsp;&nbsp;&nbsp;&nbsp;";
        tr += "<img id=blank_"+ dockSetup[i] +" src='/clearpixel.gif' height=0 width=0 style='display:none'>";
        }
    }
  if (!textDock) tr += "<img height=70 width=70 style='display:none;position:absolute;height:70px;width:70px' onmousemove=dockmousemove(event) id=dragimg class=transparent>";
   else tr += "<div style='display:none;position:absolute;font-size:13px;' onmousemove=dockmousemove(event) id=dragimg class=transparent></div>";

  if (String(curmode).length>1) {
    setTimeout("enableMode(curmode)",5);
    }

  return tr;
  }
  
  
function resetDock() {
  if (!textDock) dockSetup = defaultDock;
   else dockSetup = ["null","web","images","groups","news","froogle","local","more"];
  for (i=1; i<dockSetup.length; i++)
    dockLocation[ dockSetup[i] ] = i;
  gebid("thedock").innerHTML = getDockHTML();
  totalIcons=dockSetup.length;
  dockmouseout(1);
  SetCookie("docksetup",dockSetup.join(","));
  }


function changedockstyle() {
  if (gebid("dockstyle").value == "text") {
    textDock=true;
    if (confirm("Would you like to use Google's default toolbar? (Web, Images, Groups, News, Froogle, Local, More)\nYou can, of course, still have a text dock without using these default links.")) resetDock();
    }
   else if (gebid("dockstyle").value == "wave") { textDock=false; realDock=true; }
   else if (gebid("dockstyle").value == "single") { textDock=false; realDock=false; }
  gebid("thedock").innerHTML = getDockHTML();
  dockmouseout(1);
  SetCookie("dockstyle",gebid("dockstyle").value);
  }
