// ヘッダ用JavaScript
document.write('<script type="text/javascript" src="/script/header.js"></script>');

// スタイルシート
if(navigator.appVersion.indexOf('Mac')!=-1)
	document.write("<link rel='stylesheet' href='/css/mac.css?date=' + (new Date()).getTime() + ' type='text/css'>");
else if(navigator.appName.charAt(0) == 'M')
	document.write("<link rel='stylesheet' href='/css/winie.css?date=' + (new Date()).getTime() + ' type='text/css'>");
else
	document.write("<link rel='stylesheet' href='/css/winnn.css?date=' + (new Date()).getTime() + ' type='text/css'>");
document.write("<link rel='stylesheet' href='/css/header.css?date=' + (new Date()).getTime() + ' type='text/css'>");

// 別ウィンドウで表示する（サイズ可変）
function OpenWindow(URL, widthsize, heightsize){
	window.open(URL, '_blank', 'width=' + widthsize + ',height=' + heightsize + ',scrollbars=yes,resizable=yes');
}

function openFlashWin(){
	w = window.open("/success/special/special.asp?scl_id=2039400","FLASH","width=750,height=562,toolbar=no,status=yes,scrollbars=no,resizable=no");
	w.focus();
}

function openFlash(scl_id,width,height){
	w = window.open("/success/special/special.asp?scl_id=" + scl_id,"FLASH","width=" + width + ",height=" + height + ",toolbar=no,status=yes,scrollbars=no,resizable=no");
	w.focus();
}

// カートを開く
function OpenCart(Url){

//	Url = Url.replace("seikyu/cart.asp?","sclbase/sclbase.asp?Mode=Seikyu&")
	Url = Url.replace("cart.asp?","nocart.asp?")
	top.location.href=Url;

//カート用
//	newwin=window.open(Url,"cart","width=600,height=350,alwaysRaised=yes,dependent=yes,titlebar=no,directories=no,location=no,scrollbars=yes,menubar=no,status=no,resizable=yes");
//	newwin.focus();
}

// 検索結果→カート
function SearchIntoCart(tp, id){
	location.href = "/success/seikyu/9p_cart.asp?scl_id=" + id + "&seikyu_tp=" + tp + "&mode=List";
}

// テキストボックスにデフォルト文言を薄く表示
function onBlurWd(fName,eName,szWord){
	var locWord = document.forms[fName].elements[eName].value;

	if(locWord == ''){
		document.forms[fName].elements[eName].style.color = '#bbbbbb';
		document.forms[fName].elements[eName].value = szWord;
	}
}

function onFocusWd(fName,eName,szWord){
	var locWord = document.forms[fName].elements[eName].value;

	document.forms[fName].elements[eName].style.color = '#000000';
	if(locWord == szWord){
		document.forms[fName].elements[eName].value = '';
	}
}

// 画像先読み（引数は配列）
function preload_image(locList){
	if(document.images){
		for(var ii = 0; ii < locList.length; ii++){
			var locImg = new Image();
			locImg.src = locList[ii];
		}
	}
}

function logwrite(locType){
	if(document.images){
		var locImg = new Image();
		locImg.src = '/common/click_log.asp?click_tp=' + locType + '&url=' + escape(top.document.URL);
	}
}

function logwrite2(locType, locURL){
	if(document.images){
		var locImg = new Image();
		locImg.src = '/common/click_log.asp?click_tp=' + locType + '&url=' + locURL;
	}
}

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.0
  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 && document.getElementById) x=document.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];}
}

// iframeの高さを取得する
function getIFrameHeight(locdiffHeight){
	var iHeight;

	if(window.innerHeight)
		iHeight = window.innerHeight-locdiffHeight;
	else if(document.body.clientHeight)
		iHeight = document.body.clientHeight-locdiffHeight;
	else
		iHeight = 450;
	if(iHeight < 200)
		iHeight = 200;
	return iHeight;
}

// 範囲指定用クリック
function wide_click(object){
	if(object.checked)
		object.checked=false;
	else
		object.checked=true;
}

// チェックリストPOPUP用
var clist_win;
function OpenPopupWindowCheckList()
{
	//window.nameが未設定の場合、資料請求時にpost先のtargetが指定できないので自動設定する
	if(window.name==null||window.name=='')window.name=(new Date()).getTime();
	if(window.location.hostname == 'www.js88.com')window.location.href='http://school.js88.com/';
	if(clist_win!=null)clist_win.close();
	clist_win = window.open('/success/checklist/jsc_checklist.html','CheckListWindow',
		'width=640,height=800,top=0,menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes');
	clist_win.focus();
}

// 動画再生用
function movie_start(url, wndName){
	var oWin = window.open(url,wndName);
	setTimeout("oWin.close();",3000);
}

// マウスオーバー時のフィルター適用
function img_alpha_filter(obj,tp1,tp2){
	obj.style.filter = 'alpha(opacity=' + tp1 + ')';
	obj.style.opacity = tp2;
}