var today = new Date();

root = "/"
if (location.href.indexOf("/anthony_yager/")>0)
{
root = "/anthony_yager/"
}


//function from http://www.alistapart.com/articles/n4switch/
function setVisibility(element, visible)
{
	if (document.getElementById)
		v = document.getElementById(element).style;
	else if (document.all)
		v = document.all[element].style;
	else
		return;
	v.display = (visible)? "" : "none";
}

//Original function from http://www.alistapart.com/articles/n4switch/
function writeTitleOf(id)
{
	if (document.getElementById)
		v = document.getElementById(id);
	else if (document.all)
		v = document.all[id];
	else
		return;
	return v.title;
}

// My function
function setAllVisibility(id, noOf, display)
{
	for (i=1; i <= noOf; i++)
	{
		setVisibility(id+i, display);
	}
}

//function from http://www.alistapart.com/articles/n4switch/
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

//function from http://www.alistapart.com/articles/n4switch/
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

//Original function from http://www.alistapart.com/articles/n4switch/
function setActiveStyleSheet(id) {
  var i, doc, main;
  for(i=0; (doc = document.getElementsByTagName("link")[i]); i++) {
    if(doc.getAttribute("rel").indexOf("style") != -1 && doc.getAttribute("id")) {
      doc.disabled = true;
      if(doc.getAttribute("id") == id) doc.disabled = false;}
    }
  }

function changeSkin(newSkin)
{
setVisibility("credit"+currentskin,false);
setVisibility("name"+currentskin,false);
createCookie("style", newSkin, 365);
if(newSkin == "default") {currentskin = defaultSkin } else {currentskin = newSkin} ;
setVisibility("name"+currentskin,true);
setVisibility("credit"+currentskin,true);
setActiveStyleSheet('style'+currentskin);
}

