var optF = 1;
var optT = 0.6;
var optD = 0.3;

Event.observe(window, "load", function(){
$$(".onM").each(function(el){
	el.observe("mouseover",function(){
		new Effect.Opacity(el, { from:optF, to:optT, duration:optD });
	});
	el.observe("mouseout",function(){
		new Effect.Opacity(el, { from:optT, to:optF, duration:optD });
	});
});

$$(".onMr").each(function(el){
	el.observe("mouseover",function(){
		new Effect.Opacity(el, { from:optT, to:optF, duration:optD });
	});
	el.observe("mouseout",function(){
		new Effect.Opacity(el, { from:optF, to:optT, duration:optD });
	});
});

$$(".autoF").each(function(el){
	new Effect.Opacity(el, { from:optF, to:optT, duration:optD * 5 });
});

});


function view_onoff(did, BorN){
  if(BorN=='auto'){
   if($(did).getStyle('display')=='block'){
     BorN='none';
   }else{
     BorN='block';
   }
  }

  $(did).setStyle({'display':BorN});

}


function mailto(type, text, img, alt){
  coded = "DWChWeU@OQOf.qg.R3";
  key = "OwToc5eAjK2pFamsJ0VZvgqyiPRBu3IWrdnQX9EN1hlb8xU6GHkLCzSfY74DtM";
  shift=coded.length;
  link="";
  for (i=0; i<coded.length; i++) {
    if (key.indexOf(coded.charAt(i))==-1) {
      ltr = coded.charAt(i);
      link += (ltr);
    }
    else {     
      ltr = (key.indexOf(coded.charAt(i))-shift+key.length) % key.length;
      link += (key.charAt(ltr));
    }
  }

  if(type == 'nolink'){
    document.write(link);
  } else if(type == 'text'){
    document.write("<a href='mailto:"+link+"'>"+text+"</a>");
  } else if(type == 'img'){
    document.write("<a href='mailto:"+link+"'><img src=\""+img+"\" border=\"0\" alt=\""+alt+"\" class=\"onM\" /></a>");
  } else {
    document.write("<a href='mailto:"+link+"'>"+link+"</a>");
  }
}


var TargetFormName = Class.create({
  initialize: function() {
    this.targets = $A();
  },

  add : function(name) {
    this.targets.push(name);
    //alert(this.targets);
  },

  del : function(name) {
    var cl = this.targets.clone();
    this.targets = cl.without(name);
    //alert(this.targets);
  },

  clear : function () {
    this.target = $A();
  },

  qs : function () {
    var rs = "";
    this.targets.each(function (item) {
      rs = rs + "target_forms:list=" + item + "&";
    });
    return rs;
  },

  alert : function () {
    //alert("qs : " + this.qs());
  }

});

var SessionInterface = Class.create({
    initialize: function (ses_bin_url) {
        this.base = ses_bin_url;
        this.retval = null;
    },

    set : function(key, val) {
        var p = $H({'key': key, 'val': val});
        var a = new Ajax.Request(
            this.base + 'set',
            {
                method: 'get',
                parameters: p.toQueryString()
            });
    },

    get : function(key) {
        var n = new Date();
        var p = $H({'key': key, 'cache': n.getTime()});
        var a = new Ajax.Request(
            this.base + 'get',
            {
                method: 'get',
                parameters: p.toQueryString(),
                asynchronous: false
            });
        return a.transport.responseText.evalJSON();
   },

   clear : function() {
        var n = new Date();
        var p = $H({'cache': n.getTime()});
        var a = new Ajax.Request(
            this.base + 'clear',
            {
                method: 'get',
                parameters: p.toQueryString(),
                asynchronous: false
            });
    }
});

var form_target = new TargetFormName();
var jsession = new SessionInterface('/inq/ses_bin/');

function tfclear() {
  form_target.clear();
  jsession.clear();
}

function news_hsize() {
var h = 0;
var Opera = window.opera ? true : false;
 if (Opera) {
  h = document.getElementById('lmenu_box_news_if').contentDocument.getElementById('inHeight').offsetHeight + 20;
  document.getElementById('lmenu_box_news_if').setAttribute("height",h);
 } else if ( !document.all ) {
  h = document.getElementById('lmenu_box_news_if').contentDocument.getElementById('inHeight').offsetHeight;
  document.getElementById('lmenu_box_news_if').style.height = h + 20 + 'px';
 } else if( document.all ) {
  h = document.frames('lmenu_box_news_if').document.body.scrollHeight;
  document.all.lmenu_box_news_if.style.height = h + 20 + 'px';
 }
}
