/* Expandimg ----Start----*/


// Thumbnail expansion and reduction animation

//use expandthumb(



expandingid = 0;

expandingstep = 0;

expandingwidth = 0;

expandingheight = 0;

expandingtop = 0;

expandingleft = 0;

expandingtimeout = 0;

expandingtotalsteps = 15;



function expandthumb(thumbid, fullwidth, fullheight) {

  if (expandingtimeout != 0) {

    clearTimeout(expandingtimeout);

  }

  if (expandingid > 0 && expandingid != thumbid) {

    restorethumb();

  }

  if (expandingid != thumbid) {

    img = document.getElementById("screen" + thumbid);

    img.style.display = 'block';

    expandingid = thumbid;

    expandingstep = 1;

    expandingwidth = fullwidth;

    expandingheight = fullheight;

    expandingtop = img.offsetTop;

    expandingleft = img.offsetLeft;

  } else if (expandingstep < 1) {

    expandingstep = 1;

  }

  expandstep();

}



function doexpand() {

  img = document.getElementById("screen" + expandingid);

  thumb = document.getElementById("thumb" + expandingid);

  myscroll = getScroll();

  if (expandingtop + thumb.height > myscroll.top + myscroll.height) {

    finaltop = myscroll.top + myscroll.height - expandingheight;

  } else {

    finaltop = expandingtop + thumb.height - expandingheight;

  }

  if (finaltop < myscroll.top) { finaltop = myscroll.top; }

  img.style.top = finaltop + ((expandingtop - finaltop) * (expandingtotalsteps - expandingstep) / expandingtotalsteps) + 'px';



  if (expandingleft + thumb.width > myscroll.left + myscroll.width) {

    finalleft = myscroll.left + myscroll.width - expandingwidth;

  } else {

    finalleft = expandingleft + thumb.width - expandingwidth;

  }

  if (finalleft < myscroll.left) { finalleft = myscroll.left; }

  img.style.left = finalleft + ((expandingleft - finalleft) * (expandingtotalsteps - expandingstep) / expandingtotalsteps) + 'px';



  img.width = thumb.width + ((expandingwidth - thumb.width) * expandingstep / expandingtotalsteps);

  img.height = thumb.height + ((expandingheight - thumb.height) * expandingstep / expandingtotalsteps);

}



function restorethumb() {

  img = document.getElementById("screen" + expandingid);

  img.style.top = '';

  img.style.left = '';

  img.style.display = 'none';

  expandingid = 0;

}



function expandstep() {

  expandingtimeout = 0;

  doexpand();

  if (expandingstep < expandingtotalsteps) {

    expandingstep++;

    expandingtimeout = setTimeout("expandstep()", 5);

  }

}



function reducestep() {

  expandingtimeout = 0;

  doexpand();

  if (expandingstep > 0) {

    expandingstep--;

    expandingtimeout = setTimeout("reducestep()", 5);

  } else {

    restorethumb();

  }

}



function reducethumb(thumbid) {

  if (expandingtimeout != 0) {

    clearTimeout(expandingtimeout);

  }

  if (expandingstep > 0) {

    reducestep();

  }

}



// returns the scroll position and size of the browser

function getScroll() {

  if (document.all && typeof document.body.scrollTop != "undefined") {  

    // IE model

    var ieBox = document.compatMode != "CSS1Compat";

    var cont = ieBox ? document.body : document.documentElement;

    return {

      left:   cont.scrollLeft,

      top:    cont.scrollTop,

      width:  cont.clientWidth,

      height: cont.clientHeight

    };

  } else {

    return {

      left:   window.pageXOffset,

      top:    window.pageYOffset,

      width:  window.innerWidth,

      height: window.innerHeight

    };

  }

}



/* Expandimg ----End----*/




/* Stuhover ----Start---- */



stuHover = function() {
	var cssRule;
	var newSelector;
	for (var i = 0; i < document.styleSheets.length; i++)
		for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
			{
			cssRule = document.styleSheets[i].rules[x];
			if (cssRule.selectorText.indexOf("LI:hover") != -1)
			{
				 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
				document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
			}
		}
	var getElm = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<getElm.length; i++) {
		getElm[i].onmouseover=function() {
			this.className+=" iehover";
		}
		getElm[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", stuHover);

/* Stuhover ----End---- */





