///// for StaticPage /////

//ご意見＆ご質問オープン
function cntWin() {
	newwin =window.open('https://help.zubat.net/hikkoshihikaku/','cnt');
}

function cntWinHoujin() {
	newwin =window.open('https://www.hikkoshihikaku.com/step/hks-houjin/contact.htm','cnt','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=500,height=440,left=0,top=0');
	newwin.focus();
}

function cntWinKaigai() {
	newwin =window.open('https://www.hikkoshihikaku.com/step/hks-kaigai/contact.htm','cnt','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=500,height=440,left=0,top=0');
	newwin.focus();
}

function memberWin() {
   newwin =window.open('http://www.webcrew.co.jp/info/member_pop.html','member',
     'toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=500,heigh=500,left=0,top=0');
   newwin.focus();
}

//ウインドウオープン
function openWin(url,name,property) {
	newwin =window.open(url,name,property);
	newwin.focus();
}

//mapオープン
function mapWin() {
	newwin =window.open('/info/map.html','map','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=450,height=620,left=0,top=0');
	newwin.focus();
}

//ランクオープン
function rankWin(url) {
	newwin =window.open('/rank/rank_pop.html','rank','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=520,height=500,left=0,top=0');
	newwin.focus();
}

//比較オープン
function compWin(url) {
	newwin =window.open(url,'comp','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=430,height=240,left=0,top=0');
	newwin.focus();
}

//達人オープン
function expWin(url) {
	newwin =window.open(url,'exp','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=430,height=400,left=0,top=0');
	newwin.focus();
}

//ブラウザオープン
function brwsWin(url) {
	newwin =window.open(url,'exp','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=550,height=400,left=0,top=0');
	newwin.focus();
}

// クーポンオープン
function couponWin(url) {
	newwin =window.open(url,'coupon','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=740,height=620,left=0,top=0');
	newwin.focus();
}

//topicsオープン
function tpcsWin() {
	newwin =window.open('http://www.webcrew.co.jp/info/topics_mitsumori.html','topics','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=450,height=400,left=0,top=0');
	newwin.focus();
}

// エリア検索 
function searchWin(objUrl) {
	var url = objUrl.href;
	newwin =window.open(url,'search','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=630,height=500,left=0,top=0');
	newwin.focus();
}

//ウインドウクローズ
function winClose(eve){
	window.close();
}

//ブックマーク
function bookmark() {
	if(navigator.userAgent.indexOf("MSIE") > -1){
		window.external.AddFavorite('http://www.hikkoshihikaku.com','引越し比較.com');
	} else if(navigator.userAgent.indexOf("Firefox") > -1){
		window.sidebar.addPanel('引越し比較.com','http://www.hikkoshihikaku.com','');
	}
}

//ソーシャルブックマーク
function postLink(strType) {
	var refUrl = "";
	var strId = "%3FID%3Dhf074";
	var strTitle = encodeURIComponent(document.title);
	var strUrl = encodeURIComponent(location.href.split("?")[0]);

	if( strType == "twitter" ) {
		refUrl = "http://twitter.com/intent/tweet?text=" + strTitle + "%EF%BD%9C" + strUrl + strId +"%20%23%e5%bc%95%e8%b6%8a%e3%81%97%e6%af%94%e8%bc%83%20%23%e5%bc%95%e8%b6%8a%e3%81%97" + "&charset=utf-8";
		twitterwin = window.open(refUrl,"popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=0,top=0,width=550,height=480");
		return;
	} else if( strType == "facebook" ) {
		refUrl = "http://www.facebook.com/sharer.php?u=" + strUrl + strId + "&t=" + strTitle;
		facebookwin = window.open(refUrl,"popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=0,top=0,width=550,height=480");
		return;
	} else if( strType == "yahoo" ) {
		refUrl = "http://bookmarks.yahoo.co.jp/bookmarklet/showpopup?t=" + strTitle + "&u=" + strUrl + strId + "&opener=bm&ei=UTF-8";
		yahoowin = window.open(refUrl,"popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=0,top=0,width=550,height=480");
		return;
	} else if( strType == "google" ) {
		refUrl = "http://www.google.com/bookmarks/mark?op=edit&bkmk=" + strUrl + strId + "&title=" + strTitle;
	} else if( strType == "hatena" ) {
		refUrl = "http://b.hatena.ne.jp/add?mode=confirm&ei=UTF-8&url=" + strUrl + strId + "&title=" + strTitle;
		hatenawin = window.open(refUrl,"popup","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,left=0,top=0,width=550,height=480");
		return;
	} else if( strType == "livedoor" ) {
		refUrl = "http://clip.livedoor.com/redirect?link=" + strUrl + strId + "&title=" + strTitle;
	}

	if(!window.open(refUrl,'surfing'))location.href=refUrl;
}

///// for promoページ/////

//コピーライト
function wCopy(){
	document.write("copyright &copy; 2003 Hikkoshihikaku.com Inc. All rights reserved.&nbsp;")
}

//各社オープン
function comsWin(url) {
	newwin =window.open(url,'coms','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=630,height=550,left=0,top=0');
	newwin.focus();
}

//業者詳細ページ内テキストリンク
function detailWin(url) {
	window.location.href = "/step/hks-detail/rsShowDetail_00_1_"+url+".htm";
}

//コンテンツオープン
function contentsWin(url) {
	newwin =window.open(url,'contents','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=700,height=600,left=0,top=0');
	newwin.focus();
}

//フォームカラー変更
function onForm(which){
	if (document.all || document.getElementById){
		which.style.backgroundColor="#E6FFEC"
		}
}

function blurForm(which){
	if (document.all || document.getElementById){
		which.style.backgroundColor="#FFFFFF"
		}
}

//TOPアンケート結果
function satisfactionWin(url) {
	newwin =window.open(url,'satisfaction','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=640,height=600,left=0,top=0');
	newwin.focus();
}

//print
function ticketPrint() {
	window.print();
}

///// for StepEngine /////

//ヘルプウインドウオープン
function helpWin(url) {
	newwin =window.open(url,'help','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=500,height=440,left=0,top=0');
	newwin.focus();
}

//各社オープン
function comWin(url) {
	newwin =window.open(url,'com','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=650,height=550,left=0,top=0');
	newwin.focus();
}

//利用規約
function termWin() {
	newwin =window.open('http://www.webcrew.co.jp/info/terms_pop.html','terms','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=520,height=500,left=0,top=0');
	newwin.focus();
}

//プライバシーポリシーオープン
function privacyWin() {
    newwin
=window.open('http://www.webcrew.co.jp/info/privacy_pop.html','privacy','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=500,height=500,left=0,top=0');
    newwin.focus();
}

//life Card
function lifeWin() {
	newwin = window.open('/','life','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=760,height=600,left=0,top=0');
	newwin.focus();
}

//郵便番号逆引き
function showZipRev(from) {
	window.open('/common/zip_reverse/index.html?from=' + from,'_blank','width=430,height=640,statusbar=no,menubar=no,resizable=yes');
}

//チェックボックス関連

//ディノス
function dinosWin() {
	newwin =window.open('https://www.zubat.net/hikkoshi/checkbox/dinos/','dinos','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=480,height=600,left=0,top=0');
	newwin.focus();
}

//大地を守る会
function daichiWin() {
	newwin =window.open('https://www.zubat.net/hikkoshi/checkbox/food_delivery/daichi.html','foodDelivery','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=480,height=600,left=0,top=0');
	newwin.focus();
}

//東都生協
function tohtoCoopWin() {
	newwin =window.open('https://www.zubat.net/hikkoshi/checkbox/food_delivery/tohto_coop.html','foodDelivery','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=480,height=600,left=0,top=0');
	newwin.focus();
}

//FRESCO
function frescoWin() {
	newwin =window.open('https://www.zubat.net/hikkoshi/checkbox/fresco/','fresco','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=480,height=600,left=0,top=0');
	newwin.focus();
}

//ベルメゾン
function bellemaisonWin() {
	newwin =window.open('http://www.zubat.net/hikkoshi/checkbox/bellemaison/','bellemaison','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=600,height=500,left=0,top=0');
	newwin.focus();
}

//近畿設備
function knkWin() {
	newwin =window.open('/help/knk/','knk','toolbar=no,location=no,resizable=no,status=no,scrollbars=no,width=430,height=520,left=0,top=0');
	newwin.focus();
}

//マミープランニング
function mamWin() {
	newwin =window.open('/help/mam/','mam','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=530,height=590,left=0,top=0');
	newwin.focus();
}

//ホームダイレクト
function hdWin() {
	newwin =window.open('/help/hd/','HD','toolbar=no,location=no,resizable=no,status=no,scrollbars=no,width=530,height=590,left=0,top=0');
	newwin.focus();
}

//リカバリジャッジ
function rjWin() {
	newwin =window.open('/help/rj/','RJ','toolbar=no,location=no,resizable=no,status=no,scrollbars=no,width=530,height=620,left=0,top=0');
	newwin.focus();
}

//サントリーフーズ
function styWin() {
	newwin =window.open('/help/suntory/','sun','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=670,height=600,left=0,top=0');
	newwin.focus();
}

//トラブル支援センター
function trcWin() {
	newwin =window.open('/help/tr-center/','trc','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=620,height=550,left=0,top=0');
	newwin.focus();
}

//コムズ
function comzWin() {
	newwin =window.open('/help/comz/','comz','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=570,height=500,left=0,top=0');
	newwin.focus();
}

//アライブ
function alive01Win() {
	newwin =window.open('/help/alive/custom/','alive01','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=540,height=500,left=0,top=0');
	newwin.focus();
}

function alive02Win() {
	newwin =window.open('/help/alive/coating/','alive02','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=540,height=500,left=0,top=0');
	newwin.focus();
}

function alive03Win() {
	newwin =window.open('/help/alive/curtain/','alive03','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=540,height=500,left=0,top=0');
	newwin.focus();
}

function alive04Win() {
	newwin =window.open('/help/alive/prevention/','alive04','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=540,height=500,left=0,top=0');
	newwin.focus();
}

//盗聴バスターズ
function bustersWin() {
	newwin =window.open('/help/busters/','bst','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=600,height=500,left=0,top=0');
	newwin.focus();
}

//リサイクルマスター
function rmjWin() {
	newwin =window.open('/help/rmj/','rmj','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=540,height=500,left=0,top=0');
	newwin.focus();
}

//京葉物流
function keiyoWin() {
	newwin =window.open('/help/keiyo/','rmj','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=800,height=600,left=0,top=0');
	newwin.focus();
}

//ソネット
function sonetWin() {
	newwin =window.open('http://www.so-net.ne.jp/cpn/hikkoshi/','rmj','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=800,height=600,left=0,top=0');
	newwin.focus();
}

function sonet02Win() {
	newwin =window.open('/help/so-net/notes.html','sonet02','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=480,height=220,left=0,top=0');
	newwin.focus();
}


//エムズクリエーション
function msWin() {
	newwin =window.open('/help/msc/','ms','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=480,height=220,left=0,top=0');
	newwin.focus();
}

//アフラック
function aflacWin() {
	newwin =window.open('/help/aflac/','aflac','toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,width=600,height=600,left=0,top=0');
	newwin.focus();
}

//アーリア
function ariaWin() {
	newwin =window.open('/help/aria/','aria','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=560,height=600,left=0,top=0');
	newwin.focus();
}

//ブランディア
function brandearWin() {
	newwin =window.open('https://www.zubat.net/hikkoshi/checkbox/brandear/','brandear','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=580,height=600,left=0,top=0');
	newwin.focus();
}

//アルソック
function alsokWin() {
	newwin =window.open('/help/alsok/','alsok','toolbar=no,location=no,resizable=yes,status=no,scrollbars=yes,width=580,height=600,left=0,top=0');
	newwin.focus();
}

//フォーム背景色
/*
function colorChange() {
	this.skip  = ['submit', 'button', 'radio', 'checkbox', 'select-one', 'select-multiple'];
	this.color = { 'blur': '', 'focus': '#DFF5FF' };

	this.set = function() {
		for (var i = 0; i < document.forms.length; i++) {
			for (var f = 0; f < document.forms[i].length; f++) {
				var elm = document.forms[i][f];
				if(!this.checkSkip(elm)) continue;
				this.setColor(elm, 'focus');
				this.setColor(elm, 'blur');
			}      
		}
	}

	this.checkSkip = function(elm) {
		for(var i in this.skip) {
			if(elm.type == this.skip[i]) return false;
		}
		return true;
	}

	this.setColor = function(elm, type) { 
		var color = this.color[type];
		var event = function() { elm.style.backgroundColor = color; };

		if(elm.addEventListener) {
			elm.addEventListener(type, event, false); 
		} else if(elm.attachEvent) {
			elm.attachEvent('on'+type, event); 
		} else {
			elm['on'+type] = event;
		}
	}
}
*/

// onload時にフォーム背景色設定を実行
/*
window.onload = function() {
   var formColor = new colorChange;
   formColor.set();
   getLabel();
}
*/


//thanks バイク保険への誘導フォーム
function getLabel(){
	var lbs = document.getElementsByTagName('label');
	for(var i=0;i<lbs.length;i++){
		var cimgs = lbs[i].getElementsByTagName('img');
		for(var j=0;j<cimgs.length;j++){
			cimgs[j].formCtrlId = lbs[i].htmlFor;
			cimgs[j].onclick = function(){document.getElementById(this.formCtrlId).click()};
		}
	}
}

//inputタグのロールオーバ
//onload重複対策
function addOnload(func){  
	try {
		window.addEventListener("load", func, false);
	} catch (e) {
		// IE用
		window.attachEvent("onload", func);
	}  
}

addOnload(function(){
	//ロールオーバするclassを指定
	if(this.getElementsByClassName("buttonStart").length){
		btnControll2(this.getElementsByClassName("buttonStart"));
	}
	if(this.getElementsByClassName("buttonMoveOn").length){
		btnControll2(this.getElementsByClassName("buttonMoveOn"));
	}
	if(this.getElementsByClassName("buttonBack").length){
		btnControll2(this.getElementsByClassName("buttonBack"));
	}
	if(this.getElementsByClassName("buttonSubmit").length){
		btnControll2(this.getElementsByClassName("buttonSubmit"));
	}
});

/* 一時的に設置 */
function btnControll() {
	var objInput = document.getElementsByName("start_btn");
	if(objInput.length){
		//高さの取得
		var height;
		if(objInput[0].currentStyle) {//IE
			height = objInput[0].currentStyle.height.replace(/px/,"");
		}else if(getComputedStyle) {//Mozilla or Opera
			height = window.getComputedStyle(objInput[0],'').getPropertyValue("height").replace(/px/,"");
		}
		//複数の同名class対応
		for(i = 0;i < objInput.length;i++){
			/* マウスイベント */
			objInput[i].onmouseover = function () {this.style.backgroundPosition = "0 "+height*-1+"px";}
			objInput[i].onmouseout = function () {this.style.backgroundPosition = "0 0";}
		}
	}
}

function btnControll2(action) {
	//高さの取得
	var height;
	if(action[0].currentStyle) {//IE
		height = action[0].currentStyle.height.replace(/px/,"");
	}else if(getComputedStyle) {//Mozilla or Opera
		height = window.getComputedStyle(action[0],'').getPropertyValue("height").replace(/px/,"");
	}
	//複数の同名class対応
	for(i = 0;i < action.length;i++){
		/* マウスイベント */
		action[i].onmouseover = function () {this.style.backgroundPosition = "0 "+height*-1+"px";}
		action[i].onmouseout = function () {this.style.backgroundPosition = "0 0";}
	}
}
function getElementsByClassName (className) {
	//inputタグのみ
	var children = document.getElementsByTagName('input');
	var elements = new Array();
	for (var i = 0; i < children.length; i++) {
		var child = children[i];
		var classNames = child.className.split(' ');
		for (var j = 0; j < classNames.length; j++) {
			if (classNames[j] == className) {
				elements.push(child);
				break;
			}
		}
	}
	return elements;
}

/*function btnOpacity() {
	var objInput = document.getElementsByName("start_btn");
	if(objInput.length){
		for( var i=0; i < objInput.length; i++){
			// マウスイベントの設定
			if (typeof document.body.style.maxHeight != "undefined") {
				// IE 7, mozilla, safari, opera 9
			} else { 
				// IE6, older browsers
				objInput[i].onmouseover = function () {this.className="buttonHover";}	
				objInput[i].onmouseout = function () {this.className = "";}
			}
		}
	}
}*/

