function msieversion()
{
      var ua = window.navigator.userAgent
      var msie = ua.indexOf ( "MSIE " )

      if ( msie > 0 )      // If Internet Explorer, return version number
         return parseInt (ua.substring (msie+5, ua.indexOf (".", msie )))
      else                 // If another browser, return 0
         return 0
}

function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function MoveLayerBy (id,incX,incY) { 
   // moves layer by increments
   var myElement = document.getElementById(id);
   alert  ( " " + myElement.style.left);
   myElement.style.left = parseInt(myElement.style.left) 
     + incX + "px";
   myElement.style.top = parseInt(myElement.style.top)
     + incY + "px";
}

function cycleDivs(div1, div2) 	{
		jQuery(div1).fadeOut("2500", function(){ jQuery(div2).fadeIn("2500");});
	    setTimeout("cycleDivs(\"" + div2 + "\", \"" + div1 + "\");", 15000)
} 

function pausecomp(millis) 	{
	date = new Date();
	var curDate = null;
	
	do { var curDate = new Date(); } 
	while(curDate-date < millis);
} 

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}


// - - - - - - - - - - - - - - - - - - - - -
//
// Title : Dynamic Resolution Dependent Layout Demo
// Author : Kevin Hale
// URL : http://particletree.com
//
// Description : This is a demonstration of a dynamic 
// resolution dependent layout in action. Change your browser 
// window size to see the layout respond to your changes. To 
// preserve the separation of the presentation and behavior 
// layers, this implementation delegates all the presentation 
// details to external CSS stylesheets instead of changing 
// each style property through JavaScript.
//
// Created : July 30, 2005
// Modified : November 15, 2005
//
// - - - - - - - - - - - - - - - - - - - - -

// getBrowserWidth is taken from The Man in Blue Resolution Dependent Layout Script
// http://www.themaninblue.com/experiment/ResolutionLayout/
function getBrowserWidth() {
    if (window.innerWidth) {
        return window.innerWidth;
    }
    else if (document.documentElement && document.documentElement.clientWidth != 0) {
        return document.documentElement.clientWidth;
    }
    else if (document.body) { return document.body.clientWidth; }
    return 0;
}

// dynamicLayout by Kevin Hale
function dynamicLayout() {
    var browserWidth = getBrowserWidth();

    //alert(browserWidth );
    //Load Thin CSS Rules
    if (browserWidth < 1172) {
        changeLayout("thin-overrides");
    }
    //Load Wider CSS Rules
    if (browserWidth >= 1172) {
        changeLayout("wide-overrides");
    }
    resize();
}


function resize()
{

	//opera Netscape 6 Netscape 4x Mozilla 
	if (window.innerWidth || window.innerHeight){ 	
		newwidth= window.innerWidth; 
	} 
	//IE Mozilla 
	if (document.body.clientWidth || document.body.clientHeight){ 
		newwidth= document.body.clientWidth; 
	}

	if (document.body.scrollHeight && navigator.appVersion.indexOf("Win") != -1) {
		newheight = document.body.scrollHeight;
		// gets the correct value on WIN IE6, but non on MAC
	}
	else if (document.documentElement.scrollHeight) {
		newheight = document.documentElement.scrollHeight;
	}
	else if (document.documentElement.offsetHeight) {
		newheight  = document.documentElement.offsetHeight;
	}
	
	//alert ("w " + TopBarText.style.width);
	if (typeof(TotalContainer) != "undefined"){
	if (typeof(theMinWidth) == "undefined")
	{
		if (newwidth<785)
		{
			TotalContainer.style.width= "785px";
			TopBar.style.width= "785px";
		}
		else
		{
			//alert ("doing it 100");
			TotalContainer.style.width="100%";
			TopBar.style.width="100%";
		}
	}
	else
	{
		if (newwidth<theMinWidth)
		{
			//alert ("doing it specific");
			TotalContainer.style.width=theMinWidth + "px";
			TopBar.style.width=theMinWidth + "px";
		}
		else
		{
			//alert ("doing it 100");
			TotalContainer.style.width="100%";
			TopBar.style.width="100%";
		}
	}
	}

}

// changeLayout is based on setActiveStyleSheet function by Paul Sowdon 
// http://www.alistapart.com/articles/alternate/
function changeLayout(description) {
    var rows = document.getElementsByTagName('link');
    for (var i = 0, row; row = rows[i]; i++) {
        if (row.getAttribute("title") != null) {
            if (row.getAttribute("title") == description) { row.disabled = false; }
            else if (row.getAttribute("title").search("overrides") > 0) { row.disabled = true; } 
        }
    }
}

//addEvent() by John Resig
function addEvent(obj, type, fn) {
    if (obj.addEventListener) {
        obj.addEventListener(type, fn, false);
    }
    else if (obj.attachEvent) {
        obj["e" + type + fn] = fn;
        obj[type + fn] = function() { obj["e" + type + fn](window.event); }
        obj.attachEvent("on" + type, obj[type + fn]);
    }
}

//Run dynamicLayout function when page loads and when it resizes.
addEvent(window, 'load', dynamicLayout);
addEvent(window, 'resize', dynamicLayout);




