var minZoom = 0;
var maxZoom = 4;

var scaleFactors = new Array (1,1.33,1.75,2.33,2.75);

var currentZoom = minZoom;
zoomScaleFactor = 1.33;


function isIE(){

  var browser = navigator.appName;
  return (browser.indexOf("Microsoft") != -1 ) 
}

var fontSizeProperty = "font-size";
var lineHeightProperty = "line-height";

if (isIE()){

  fontSizeProperty = "fontSize";
  lineHeightProperty = "lineHeight";
}



function getStyle(el,styleProp) {
	var x = el;
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}

function enlargeElem(elem,factor,cssProperty, inlineCssPropery) {

      if (!elem[inlineCssPropery + "Orig"]) {

        var curStyle = getStyle(elem,cssProperty);

        var curSize = parseInt(curStyle);

        if((!isNaN(curSize)) && (curSize > 0)) {	
          elem[inlineCssPropery + "Orig"] = curSize;    
        }     
      } 

      if(elem[inlineCssPropery + "Orig"]){	

        elem.style[inlineCssPropery] = "" + Math.floor(elem[inlineCssPropery + "Orig"] * factor) + "px";
        elem.style.lineHeight = "normal";
        //elem.style.width = "auto";
     


     }

}

//factor is the scale factor we want to increase the page size by
function zoom(factor) {
  
  var tags = new Array("a", "h1", "h2", "h3", "h4", "h5", "h6", "input", "label","p");

  for(var j in tags) {

    var elems = document.getElementsByTagName(tags[j]);

    for (var i=0; i < elems.length; i++) {

       enlargeElem(elems[i],factor, fontSizeProperty, "fontSize");


       if (tags[j] = "input") {

         elems[i].style.height = "auto";

       }

    
    }



  }
  
  
  if (document.getElementById("maincontent")) {
    enlargeElem(document.getElementById("maincontent"),factor, fontSizeProperty, "fontSize");
  }

  updateElemStyle("innerheader", "height", "250px");
  updateElemStyle("aboutlink","width", "auto");
  updateElemStyle("studylink","width", "auto");
  updateElemStyle("supportlink","width", "auto");
  updateElemStyle("contactlink","width", "auto");

  updateElemStyle("main_nav","minHeight", "500px");



}

function updateElemStyle(elemId, styleProp, styleVal) {
  
  var elem = document.getElementById(elemId);

  if (elem) {
    elem.style[styleProp] = styleVal;
  }

}


function ucs_increaseZoom() {



  /*if (currentZoom < maxZoom) {
    zoom(zoomScaleFactor);
    currentZoom++; 
  }*/


  switch(currentZoom) { 
    
    case 0:

      currentZoom++;
      //fall through to case 1
    case 1:
      zoom(scaleFactors[currentZoom]);
      currentZoom++;
      break;
    case 2:
      zoom(scaleFactors[currentZoom]);
      currentZoom++;
      break;
    case 3:
      zoom(scaleFactors[currentZoom]);
      currentZoom++;
      break;
    case 4:
      zoom(scaleFactors[currentZoom]);
      break;
    default:
    //do nothing
   
  }

  //alert(currentZoom);

}

function ucs_decreaseZoom() {
  /*if (currentZoom > minZoom) {
    zoom(1.0/zoomScaleFactor);
    currentZoom--;
  } */




  switch(currentZoom) { 
    
    case 0:
      zoom(scaleFactors[currentZoom]);

    break;
      case 1:
      zoom(scaleFactors[currentZoom - 1]);
      currentZoom--;
      break;
    case 2:
      zoom(scaleFactors[currentZoom - 1]);
      currentZoom--;
      break;
    case 3:
      zoom(scaleFactors[currentZoom - 1]);
      currentZoom--;
      break;
    case 4:
      zoom(scaleFactors[currentZoom - 1]);
      currentZoom--;
      break;
    default:
    //do nothing
   
  }


  //alert(currentZoom);

}

function ucs_resetZoom() {
  zoom(scaleFactors[0]); 
}

//zoomLevel is a numeric id (not a scale factor) for the current zoom level

function ucs_jumpToZoom(zoomLevel) {

}

/*alert(currentZoom);
increaseZoom();
alert(currentZoom);
increaseZoom();
alert(currentZoom);
increaseZoom();
alert(currentZoom);
increaseZoom();
alert(currentZoom);
decreaseZoom();
alert(currentZoom);
decreaseZoom();
alert(currentZoom);
decreaseZoom();
alert(currentZoom);
decreaseZoom();
alert(currentZoom);
decreaseZoom();
alert(currentZoom);
decreaseZoom();
alert(currentZoom);
decreaseZoom();
alert(currentZoom);*/