/*@cc_on _d=document;eval('var document=_d')@*/
/**
 * 共通スクリプト
 **/
//id要素検索
var my$=function(a){return document.getElementById(a);}
var mainShow=function(){my$("mainview").style.visibility="visible";$("#mainview").show()};
var mainHide=function(){my$("mainview").style.visibility="";$("#mainview").hide()};

/**
 * トップページロード
 **/
function topLoad(){
	mainHide();
	/*
	var param = {
		type : "get",
		cache: false,
		dataType : "html",
		contentType : "text/html;charset=utf-8"
	};
	$("#maintext").ajaxStart(function(){
		//読み込み前準備処理
		$("#maintitle").html("Top");
	}).load("./top/text.html",null,function(data,stat){
		//読み込み処理
		this.innerHTML = data;
		textBox("top-list");
	});
	*/
}

/**
 * アバウトページロード
 **/
function aboutLoad(){
	var param = {
		type : "get",
		dataType : "html",
		contentType : "text/html;charset=utf-8"
	};
	$("#maintext").ajaxStart(function(){
		//読み込み前準備処理
		$("#maintitle").html("ABOUT");
	}).load("./about/text.html",null,function(data,stat){
		//読み込み処理
		this.innerHTML = data;
		textBox("about-list");
		mainShow();
	});
}
/**
 * 汎用ページロード

function contentsLoad(data){
	var param = {
		type : "get",
		dataType : "html",
		contentType : "text/html;charset=utf-8"
	};
	$("#maintext").ajaxStart(function(){
		//読み込み前準備処理
		$("#maintitle").html(data['title']);
	}).load(data['path'],null,data['func']);
}
 **/
 
/**
 * メニューボタンクリック
 **/
function func(menu){
	switch(menu){
		case "contact":
			contactLoad();
			break;
		case "about":
			aboutLoad();
			break;
		case "illust":
			illustLoad();//illust.js内に記述
			break;
		case "link":
			linkLoad();//link.js内に記述
			break;
		case "making":
			makingLoad();//making.js内に記述
			break;
		case "top":
			topLoad();
			break;
		default:
			break;
	}
}

/**
 * テキストボックス
 **/
function textBox(text){
	var nodes = document.getElementById(text);
	var n = nodes.childNodes;
	var l = n.length;
	var title,text;
	for(var i = 0;i < l;i++){
		if((n[i].nodeName == "DIV") && ((n[i].className == "contents") || (n[i].getAttribute("class") == "contents"))){
			title = n[i].getElementsByTagName("div")[0];
			text  = Textsearch(n[i].getElementsByTagName("div"));
			
			title.onmouseover = function(){
				this.style.color="#666666";
				this.style.cssText+="text-decoration:underline";
				this.style.textDecorationUnderline=true;
			};
			title.onmouseout = function(){
				this.style.color="#ffffff";
				this.style.cssText+="text-decoration:none";
				this.style.textDecorationUnderline=false;
			};
			title.onclick = function(){
				var s = Textsearch(this.parentNode.getElementsByTagName("div")).style;
				if(s.display == "none"){
					s.display = "block";
				}else{
					s.display = "none";
				}
			};
			text.style.display = "none";
			n[i].style.display = "block";
		}
	}
	/*  append code */
	if(document.all){
		var n = document.body.childNodes;
		var len = n.length;
		for(var i = 0;i < len;i++){
			if(n[i].tagName == "div" || n[i].tagName == "DIV"){
				n[i].style.paddingBottom = "50px";
				return;
			}
		}
	}
}
function Textsearch(nodes){
	var l = nodes.length;
	for(var i = 0;i < l;i++){
		if(nodes[i].nodeName == "DIV" || nodes[i].nodeName == "DIV"){
			if(nodes[i].className == "text_" || nodes[i].getAttribute("class") == "text_"){
				return nodes[i];
			}
		}
	}
	return null;
}

/**
 * 
 * クローズボタンClass
 * mouseover : カーソル変更
 * mouseout : カーソル変更
 * click : 閉じる処理
 * 
 */
var closebton = function(ele){
	this.init(ele);
};
closebton.prototype={
	ele : null,
	cAfter : "",
	cbefore : "",
	init : function(ele){
		var eleType = typeof(ele);
		if(eleType == 'string'){
			this.ele = document.getElementById(ele);
		}else if(eleType == 'object'){
			this.ele = ele;
		}else{
			return null;
		}
	},
	//閉じる処理
	close : function(){
		this.ele.style.display = "none";
	},
	//カーソル変更
	over : function(){
	},
	//カーソル元に戻す
	out : function(){
	}
};


/**
 * 
 * イラストリストClass
 * 希望する数に並べる
 * mouseover : カーソル変更
 * mouseout : カーソル変更
 * click : 閉じる処理
 * 
 */
var illustList = function(ele){
	this.init(ele);
};
illustList.prototype={
	ele : null,
	splitNum : null,
	init : function(ele){
		var eleType = typeof(ele);
		if(eleType == 'string'){
			this.ele = document.getElementById(ele);
		}else if(eleType == 'object'){
			this.ele = ele;
		}else{
			return null;
		}
	},
	//閉じる処理
	close : function(){
	},
	//カーソル変更
	over : function(){
	},
	//カーソル元に戻す
	out : function(){
	}
};
