/* Ｃ２１ Official Site JavaScript
========================================================

WebSite:  www.c21-online.jp
Author:   Cyber Step, Inc.
Version:  27 January 2006

======================================================== */

var d = document;

/* Link Outline
----------------------------------------------- */
function linkOutline() {
　　var blur = function () { this.blur() };
　　for (var i = 0; i < d.links.length; i++)
　　　　d.links[i].onfocus = blur;
}


/* Popup Window
----------------------------------------------- */
var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

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

/* Swap Image
----------------------------------------------- */
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/* New Image 
----------------------------------------------- */
var term = 2;
function setNEW(d){
if( ((new Date()-new Date(d)) / (24*60*60*1000)) <= term ) 
	document.write("<img class='new' src='/i/base/new.gif'>");
}


/* recomend Image 
----------------------------------------------- */
var term = 2;
function setRECO(d){
if( ((new Date()-new Date(d)) / (24*60*60*1000)) <= term ) 
	document.write("<img class='new' src='/i/base/recomen.gif'>");
}


/* TOP10 Image 
----------------------------------------------- */
var term = 2;
function TOP10(d){
if( ((new Date()-new Date(d)) / (24*60*60*1000)) <= term ) 
	document.write("<img class='new' src='/i/base/top10.gif'>");
}

/* SHOPNEW Image 
----------------------------------------------- */
var term = 2;
function shopNEW(d){
if( ((new Date()-new Date(d)) / (24*60*60*1000)) <= term ) 
	document.write("<img class='new' src='/i/base/shopnew.gif'>");
}

/* Flash Include
----------------------------------------------- */
function callFlash(URI, W, H) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + W + '" height="' + H + '"><param name="movie" value="' + URI + '" /><param name="base" value="." /><param name="quality" value="high" /><param name="wmode" value="transparent"><embed src="' + URI + '" wmode="transparent" base="." quality="high" pluginspage="//www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + W + '" height="' + H + '"></embed></object>');
}
function callFlashWithScript(URI, W, H, VAL) {
ID = URI.split("/");IDNAME = ID[ID.length - 1].replace(/\.swf$/g, '');
if(!VAL) VAL = '';
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" id="extarnal_' + IDNAME + '" width="' + W + '" height="' + H + '"><param name="movie" value="' + URI + '" /><param name="base" value="." /><param name="quality" value="high" /><param name="wmode" value="transparent"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><param name="flashVars" value="' + VAL + '" /><embed src="' + URI + '" wmode="transparent" base="." quality="high" pluginspage="//www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" width="' + W + '" height="' + H + '" flashVars="' + VAL + '"></embed></object>');
}

/* puldown js
----------------------------------------------- */
function menuLink(linkLoc)
{ if(linkLoc !="") { window.location.href=linkLoc;} }

/* データベースのマップのリンク
----------------------------------------------*/
function dbLink(parts){
          location.replace(parts.options[parts.selectedIndex].value);
     }     


/* wrap scroll
----------------------------------------------- */

var wrapScroll=function(){this.initialize.apply(this,arguments);};wrapScroll.prototype={Version:'0.9.5',Interval:500,Duration:60,marginTop:0,marginBottom:0,_timer:0,_obj:null,initialize:function(e,p,r){this.attach(window,'load',this.bind(this.prepare,arguments));},prepare:function(e,p,r){if(o=document.getElementById(e)){this._obj={'e':o,'p':(p)?document.getElementById(p):o.parentNode,'r':(r)?document.getElementById(r):null};o.style.position='absolute';if((c=o.offsetTop)!=(v=((o.style.top=o.offsetTop+'px')!='')?o.offsetTop:0)){o.style.marginTop=0;o.style.top=c+(v-c)+'px';}this.callback();}},callback:function(){f=this.event.update(this,this._obj);setTimeout(this.bind(this.callback),(f)?10:this.Interval);},bind:function(method,arg){var _this=this;var _arg=(arg)?arg:[];return function(){method.apply(_this,_arg);}},attach:function(e,name,func,cap){if(e.addEventListener){e.addEventListener(name,func,cap);}else if(e.attachEvent){e.attachEvent('on'+name,func);}},setTween:function(f,d){if(f){this.tween=f;}if(d){this.Duration=d;}},tween:function(t,b,c,d){return c*(t/=d)*t+b;}};wrapScroll.prototype.event={update:function(t,o){var tpos=Math.max(this.scroll(),(o.r)?this.offset(o.r)+this.height(o.r):this.offset(o.p));var bpos=(this.offset(o.p)+this.height(o.p))-(this.height(o.e)+t.marginBottom);var s=this.offset(o.e);var e=Math.min(bpos,tpos+t.marginTop);if((t._prev!=e)||(t._timer>t.Duration)){t._timer=0;}if((t._prev=e)!=s){o.e.style.top=t.tween(t._timer++,s,e-s,t.Duration,o.e.style)+'px';return true;}return false;},scroll:function(){return document.body.scrollTop||document.documentElement.scrollTop;},height:function(o){return o.offsetHeight||document.body.scrollHeight||document.documentElement.scrollHeight;},offset:function(o){y=o.offsetTop;if(o.style.position=='absolute')return y;while(o=o.offsetParent){y+=o.offsetTop;}return y;}};


/* pagetop scroll
----------------------------------------------- */

function pageTop() {
	var x1 = x2 = x3 = 0;
	var y1 = y2 = y3 = 0;
	if (document.documentElement) {
		x1 = document.documentElement.scrollLeft || 0;
		y1 = document.documentElement.scrollTop || 0;
	}
	if (document.body) {
		x2 = document.body.scrollLeft || 0;
		y2 = document.body.scrollTop || 0;
	}
	x3 = window.scrollX || 0;
	y3 = window.scrollY || 0;
	var x = Math.max(x1, Math.max(x2, x3));
	var y = Math.max(y1, Math.max(y2, y3));
	window.scrollTo(Math.floor(x / 1.4), Math.floor(y / 1.4));
	if (x > 0 || y > 0) {
		window.setTimeout("pageTop()", 10);
	}
}

function parentPosition(aname){
	if(navigator.appName=="Microsoft Internet Explorer"){
		document.location.hash  = "";
	}else{
		parent.location.hash  = aname;
	}
}