/*
 * basic.js - osaka-saisei Group
 *
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 */

var osakasaisei = {
	preloader: {
		loadedImages: [],
		load: function (url){
			var img = this.loadedImages;
			var l = img.length;
			img[l] = new Image();
			img[l].src = url;
		}
	},
	uri: {
		dirName: function(uri){
			var ary = uri.split('/');
			ary.pop();
			return ary.join('/');
		},
		path: function (uri){
			return uri.split('#')[0];
		},
		anchorName: function (uri){
			return uri.split('#')[1];
		},
		isSelfLink: function(href){
			return ((this.path(href) == this.path(location.href)) || (this.path(href) == this.dirName(location.href)+'/'));
		}
	}
};

$(function(){
		
		
//画像ロールオーバー

function initRollOverImages() {
  var image_cache = new Object();
  $("img.btn").each(function(i) {
    var imgsrc = this.src;
    var dot = this.src.lastIndexOf('.');
    var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
    image_cache[this.src] = new Image();
    image_cache[this.src].src = imgsrc_on;
    $(this).hover(
      function() { this.src = imgsrc_on; },
      function() { this.src = imgsrc; });
  });
}

$(document).ready(initRollOverImages);

});


//ウィンドウを閉じる

function close_win(){
  var nvua = navigator.userAgent;
    if(nvua.indexOf('MSIE') >= 0){
      if(nvua.indexOf('MSIE 5.0') == -1) {
        top.opener = '';
      }
    }
    else if(nvua.indexOf('Gecko') >= 0){
      top.name = 'CLOSE_WINDOW';
      wid = window.open('','CLOSE_WINDOW');
    }
    top.close();
}



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//フォントサイズ切り替え

var fontSizeUnit = "%";

var perOrder = 15;

var defaultSize = 100;

var ckName = "FSCc";

var ckDays = 30;

var ckPath = "/"

var fsCK = GetCookie( ckName );

if ( fsCK == null ){
  var currentSize = defaultSize;
}
else{
  var currentSize = eval( fsCK );
}

document.writeln( '<style type="text/css">' );
document.write( 'div#wrapper {font-size:' + currentSize + fontSizeUnit+ '}' );
document.writeln( '</style>' );

function fsc( CMD ){

  if ( CMD == "larger" ){
    var newSize = Number( currentSize + perOrder );
    SetCookie( ckName , newSize );
  }

  if ( CMD == "smaller" ){
    if ( currentSize != perOrder ){
      var newSize = Number( currentSize - perOrder );
      SetCookie( ckName , newSize );
    }
    else{
      var newSize = Number( currentSize );
    }
  }

  if ( CMD == "default" ){
    DeleteCookie( ckName );
  }

  location.reload();
}

function SetCookie( name , value ){
  var dobj = new Date();
  dobj.setTime(dobj.getTime() + 24 * 60 * 60 * ckDays * 1000);
  var expiryDate = dobj.toGMTString();
  document.cookie = name + '=' + escape(value) + ';expires=' + expiryDate + ';path=' + ckPath;
}

function GetCookie (name){
  var arg  = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen){
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
    return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break;
  }
  return null;
}

function getCookieVal (offset){
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
  endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset,endstr));
}

function DeleteCookie(name){
  if (GetCookie(name)){
    document.cookie = name + '=' +
    '; expires=Thu, 01-Jan-70 00:00:01 GMT;path='+ckPath;
  }
}


var navname,navvers,newsnavc=0,sidebarcnt;

navname=navigator.appName;
navvers=parseInt(navigator.appVersion);

js_ok = ((navname == "Microsoft Internet Explorer") && (navvers >= 4 )) || ((navname == "Netscape") && (navvers >= 4 ));

function inputswap(me,def,setto) {
	if(js_ok) {
		if(me.value==def) {
			me.value=setto;
		}
	}
}



$(function(){
					 
});
