function setYear(){
	var d_obj = new Date();
	document.write(d_obj.getFullYear());
}



function swf_object(SWF,WID,HEI){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width='+ WID +' height='+ HEI +'>');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="'+ SWF +'.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="'+ SWF +'.swf" quality="high"  wmode="transparent" width='+ WID +' height='+ HEI +' name="coverflow" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}



function header() {
	if(!document.getElementById("header")){
		return false;
	}
	var head = document.getElementById("header");
	var setFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="950" height="165">';
	setFlash +='<param name="allowScriptAccess" value="sameDomain" />';
	setFlash +='<param name="allowFullScreen" value="false" />';
	setFlash +='<param name="movie" value="../swf/header.swf" />';
	setFlash +='<param name="quality" value="high" />';
	setFlash +='<param name="wmode" value="transparent" />';
	setFlash +='<param name="bgcolor" value="#ffffff" />';
	setFlash +='<embed src="../swf/header.swf" quality="high" bgcolor="#ffffff" wmode="transparent" width="950" height="165" name="coverflow" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	setFlash +='</object>';
	var headflash = document.createElement("div");
		headflash.innerHTML =setFlash;
		headflash.style.position="absolute";
		headflash.style.top = 0;
		headflash.style.left = 0;
		headflash.style.zIndex = 1;
	//head.innerHTML =setFlash;
	head.appendChild(headflash);
}

function init() {
	if(navigator.userAgent.indexOf("Mac") != -1){
		document.body.style.letterSpacing = "-0.1em";
	}
	try { 
		document.execCommand('BackgroundImageCache', false, true); 
	}catch(e){
		
	}
	heartSet();
	smartRollover();
	border_none();
	submit_none();
	header();
	firstBorder();
	setPng();
	IE_logo_link();
	winClose();
	prepareLinks();
	setclassPng();
	comicsLinks();
	infoBerLoad();
	indexPng();
	setindexPng();
	xmasPng();
	setxmasPng();
	mobileLink();
}
window.onload=init;



function indexPng() {
	if(!document.getElementById("pickPhoto") ){
		return false;
	}
	var heartMark = document.createElement("div");
		heartMark.id ="picklady";
		heartMark.style.position="absolute";
		heartMark.style.top = 0+"px";
		heartMark.style.left = 0+"px";
		heartMark.innerHTML ='<img src="./images/cover.png" alt="インデックス" />';
		
	var pickPhoto = document.getElementById("pickPhoto");
	pickPhoto.appendChild(heartMark);
	
}

function xmasPng(){
	if(!document.getElementById("xmas") ){
		return false;
	}
	var xmasMark = document.createElement("div");
		xmasMark.id ="xmaspng";
		xmasMark.style.position="absolute";
		xmasMark.style.top = 15+"px";
		xmasMark.style.left =10+"px";
		xmasMark.innerHTML ='<img src="./images/xmas.png" alt="インデックス" />';
		
	var pickPhoto = document.getElementById("mainContents");
	pickPhoto.appendChild(xmasMark);
	/*if(!document.getElementById("") ){
		return false;
	}
	if(navigator.appVersion.indexOf("MSIE 6",0) != -1){
		var alpha_index = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='./images/xmas.png')";
		Png("xmas",800,421,alpha_index);
	}*/
	var enterMark = document.createElement("div");
		enterMark.id ="enterbox";
		enterMark.style.position="absolute";
		enterMark.style.top = 217+"px";
		enterMark.style.left =6+"px";
		enterMark.innerHTML ='<ul><li><a href="./top/"><img src="./images/btn/enter.jpg" alt="入場する" width="140" height="35" /></a></li><li><a href="http://www.google.co.jp/"><img src="./images/btn/leave.jpg" alt="退場する" width="140" height="35" /></a></li></ul>';
		pickPhoto.appendChild(enterMark);
}
function setxmasPng(){
	if(!document.getElementById("xmas") ){
		return false;
	}
	if(navigator.appVersion.indexOf("MSIE 6",0) != -1){
		var alpha_index = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='./images/xmas.png')";
		Png("xmaspng",800,421,alpha_index);
	}
}
function setindexPng(){
	if(!document.getElementById("pickPhoto") ){
		return false;
	}
	if(navigator.appVersion.indexOf("MSIE 6",0) != -1){
		var alpha_index = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='./images/cover.png')";
		Png("picklady",300,400,alpha_index);
	}
}

function heartSet() {
	if(!document.getElementById("rankTitle") ){
		return false;
	}
	var heartMark = document.createElement("div");
		heartMark.className ="heart";
		heartMark.style.position="absolute";
		heartMark.style.top = 131+"px";
		heartMark.style.left = 24+"px";
		heartMark.innerHTML ='<img src="./images/heart.png" alt="ランキング" />';
		
	var heart = document.getElementsByTagName("div");
	for(i=0;i<heart.length;i++){
		if(heart[i].getAttribute("className") == "heart" || heart[i].getAttribute("class") == "heart"){
			heart[i].innerHTML ='<img src="./images/heart.png" alt="ランキング" />';
			//heart[i].appendChild(heartMark);

		}
	}
	
	
}


function setPng(){
	if(!document.getElementById("logo") ){
		return false;
	}
	if(navigator.appVersion.indexOf("MSIE 6",0) != -1){
		var alpha_logo = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='../images/logo.png')";
		Png("logo",400,108,alpha_logo);
	}
}

function Png(pngID,WIDTH,HEIGHT,ALPHA){
	if(document.all){
		document.getElementById(pngID).style.width = WIDTH+"px";
		document.getElementById(pngID).style.height = HEIGHT+"px";
		document.getElementById(pngID).style.filter = ALPHA;
		document.getElementById(pngID).firstChild.style.display = "none";
	}
}
function setclassPng(){
	if(!document.getElementById("rankTitle") ){
		return false;
	}
	if(navigator.appVersion.indexOf("MSIE 6",0) != -1){
		var alpha_up = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='./images/heart.png')";
		classPng("heart",61,58,alpha_up);

	}
}

function classPng(pngClass,WIDTH,HEIGHT,ALPHA){
	var alphaArray = document.getElementsByTagName("div");
	for(i=0;i<alphaArray.length;i++){
		if(alphaArray[i].getAttribute("className") == pngClass || alphaArray[i].getAttribute("class") == pngClass){
			alphaArray[i].style.width = WIDTH+"px";
			alphaArray[i].style.height = HEIGHT+"px"
			alphaArray[i].style.filter = ALPHA;
			alphaArray[i].firstChild.style.display = "none";
		}
	}
}
//ieロゴリンク
function IE_logo_link(){
	if(document.getElementById("logo")){
		if(navigator.appVersion.indexOf("MSIE") != -1){
			document.getElementById("logo").style.cursor ="pointer";
			document.getElementById("logo").onclick = function(){
				location.href = "../top/";
			}
		}
	}
}
//ロールオーバーイメージ
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_out."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_out.", "_over."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_over.", "_out."));
				}
			}
		}
	}
}
function firstBorder() {
	if(!document.getElementById("footer")){
		return false;
	}
	if(!document.getElementById("mainBox")){
		return false;
	}
	var first = document.getElementById("footer").getElementsByTagName("li");
	first[0].style.border="none";

}
function border_none(){
	var all_link = document.links;
	for(i=0;i<all_link.length;i++){
		all_link[i].onfocus = function(){
			this.blur();
		}
	}
}
function submit_none(){
	if(!document.getElementById("form_btn")){
		return false;
	}
	var all_submit = document.getElementById("form_btn").getElementsByTagName("input");
	for(i=0;i<all_submit.length;i++){
		all_submit[i].onmouseover = function(){
			this.style.cursor= "pointer";
		}
		all_submit[i].onfocus = function(){
			this.blur();
			this.style.cursor= "pointer";
		}
	}
}

function winClose(){
	if(!document.getElementById("close")){
		return false;
	}
	var btnClose = document.getElementById("close").firstChild;
	btnClose.onclick = function(){
		window.close();
	}
}

function prepareLinks() {
    if(!document.getElementsByTagName){
    	return false;
    }
    var links = document.getElementsByTagName("a");
    for (var i=0; i<links.length; i++) {
        if(links[i].getAttribute("className") == "popup" || links[i].getAttribute("class") == "popup") {
            links[i].onclick = function() {
                popUp(this.getAttribute("href"));
                return false;
            }
        }
    }
}
function popUp(winURL) {
	var winFocus;
    winFocus = window.open(winURL,"popup","width=796,height=650,scrollbars=yes");
    winFocus.focus();
}


function comicsLinks() {
    if(!document.getElementsByTagName){
    	return false;
    }
    var links = document.getElementsByTagName("a");
    for (var i=0; i<links.length; i++) {
        if(links[i].getAttribute("className") == "comics" || links[i].getAttribute("class") == "comics") {
            links[i].onclick = function() {
                comicsUp(this.getAttribute("href"));
                return false;
            }
        }
    }
}
function comicsUp(winURL) {
	var winFocus;
    winFocus = window.open(winURL,"comics","width=645,height=910,scrollbars=yes");
    winFocus.focus();
}



/*------------インフォメーションバー---------------*/
var flowValue = 0;
var scrollArea = "";
var firstPoint = 0;
var interval = 1;
function infoBerLoad(){
	if(!document.getElementById("newsbar")){
		return;
	}
	var targetPoint = document.getElementById("newsbar");
	firstPoint = targetPoint.offsetWidth;
	flowValue = firstPoint;

	if(targetPoint == ""){
		return;
	}
	
	if(navigator.userAgent.indexOf("Chrome") != -1){
		interval = 12;
	}
	nowURL = location.href;
	info = createAjax();
	//if(nowURL.indexOf("ladies") != -1 || nowURL.indexOf("schedule") != -1){
		path = "../newsbar/xml/info.xml";
	//}else{
	//	path = "info/xml/info.xml";
	//}
	info.open("GET",path);
	info.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
	info.setRequestHeader( 'If-Modified-Since', 'Thu, 01 Jun 1970 00:00:00 GMT');
	info.send(null);
	info.onreadystatechange = function(){
		if(info.readyState == 4 && info.status == 200){
			infoData = info.responseXML;
			var description = infoData.getElementsByTagName("description")[0].firstChild.nodeValue;
			var description2 = infoData.getElementsByTagName("description")[0].firstChild.nodeValue;
			var mask = document.createElement("div");
			scrollArea = document.createElement("div");
			scrollArea2 = document.createElement("div");
			mask.style.position = "relative";
			scrollArea.style.position = "relative";
			scrollArea.style.left = firstPoint+"px";
			scrollArea.style.whiteSpace = "nowrap";
			scrollArea.innerHTML = description;
			scrollArea2.style.position = "relative";
			scrollArea2.style.left = firstPoint+"px";
			scrollArea2.style.whiteSpace = "nowrap";
			scrollArea2.innerHTML = description2;
			mask.appendChild(scrollArea);
			mask.appendChild(scrollArea2);
			if(targetPoint.firstChild){
				targetPoint.replaceChild(mask,targetPoint.firstChild);
			}else{
				targetPoint.appendChild(mask);
			}
			
			setInterval("textMarquee();",interval);
		}
	}
}

function textMarquee(){
	
	flowValue -= 1;
	scrollArea.style.left = flowValue+"px";
	if(flowValue <= (0-(scrollArea.offsetWidth-200))){
		flowValue = firstPoint;
	}
}

function createAjax(){

	if(window.XMLHttpRequest){
		Ajax = new XMLHttpRequest();
	}else if(window.ActiveXObject){
		try {
			Ajax = new ActiveXObject("Msxm21.XMLHTTP");
		} catch(e) {
			Ajax = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return Ajax;
}

function mobileLink(){
	
	if(!document.getElementById("mobile")){
		return;
	}
	var targetNode = document.getElementById("mobile").getElementsByTagName("p")[0];
	var mobileUrl = targetNode.firstChild.nodeValue;
	var aTag = document.createElement("a");
	aTag.innerHTML = mobileUrl;
	aTag.href = mobileUrl;
	aTag.target = "_blank";
	aTag.style.color = "#99cc00";
	aTag.style.textDecoration = "underline";
	targetNode.replaceChild(aTag,targetNode.firstChild);

}