﻿function SwitchWrapperClass (itemId, classToSwitchTo) {
	document.getElementById(itemId).className = classToSwitchTo;
}

function SwitchClass (ob, classToSwitchTo) {
	ob.className = classToSwitchTo;
}

function SwitchImageSource (image, sourceToSwitchTo) {
	image.src = sourceToSwitchTo;
}

function clearOutTextBox (ob, textToCheckFor) {
    if ( ob.value == textToCheckFor ) 
    {
        ob.value = '';
    }
}

function openWindow(winURL,winName,features) {
  window.open(winURL,winName,features);
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function resizeText(multiplier) {
    if (document.body.style.fontSize == "") 
    {
        document.body.style.fontSize = "1.0em";
    }
    document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.2) + "em";
}

function resizeText(upDown, increment) {
    var min = 10;
    var defaultSize = 11;
    var max = 17;
    var paras = $$('p');
    paras.each(function(p,index) {
        if ( p.getProperty('class').indexOf('noresize') == -1 ) {
	        var s = min;
	        var currentSize = parseInt(p.getStyle('font-size').replace('px', ''));
	        if ( currentSize < min - 1 ) 
	        {
	            currentSize = defaultSize;
	        }
	        if ( upDown == 'up' && currentSize <= max ) 
	        {
	            currentSize += increment;
	        }
	        if ( upDown == 'down' && currentSize >= min ) 
	        {
	            currentSize -= increment;
	        }
	        p.setStyle('font-size', currentSize + 'px');
	    }
    });
}
