// mouseover ------------------------------------------------------------------------------------------------------------
function onMouse() {
	if (!document.getElementById) return

	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className == 'ov') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_r'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);

			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}

			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_r'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}


// window open ----------------------------------------------------------------------------------------------------------


function checkKey(){
	if(document.verify_acc.verifyKey.checked!=true){
		$("#verify_agree_error").html("");
		$("#verify_agree_error").html('<p>同意にチェックが入っておりません。<br />「本人確認キー入力」ボタンを押す前に、上記の項目に同意してください。</p>');
	}else{
		document.verify_acc.submit();
	}
}



function openWin(url,name,width,height,mn,scroll) {
	win = window.open(url,name,
					"width=" + width +
					",height=" + height +
					",scrollbars=" + scroll +
					",menubar=" + mn
					);
	window.blur();
	win.focus();
}

function formSubmit($obj){
	$obj.submit();
}


function loadplural() {
	onMouse();
}

function popUpSmall(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=2,location=0,statusbar=1,menubar=0,resizable=0,width=250,height=150,left = 100,top = 134');");
}

function popUpSmall2(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=2,location=0,statusbar=1,menubar=0,resizable=0,width=400,height=180,left = 100,top = 134');");
}

function popUpMiddle(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=2,location=0,statusbar=1,menubar=0,resizable=0,width=640,height=540,left = 100,top = 134');");
}

function toZenkakuEnglish(str) {

	if (str == null || str == "") {
		return;
	}

	var dic = { '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' : 'Ｚ' }


	var change = "";
	var upper = str.toUpperCase();

	for(i=0; i < upper.length; i++) {

		var c = dic[upper.charAt(i)];

		if (c != null) {
			change = change + c;
		} else {
			change = change + upper.charAt(i);
		}

	}

	return change;
}

function openPopWindow(url,winName,option){
	var winObj;

	switch(winName){
			case "cs":
			case "landing":
				option='width=1000,height='+screen.height+',scrollbars=1,resizable=0,menubar=0,toolbar=0,location=1,status=1,directories=0';
				break;
			case "seminarEntry":
			case "VirtualExamine":
			case "LoanSimration":
				option='width=800,height='+screen.height+',scrollbars=1,resizable=1,menubar=0,toolbar=0,location=1,status=1,directories=0';
				break;
			default:
				option=null;
				break;
	}

	if(option == null)
		winObj = window.open(url,winName)
	else
		winObj = window.open(url,winName,option)

	window.blur();
	winObj.focus();
}

function openPopWindow2(url,winName,option){

	if (!window.opener || window.opener.closed) {
		openPopWindow(url,winName,option);

	} else {

    	var topScreen = window.opener;
    	topScreen.location.href=url;
			//if( navigator.userAgent.indexOf('AppleWebKit/') > -1 ) {
			//        // SafariとChromeだけ
			//        window.blur();
			//}
			window.blur();
    	topScreen.focus();
  	}
}

function reloadCS(id) {
	openPopWindow2('/apl/auction/detail?id='+id,'cs',null);
}

window.onload = loadplural;
