
// POPUP Window =====================================

/* デフォルトタイプ */
function popup(url) {
	sw = window.open(url, 'sw', 'width=850,height=800,resizable=yes,scrollbars=yes,location=no,directories=no,menubar=no,toolbar=no,status=no');}

/* cashone */
function popup2(url) {
	sw = window.open(url, 'sw2', 'width=600,height=610,resizable=yes,scrollbars=yes,location=no,directories=no,menubar=no,toolbar=no,status=no');}

/* ニュース用 */
function popup_news(url) {
	sw = window.open(url, 'news', 'width=760,height=800,resizable=yes,scrollbars=yes,location=yes,directories=yes,menubar=yes,toolbar=yes,status=yes');}

/* スペシャル、アコムチャンネル用 */
function popup_sp(url) {
	sw = window.open(url, 'sp', 'width=950,height=850,resizable=yes,scrollbars=yes,location=yes,directories=yes,menubar=yes,toolbar=yes,status=yes');}

/* ケータイデモコンテンツ（ポップアップからさらにポップアップを別ウィンドウで開きたい場合用） */
function popup3(url) {
	sw = window.open(url, 'sw3', 'width=760,height=800,resizable=yes,scrollbars=yes,location=no,directories=no,menubar=no,toolbar=no,status=no');}
/*
function popup_sp(url) {
	sw = window.open(url, 'sp', 'width=900,height=800,resizable=yes,scrollbars=yes,location=yes,directories=no,menubar=no,toolbar=no,status=no');}
*/

// focus ===================================
var nn2 = (navigator.userAgent.indexOf("Mozilla/2") != -1)?true:false;
var ie3 = (navigator.userAgent.indexOf("MSIE 3") != -1)?true:false;
if(!(nn2 || ie3))window.focus();

// windowName ===================================
function setWindowName() {
var Tagbody = document.getElementsByTagName("body");
var TagbodyOBJ = Tagbody.item(0);
var BodyID = TagbodyOBJ.getAttributeNode("ID").value;
	if((BodyID=="top")||(BodyID=="general")) 
	{
	window.name = 'acom';//基本ウィンドウネーム
	}
				}
//window.onload = setWindowName;//発動


//AreaApply
/*
function SetApply() {
	var element = document.getElementById("IdApplyForm");
	element.childNodes[0].setAttribute("target", "_blank");}
window.onload = SetApply;
*/



// exterNal ===================================
function findElement() {
	var element = document.getElementsByTagName("body")[0];
	//var element = document.getElementById("LayerContentsBody");
	var anchors = element.getElementsByTagName("a");
	var popURL = "/external/index.html";


	for (var i=0; i<anchors.length; i++){
		var anchor = anchors[i];
		var href_val = anchor.getAttribute("href");
		if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "external")){
			anchor.setAttribute("href", popURL+"?"+href_val);

		}
	}

}


// 初期化
function init() {
	findElement();
	setWindowName();}
window.onload = init;


/*  Rollover  */
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].src.match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);}
/*  /Rollover  */

