/*
Copyright (c) 2010 TNI. All rights reserved.
Code licensed Creative Commons License:
http://creativecommons.org/licenses/by-nc-nd/2.1/jp/
version:0.6.0
browser:IE6|7|8,FF2|3,Safari3|4|5,Chrome,Opera10
*/
(function(){
/*@cc_on _d=document;eval('var document=_d'); @*/
var BROWSER={FF04:/firefox\/4./i.test(navigator.userAgent),FF03:/firefox\/3./i.test(navigator.userAgent),FF02:/firefox\/2./i.test(navigator.userAgent),FF:/firefox/i.test(navigator.userAgent),IE09:/msie\s9./i.test(navigator.userAgent),IE08:/msie\s8./i.test(navigator.userAgent),IE07:/msie\s7./i.test(navigator.userAgent),IE06:/msie\s6./i.test(navigator.userAgent),IE:/msie/i.test(navigator.userAgent),SF:/a/.__proto__=="//",OP:/opera/i.test(navigator.userAgent),CH:/chrome/i.test(navigator.userAgent)},PRELOADIMG=[],TAG={a:document.getElementsByTagName("a"),abbr:document.getElementsByTagName("abbr"),address:document.getElementsByTagName("address"),area:document.getElementsByTagName("area"),article:document.getElementsByTagName("article"),aside:document.getElementsByTagName("aside"),audio:document.getElementsByTagName("audio"),b:document.getElementsByTagName("b"),base:document.getElementsByTagName("base"),bdo:document.getElementsByTagName("bdo"),blockquote:document.getElementsByTagName("blockquote"),body:document.getElementsByTagName("body"),br:document.getElementsByTagName("br"),button:document.getElementsByTagName("button"),canvas:document.getElementsByTagName("canvas"),caption:document.getElementsByTagName("caption"),cite:document.getElementsByTagName("cite"),code:document.getElementsByTagName("code"),col:document.getElementsByTagName("col"),colgroup:document.getElementsByTagName("colgroup"),command:document.getElementsByTagName("command"),datalist:document.getElementsByTagName("datalist"),dd:document.getElementsByTagName("dd"),del:document.getElementsByTagName("del"),details:document.getElementsByTagName("details"),dfn:document.getElementsByTagName("dfn"),div:document.getElementsByTagName("div"),dl:document.getElementsByTagName("dl"),dt:document.getElementsByTagName("dt"),em:document.getElementsByTagName("em"),embed:document.getElementsByTagName("embed"),fieldset:document.getElementsByTagName("fieldset"),figcaption:document.getElementsByTagName("figcaption"),figure:document.getElementsByTagName("figure"),footer:document.getElementsByTagName("footer"),form:document.getElementsByTagName("form"),h1:document.getElementsByTagName("h1"),h2:document.getElementsByTagName("h2"),h3:document.getElementsByTagName("h3"),h4:document.getElementsByTagName("h4"),h5:document.getElementsByTagName("h5"),h6:document.getElementsByTagName("h6"),head:document.getElementsByTagName("head"),header:document.getElementsByTagName("header"),hgroup:document.getElementsByTagName("hgroup"),hr:document.getElementsByTagName("hr"),html:document.getElementsByTagName("html"),i:document.getElementsByTagName("i"),iframe:document.getElementsByTagName("iframe"),img:document.getElementsByTagName("img"),input:document.getElementsByTagName("input"),ins:document.getElementsByTagName("ins"),kbd:document.getElementsByTagName("kbd"),keygen:document.getElementsByTagName("keygen"),label:document.getElementsByTagName("label"),legend:document.getElementsByTagName("legend"),li:document.getElementsByTagName("li"),link:document.getElementsByTagName("link"),map:document.getElementsByTagName("map"),mark:document.getElementsByTagName("mark"),menu:document.getElementsByTagName("menu"),meta:document.getElementsByTagName("meta"),meter:document.getElementsByTagName("meter"),nav:document.getElementsByTagName("nav"),noscript:document.getElementsByTagName("noscript"),object:document.getElementsByTagName("object"),ol:document.getElementsByTagName("ol"),optgroup:document.getElementsByTagName("optgroup"),option:document.getElementsByTagName("option"),output:document.getElementsByTagName("output"),p:document.getElementsByTagName("p"),param:document.getElementsByTagName("param"),pre:document.getElementsByTagName("pre"),progress:document.getElementsByTagName("progress"),q:document.getElementsByTagName("q"),rp:document.getElementsByTagName("rp"),rt:document.getElementsByTagName("rt"),ruby:document.getElementsByTagName("ruby"),samp:document.getElementsByTagName("samp"),script:document.getElementsByTagName("script"),section:document.getElementsByTagName("section"),select:document.getElementsByTagName("select"),small:document.getElementsByTagName("small"),source:document.getElementsByTagName("source"),span:document.getElementsByTagName("span"),strong:document.getElementsByTagName("strong"),style:document.getElementsByTagName("style"),sub:document.getElementsByTagName("sub"),summary:document.getElementsByTagName("summary"),sup:document.getElementsByTagName("sup"),table:document.getElementsByTagName("table"),tbody:document.getElementsByTagName("tbody"),td:document.getElementsByTagName("td"),textarea:document.getElementsByTagName("textarea"),tfoot:document.getElementsByTagName("tfoot"),th:document.getElementsByTagName("th"),thead:document.getElementsByTagName("thead"),time:document.getElementsByTagName("time"),title:document.getElementsByTagName("title"),tr:document.getElementsByTagName("tr"),ul:document.getElementsByTagName("ul"),"var":document.getElementsByTagName("var"),video:document.getElementsByTagName("video"),wbr:document.getElementsByTagName("wbr")},GJ=function(){var d=function(b,c,f){switch(b.slice(0,1)){case "#":return document.getElementById(b.slice(1));break;case ".":default:b=b.slice(1);c=c.split(/:/);if(c=="")for(var a in TAG){var d=TAG[a].length;while(d--){var e=TAG[a][d].getAttribute("class")||TAG[a][d].getAttribute("className");e&&e.match(b)||b==""?f(TAG[a][d]):""}}else{var a=c.length;while(a--){var d=TAG[c[a]].length;while(d--){var e=TAG[c[a]][d].getAttribute("class")||TAG[c[a]][d].getAttribute("className");e&&e.match(b)||b==""?f(TAG[c[a]][d]):""}}}}},a={addClass:function(a,b){if(a.className){if(!a.className.match(b))a.className+=" "+b}else a.className+=b},getCSS:function(a){if(!BROWSER.IE)return document.defaultView.getComputedStyle(a,"");else if(a.currentStyle)return a.currentStyle},scanAssociate:function(c,a){for(var b in a)if(a[b])switch(c){case "name":return b;break;case "value":default:return a[b]}},noSpace:function(a){var b=function(b){for(var a=0;a<b.childNodes.length;a++)if(b.childNodes[a].nodeType==1)arguments.callee(b.childNodes[a]);else if(b.childNodes[a].nodeType==3)switch(b.childNodes[a].nodeValue){case "\r":case "\n":case " \r":case " \n":case "\r\n":b.removeChild(b.childNodes[a]);a--}};b(a);a.style.visibility="visible";if(BROWSER.IE06||BROWSER.IE07)a.style.zoom="1"}},c={aHeights:function(c){a.noSpace(c);var d=b.offsetHeight,e=function(c){var k=c.firstChild.className.match("enc0")?parseInt(c.firstChild.className.substr(c.firstChild.className.indexOf("enc0"),5).slice(4)):0,j=0,d=0,g=c.childNodes.length,h=c.childNodes.length;while(g--){while(c.childNodes[g].nodeType!=1)g--;var e=c.childNodes[g],l=k;while(l--)e=e.firstChild;e.style.height="";if(j<e.offsetHeight)j=e.offsetHeight}while(h--){while(c.childNodes[h].nodeType!=1)h--;var f=c.childNodes[h],m=k;while(m--)f=f.firstChild;var b=a.getCSS(f),d=0,i=j;d-=b.paddingTop?b.paddingTop.replace("px",""):0;d-=b.paddingBottom?b.paddingBottom.replace("px",""):0;d-=b.borderTopWidth&&b.borderTopWidth!="medium"?b.borderTopWidth.replace("px",""):0;d-=b.borderBottomWidth&&b.borderBottomWidth!="medium"?b.borderBottomWidth.replace("px",""):0;i+=BROWSER.IE06?i%2==0?d+2:d:d;f.style.height=i+"px"}};e(c);setInterval(function(){if(d!=b.offsetHeight){e(c);d=b.offsetHeight}},250)},clearFix:function(b){if(b.nodeType==1&&b.parentNode.nodeType==1&&!b.parentNode.className.match("clearFix")){var c=a.getCSS(b),d=c?c.styleFloat||c.cssFloat:"";d!="none"&&a.addClass(b.parentNode,"clearFix")}},enclosure:function(a){if(a.className.match(/enc[0-9][0-9]/)){var f=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],d=document.createElement("div"),b=new Number(a.className.substr(a.className.indexOf("enc"),5).slice(3))-1,g,c;d.className="div"+f[0];if(b>25)b=25;g=b;do if(b!=0){var e=document.createElement("div");e.className="div"+f[g-b+1];if(c==undefined){d.appendChild(e);c=d.firstChild}else{c.appendChild(e);c=c.firstChild}if(b==1)while(a.firstChild)c.appendChild(a.firstChild)}else while(a.firstChild)d.appendChild(a.firstChild);while(b--);a.appendChild(d);a.style.visibility="visible"}},distributionBrowser:function(){document.body.setAttribute("id",e)},lateralStripes:function(f){a.noSpace(f);var d=0,e=1,b=f,c={main:function(){while(d<b.childNodes.length){d%2==0?c.odd():c.even();d++}f.style.visibility="visible"},even:function(){a.addClass(b.childNodes[d],"even");e==0?e++:""},odd:function(){a.addClass(b.childNodes[d],"odd");e==1?e--:""}};switch(f.nodeName){case "TABLE":var g=b.childNodes.length;while(g--)if(b.childNodes[g].nodeName=="TBODY"){b=b.childNodes[g];c.main()}break;case "DL":while(d<b.childNodes.length){b.childNodes[d].nodeName=="DT"?e==0?c.even():c.odd():e==1?c.even():c.odd();d++}break;case "OL":case "UL":c.main()}},noSpace:function(b){a.noSpace(b)},nthChild:function(d){a.noSpace(d);var f=2,b=d,c={main:function(){if(b.childNodes.length!=0&&(b.firstChild.nodeType==1||b.lastChild.nodeType==1)){c.first();c.last();d.className.match("nthChild")?c.number(2,1):"";d.style.visibility="visible"}},first:function(){a.addClass(b.firstChild,"first")},number:function(c,d){while(c<b.childNodes.length){a.addClass(b.childNodes[c-d],"num"+c);c++}},last:function(){a.addClass(b.lastChild,"last")}};switch(d.nodeName){case "TABLE":var e=b.childNodes.length;while(e--)if(b.childNodes[e].nodeType==1&&b.childNodes[e].nodeName=="TBODY"){b=b.childNodes[e];c.main()}break;case "DL":d.className.match("nthChild")?c.number(1,0):"";break;default:c.main()}},radius:function(a){var d=document.createElement("span"),e=document.createElement("span"),b=document.createElement("span"),c=document.createElement("span");d.className="partsCTL";e.className="partsCTR";b.className="partsCBL";c.className="partsCBR";a.insertBefore(e,a.firstChild);a.insertBefore(d,a.firstChild);a.appendChild(b);a.appendChild(c);a.style.visibility="visible"},rollOver:function(a){if(!a.className.match("noRoll")&&a.src.match(/_n\./)){var b=PRELOADIMG.length,c=0;while(b--)PRELOADIMG[b].src!=a.src.replace(/_n\./,"_o.")?c++:"";if(PRELOADIMG.length==0||PRELOADIMG.length==c){PRELOADIMG[PRELOADIMG.length]=new Image;PRELOADIMG[PRELOADIMG.length-1].src=a.src.replace(/_n\./,"_o.")}if(BROWSER.IE){a.attachEvent("onmouseover",function(){a.src=a.src.replace(/_n\./,"_o.")});a.attachEvent("onmouseout",function(){a.src=a.src.replace(/_o\./,"_n.")});a.attachEvent("onmouseup",function(){a.src=a.src.replace(/_o\./,"_n.")})}else{a.addEventListener("mouseover",function(){this.src=this.src.replace(/_n\./,"_o.")},false);a.addEventListener("mouseout",function(){this.src=this.src.replace(/_o\./,"_n.")},false);a.addEventListener("mouseup",function(){this.src=this.src.replace(/_o\./,"_n.")},false)}}},toolChip:function(b){switch(b.nodeName){case "AREA":case "INPUT":b.title=b.alt;break;case "DL":case "OL":case "UL":a.noSpace(b);var c=b.childNodes.length;while(c--)b.childNodes[c].title=BROWSER.FF?b.childNodes[c].textContent:b.childNodes[c].innerText;break;default:b.title=BROWSER.FF?b.textContent:b.innerText}}},f=a.scanAssociate("value",BROWSER),e=a.scanAssociate("name",BROWSER),b=document.createElement("div");b.style.visibility="hidden";b.style.position="absolute";b.style.top="0px";b.style.left="0px";b.style.zIndex="0";b.appendChild(document.createTextNode("a"));document.body.appendChild(b);c.distributionBrowser();d(".noSpace","",c.noSpace);d("","img:input",c.rollOver);d("","dl:ol:table:ul",c.nthChild);d(".lStripes","dl:ol:table:ul",c.lateralStripes);d(".tChip","",c.toolChip);d(".radius","",c.radius);d(".enc","",c.enclosure);d(".aHeights","div:dl:ol:ul",c.aHeights);d("","",c.clearFix);window.$=d;window.MD=a};if(BROWSER.IE){var confirm=function(){try{document.body.doScroll("up")}catch(a){setTimeout(arguments.callee,0);return}GJ()};confirm()}else if(BROWSER.OP){var a,confirm=function(){if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return}if(a===undefined){var c=document.getElementsByTagName("link"),d=c.length,b=0;while(d--)b++;if(document.styleSheets.length!=b){setTimeout(arguments.callee,0);return}}GJ()};confirm()}else document.addEventListener&&document.addEventListener("DOMContentLoaded",GJ,false);try{window.addEventListener("load",function(){if(location.hash)location.hash=location.hash},false)}catch(e){window.attachEvent("onload",function(){if(location.hash)location.hash=location.hash})}window.BROWSER=BROWSER;window.PRELOADIMG=PRELOADIMG;window.TAG=TAG})()










/* writeFlash
 -------------------------------------------------------- */
var writeFlash=function(s,w,h,i,m){
	var 	html='',
			flashPlayerVersion=function(){
				var version=0;

				if(navigator.plugins&&navigator.mimeTypes['application/x-shockwave-flash']){
					var plugin=navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin;
					if(plugin){version=parseInt(plugin.description.match(/\d+\.\d+/));}
				}else{
					try{
						var flashOCX=new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').match(/([0-9]+)/);
						if(flashOCX){version=parseInt(flashOCX[0]);}
					}catch(e){}
				}

				return version;
			};

	if(flashPlayerVersion()>=7){
		var 	a,
				o={
					'classid':'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
					'codebase':'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'},
				p={
					'allowScriptAccess':'sameDomain',
					'movie':s,
					'quality':'high',
					'wmode':'transparent',
					'menu':'false'},
				e={
					'type':'application/x-shockwave-flash',
					'pluginspage':'http://www.macromedia.com/go/getflashplayer'},
				param=new Array(
					new Array('allowScriptAccess',p.allowScriptAccess),
					new Array('movie',p.movie),
					new Array('quality',p.quality),
					new Array('wmode',p.wmode),
					new Array('menu',p.menu));

		html+='<object classid="'+o.classid+'" codebase="'+o.codebase+'" width="'+w+'" height="'+h+'">';
		for(a=0;a<param.length;a++){html+='<param name="'+param[a][0]+'" value="'+param[a][1]+'">';}
		html+='<embed src="'+s+'" quality="'+p.quality+'" wmode="'+p.wmode+'" width="'+w+'" height="'+h+'" menu="'+p.menu+'" allowScriptAccess="'+p.allowScriptAccess+'" type="'+e.type+'" pluginspage="'+e.pluginspage+'">';
		html+= '</object>';
	}else if(i.length!=0){
		html+='<img src="'+i+'" alt="" width="'+w+'" height="'+h+'"';
		html+=(m.length!=0)?'usemap="'+m+'" />':' />';
	}

	document.write(html);
}










/* openWin
ex:return openWin(this.href,'type&name:width:height:option');
 -------------------------------------------------------- */
var openWin=function(url,data){
	var a,option=',status=yes,scrollbars=yes,directories=yes,menubar=yes,resizable=yes,toolbar=yes';

	if(data!=''){
		data=data.split(':');

		var prm={'name':data[0],
					'width':data[1],
					'height':data[2],
					'option':data[3]};

		switch(prm.name){
			case 'popup750':a=window.open(url,prm.name,'width=750,height=580'+option+'');break;
			default :a=window.open(url,'_blank','width='+prm.width+',height='+prm.height+''+option+'');break;
		}
	}

	if(a!=null){
		a.focus();
		return false;
	}else{
		return false;
	}
}










/* stayLinks
 -------------------------------------------------------- */
var stayLinks=function(obj){

	obj=obj.split(':');

	var 	allow=[],
			path=window.location.pathname,
			nav=document.getElementById(obj[0]);

	nav.innerHTML=nav.innerHTML.replace(/\r|\n| \r| \n/g,'');

	switch(nav.nodeName){
		//<tag><a href="">text</a></tag>
		case 'DD':
		case 'DT':
		case 'P':
		case 'LI':
			for(var a=0;a<obj.length;a++){
				if((nav.childNodes[0].href)&&(path==nav.childNodes[0].href.substring(window.location.host.length+7))||(path==obj[a])||(path==obj[a]+'index.html')||(path==obj[a]+'index.htm')||(path==obj[a]+'index.php')){
					var text=document.createTextNode((BROWSER.FF)?nav.childNodes[0].textContent:nav.childNodes[0].innerText);
					nav.removeChild(nav.firstChild);
					nav.appendChild(text);
				}
			}
		break;
		//<tagParent>
		//<tagChild><a href="">text</a></tagChild>
		//</tagParent>
		case 'DL':
		case 'OL':
		case 'UL':
			for(var b=0;b<nav.childNodes.length;b++){
				if(nav.childNodes[b].childNodes[0].href){
					allow.push(nav.childNodes[b].childNodes[0].href.substring(window.location.host.length+7));
				}else{
					allow.push('none');
				}
			}

			for(var c=0;c<allow.length;c++){
				if((path==allow[c])||(path==allow[c]+'index.html')||(path==allow[c]+'index.htm')||(path==allow[c]+'index.php')){
					var text=document.createTextNode((BROWSER.FF)?nav.childNodes[c].firstChild.textContent:nav.childNodes[c].firstChild.innerText);
					nav.childNodes[c].removeChild(nav.childNodes[c].firstChild);
					nav.childNodes[c].appendChild(text);
					break;
				}
			}
		break;
		default:break;
	}
}










/* jsHEADER
 -------------------------------------------------------- */
var jsHEADER=function(){
	var 	html='',
			path=window.location.pathname;
			nav=new Array(
						new Array('/corporate/','topmessage.html','company','会社情報'));

	html+='<div id="HEADER">'+
		'<p id="logo" title="リョーショクペットケア"><a href="/">リョーショクペットケア</a></p>'+
		'<ul class="headNav tChip">';

	for(var a=0;a<nav.length;a++){
		html+='<li class="'+nav[a][2]+'"><a href="'+nav[a][0]+nav[a][1]+'"';
		html+=(path.match(nav[a][0]))?' class="stay"':'';
		html+='>'+nav[a][3]+'</a></li>';
	}

	html+='<li class="project">事業紹介</li>'+
		'<li class="recruit">リクルート情報</li>'+
		'</ul>'+
		'<!-- /HEADER --></div>';

	document.write(html);
}










/* jsSideMenu
 -------------------------------------------------------- */
var jsSideMenu=function(){
	var html='';
	var a=window.location.pathname;

	var b=a.indexOf('/',1);
	a=a.substring(0,b+1);

	switch(a){
		case '/corporate/':
			html+='<div id="MENU">'+
			'<div class="menuArea">'+
			'<p><img src="img/head_company.jpg" alt="会社情報" width="194" height="37" /></p>'+
			'<ul id="sideMenu" class="tChip">'+
			'<li class="topmessage"><a href="/corporate/topmessage.html">トップメッセージ</a></li>'+
			'<li class="profile"><a href="/corporate/profile.html">企業理念・会社概要</a></li>'+
			'<li class="history"><a href="/corporate/history.html">会社沿革</a></li>'+
			'<li class="sosiki"><a href="/corporate/sosiki.html">組織図</a></li>'+
			'<li class="map"><a href="/corporate/map.html">アクセスマップ</a></li>'+
			'</ul>'+
			'<!-- /menuArea --></div>'+
			'<!-- /MENU --></div>';
			break;
	}
	document.write(html);
	stayLinks('sideMenu');
}









/* jsFOOTER
 -------------------------------------------------------- */
var jsFOOTER=function(){
	var html='';

	html+='<div id="FOOTER">'+
		'<div class="nameArea">'+
		'<p class="companyName" title="株式会社リョーショクペットケア">リョーショクペットケア株式会社</p>'+
		'<!-- /nameArea --></div>'+
		'<div class="navArea clearFix">'+
		'<ul class="footNav clearFix">'+
		'<li><a href="/corporate/topmessage.html">会社情報</a></li>'+
		'<li>事業紹介</li>'+
		'<li>リクルート情報</li>'+
		'</ul>'+
		'<p class="copyright">Copyright (C) 2010 RYOSHOKU PETCARE LTD. All Rights Reserved.</p>'+
		'<!-- /navArea -->'+
		'<!-- /FOOTER --></div>';

	document.write(html);
}
