var skjs = function() {
	//ロールオーバー
	this.addrollover = function (){
		n = $('img').size();//img
		for(var i=0; i < n; i++) if($('img').eq(i).attr('src').match('_off'))$('img').eq(i).hover(function(){$(this).attr('src',$(this).attr('src').replace('_off','_on'));},function(){$(this).attr('src',$(this).attr('src').replace('_on','_off'));});
		n = $('input').size();//input
		for(var i=0; i < n; i++) if($('input').eq(i).attr('type') == 'image')if($('input').eq(i).attr('src').match('_off'))$('input').eq(i).hover(function(){$(this).attr('src',$(this).attr('src').replace('_off','_on'));},function(){$(this).attr('src',$(this).attr('src').replace('_on','_off'));});
	}
	//スムースロールオーバー
	this.addsmoothscroll = function (time){
		$('a[href^=#]').click(function() {
			var $target=$(this.hash);
			var targetY=$target.offset().top;
			$($.browser.opera ? document.compatMode == 'BackCompat' ? 'body' : 'html' :'html,body').animate({scrollTop: targetY},time);return false;
		});
	}
	//現在位置表示
	this.addcurrent = function (target,type,root){
		target += ' a';
		root = root.replace(/\/$/,"");
		var n_location = location.href;
		//url文字列デコード
		if(n_location.match(/^file/) && n_location.match("%")){
			n_location = decodeURI(n_location);
		}
		n_location = n_location.replace(root,"").replace(/index.html/,"");
		var n_location_arr = n_location.replace(/[^\/]*\.html/,"").split("/");
		console.log(n_location);
		console.log(n_location.replace(/[^\/].*\.html/,""));
		n = $(target).size();
		for(var i=0; i < n; i++){
			var a_location = $(target).eq(i).attr('href');
			//現ディレクトリから
			if(a_location.match(/^[a-z|A-Z|0-9]/)){
				a_location = n_location_arr.join("/") + a_location;
			}
			//相対パス
			else if(a_location.match(/^\.\.\//)){
				a_location = addUrlroot(a_location,n_location);
			}
			a_location = a_location.replace("index.html","");
			//絶対位置
			if(type == "self" && a_location == n_location){
				currenton(target,i);
				return;
			}
			//親ディレクトリ
			else if(type == "super" && a_location.split('/')[1] == n_location.split('/')[1]){
				currenton(target,i);
				return;
			}
		}
	}
	//表示変更
	function currenton(target,i){
		t = $(target + ':eq(' + i + ') > img');
		//画像
		if(t.size() == 1){
			if(t.attr('src').match('_off')){
				t.attr('src',t.attr('src').replace('_off','_on')).unbind('mouseover').unbind('mouseout');
			}
		}else{
			cssobj = getAllStyleRule(target + ":hover").replace(/.*{ ?(.*)}/i,"$1").replace(/; ?$/,"").replace(/:\//g,"\\").split(";");
			t = $(target + ':eq(' + i + ')');
			for(j=0;j<cssobj.length;j++){
				c = cssobj[j].split(":");
				t.css(c[0].replace(/^[ ]*/,"").toLowerCase(),c[1].replace(/^[ ]*/,"").replace(/\\/g,":/"));
			}
		}
	}
	//css擬似クラスを読み込み
	function getAllStyleRule(target) {
		var styleSheets = document.styleSheets;
		var str = '';
		for (var i = 0; i < styleSheets.length; i++) {
			var styleSheet = styleSheets[i];
			var rules = styleSheet.rules || styleSheet.cssRules;
			for (var j = 0; j < rules.length; j++) {
				var rule = rules[j];
				if(navigator.appName=="Microsoft Internet Explorer"){
					re = new RegExp("^" + target,"i");
					if(rule.selectorText.match(re)){
						str += rule.selectorText + " {";
						str += addUrlroot(rule.style.cssText,styleSheet.href);
						str += "}";
					}
				}else{
					if(rule.cssText.match(target))str += addUrlroot(rule.cssText,styleSheet.href);
				}
			}
		}
		return(str);
	}
	//相対パスを絶対パスに
	function addUrlroot(_target,_root){
		_str = _target;
		if(_target.match("../")){
			_l = _root.split("/");
			_n = _l.slice(0,_l.length - _target.split("../").length).join("/");
			_str = _str.replace(/\.\.\//,_n + "/");
		}
		return(_str);
	}
}

//IEconsole
if (typeof window.console != 'object'){
	window.console = {log:function(s){},debug:function(){},info:function(){},warn:function(){},error:function(){},assert:function(){},dir:function(){},dirxml:function(){},trace:function(){},group:function(){},groupEnd:function(){},time:function(){},timeEnd:function(){},profile:function(){},profileEnd:function(){},count:function(){}};
}
