/*==============================================
 checkjs
==============================================*/
$(function(){$('body').removeClass('nojs');});

/*==============================================
 rootDir
==============================================*/
var rootDir = (location.protocol.match(/file/i))      ? 'htdocs'
            : (location.hostname.match(/localhost/i)) ? ''
            : (location.pathname.match(/demo_test/i))   ? 'boy' : '';
var rootPath = location.pathname.replace(/\\/g,'/').replace(/\/+/g,'/');
if(rootDir) rootPath = rootPath.substr(rootPath.indexOf(rootDir)+rootDir.length);
function here(cnd,not){
  if(cnd instanceof Array) cnd = cnd.join('|');
  var apply = (rootPath.match(new RegExp(cnd,'i'))) ? true : false;
  return (not) ? !apply : apply;
}
here.is   = function(cnd){return here(cnd,false);};
here.isnt = function(cnd){return here(cnd,true);};

/*==============================================
 insert swf
==============================================*/
$.fn.insertSWF = function(opt) {
  var cfg = $.extend({
    wmode             : 'transparent',
    allowScriptAccess : 'always',
    allowFullScreen   : 'always',
    menu              : 'false',
    base              : '.',
    version           : 8,
    addMode           : 'html',
    requireCode       : '<p class="requireFlashPlayer">こちらのコンテンツをご覧いただくには、最新のAdobe Flash Playerが必要です。<br />お手数ですが、以下のリンクから最新のAdobe Flash Playerを入手してください。<br /><br /><a href="http://get.adobe.com/jp/flashplayer/" target="_blank">→Get Flash Player</a></p>'
  }, opt);
  $(this).each(function(){
    var addMode = cfg.addMode;
    var code    = '';
    if(DetectFlashVer(cfg.version,0,0) && cfg.src && cfg.width && cfg.height) {
      cfg.version = cfg.addMode = cfg.requireCode = null;
      code = AC_FL_RunContent(cfg);
    } else {
      code = cfg.requireCode;
    }
    if(code == cfg.requireCode) return false;
       (addMode == 'html')    ? $(this).html(code)
      :(addMode == 'append')  ? $(this).append(code)
      :(addMode == 'prepend') ? $(this).prepend(code)
      :(addMode == 'after')   ? $(this).after(code)
      :(addMode == 'before')  ? $(this).before(code)
      :(addMode == 'replace') ? $(this).replaceWith(code) : '';
  });
};

/*==============================================
 easily RollOver
==============================================*/
$.fn.imageRollOver = function(){
	var obj = obj || {};
	$(this).each(function(){
		var src  = this.src;
		var osrc = src.replace("_off.","_on.");
		obj[src] = new Image();
		obj[src+"_d"] = new Image();
		obj[src].src = osrc;
		obj[src+"_d"].src = src;
		$(this).hover(function(){
			this.src = obj[src].src;
		},function(){
			this.src = obj[src+"_d"].src;
		})
	})
}


/*==============================================
 IE bgfix
==============================================*/
try{document.execCommand("BackgroundImageCache", false, true);} catch(e){}
