/*
*
* javascript for JVC
*
*
*/



function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + (expires ? "; expires=" + expires : "") +
        (path ? "; path=" + path : "") + (domain ? "; domain=" + domain : "") + (secure ? "secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

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";
}

function fixDate (date) {
var base = new Date(0);
var skew = base.getTime();
if (skew > 0)
date.setTime(date.getTime() - skew);
}


/*** onload function ***/

  window.onload = function()
  {

/*  // corner round
    settings = {
      tl: { radius: 5 },
      tr: { radius: 5 },
      bl: { radius: 5 },
      br: { radius: 5 },
      antiAlias: true,
      autoPad: false
    }

    var divObj = document.getElementById("footer-1");

    var cornersObj = new curvyCorners(settings, divObj);
    cornersObj.applyCornersToAll();
*/


    var fs = getCookie("JVCconcert-fontsize");
    if( fs!="" ) {
      if (!document.getElementById) return;
      var dore = document,tarS = null,fontSize = fs,value,su,cTags;
      Default = fontSize;
      if (!(tarS = dore.getElementById(this))) tarS = dore.getElementsByTagName(this)[0];
      tarS.style.fontSize = sizing[fontSize];
      for (value = 0 ; value < tags.length ; value++) {
        cTags = tarS.getElementsByTagName(tags[value]);
        for (su = 0 ; su < cTags.length ; su++) cTags[su].style.fontSize = sizing[fontSize];
      }

    }

  }


/*** font change ***/

var Default = 3;
var tags    = new Array('div','td','tr');
var sizing  = new Array('xx-small','x-small','small','medium','large','x-large','xx-large');
// var presize = getCookie("JVCconcert-fontsize");

function FontChange1(target,tarF) {
  if (!document.getElementById) return;
  var dore = document,tarS = null,fontSize = Default,value,su,cTags;
  fontSize += tarF;
  if (fontSize < 0) fontSize = 0;
  if (fontSize > 6) fontSize = 6;
  Default = fontSize;
  if (!(tarS = dore.getElementById(target))) tarS = dore.getElementsByTagName(target)[0];
  tarS.style.fontSize = sizing[fontSize];
  for (value = 0 ; value < tags.length ; value++) {
    cTags = tarS.getElementsByTagName(tags[value]);
    for (su = 0 ; su < cTags.length ; su++) cTags[su].style.fontSize = sizing[fontSize];
  }

  var now = new Date();
  fixDate(now);
  now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
  now = now.toGMTString();

  setCookie("JVCconcert-fontsize", fontSize,now,'/','','');
}



/*** font change 2  change css file ***/

/*
var cssfiles = new Array();
cssfiles[0] = "font-large.css";
cssfiles[1] = "font-small.css";

var css = getCookie("JVCconcert-CSSsize");
if(css == ""){css = cssfiles[0];}
document.write('<LINK rel="stylesheet" href="/concert/common/css/' + css + '" type="text/css">');

function FontChange2(sel){
	setCookie("JVCconcert-CSSsize", cssfiles[sel]);
	window.location.reload();
}
*/


