// JavaScript Document
/*********************************************************************************
  dw_cookies.js - cookie functions for www.dyn-web.com
  Recycled from various sources 
**********************************************************************************/

// Modified from Bill Dortch's Cookie Functions (hidaho.com) 
// (found in JavaScript Bible)
function setCookie(name,value,days,path,domain,secure) {
  var expires, date;
  if (typeof days == "number") {
    date = new Date();
    date.setTime( date.getTime() + (days*24*60*60*1000) );
		expires = date.toGMTString();
  }
  document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

// Modified from Jesse Chisholm or Scott Andrew Lepera ?
// (found at both www.dansteinman.com/dynapi/ and www.scottandrew.com/junkyard/js/)
function getCookie(name) {
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
}

// from Bill Dortch's Cookie Functions (hidaho.com) 
function deleteCookie(name,path,domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

var firstCall = true;

function changeFontsize(fSize, increment) {
  if (firstCall) { 
    firstCall = false;
  if (increment != "")
      changeFontsize('14', '');
  }
  if (document.getElementsByTagName) {	
    tags = new Array ( "ul", "li", "p", "h1", "h2", "h3", "h4", "h5", "h6", "td", "th", "div");
    for (j=0; j<tags.length; j++) {
      var getElement = document.getElementsByTagName(tags[j]);
      var eachElement, currentFontSize, fontIncrease, newFontSize;
      for (i=0; i<getElement.length; i++) {
        eachElement = getElement[i];
		
			if (increment != "") {
			  currentFontSize = parseInt(eachElement.style.fontSize);
			  fontIncrease = parseInt(increment);
			  newFontSize = currentFontSize + fontIncrease;
			  }
			else if (fSize != "")
			  newFontSize = parseInt(fSize);
			if (tags[j] == "li")
			  eachElement.style.lineHeight = Math.round(newFontSize*1.3) + "px";
			else
			  eachElement.style.lineHeight = Math.round(newFontSize*1.3) + "px";
			if (fSize != "") {
			  switch(tags[j]) {
			  case "h1": newFontSize += 4; break;
			  case "h2": newFontSize += 3; break;
			  case "h3": newFontSize += 2; break;
			  case "h4": newFontSize += 1; break;
			  case "h5": newFontSize += 1; break;
			  case "h6": newFontSize += 1;
			  }
			}
			//if(eachElement.id != "resizer")
			//{				
				eachElement.style.fontSize = newFontSize + "px";
			//}
			//else
			//{
			//	alert('1');
				/*alert(eachElement.style.fontSize);
				eachElement.style.fontSize = currentFontSize + "px";*/
			//}
			setCookie('fontSize', newFontSize);
		  }
	  

    }
	//debugger;
	//alert(document.getElementById("small_A"));
	document.getElementById("small_A").style.fontSize = "13px";
	document.getElementById("mideum_A").style.fontSize = "17px";
	document.getElementById("big_A").style.fontSize = "20px";
	
	
	
  }
}