function contentCreate(no) {
	var no2=0;
	for(var i=1; i<100; i++) {
		if(!document.getElementById("content"+i)) break;
		if(document.getElementById("content"+i).style.display=="block") no2 = i;
	}
	if(no==no2) no2=0;
	if(tran != 1) return;
	for(var i=2; i<100; i++) {
		if(!document.getElementById("prev"+i)) break;
		document.getElementById("prev"+i).style.display = "none";
	}
	for(var i=1; i<100; i++) {
		if(!document.getElementById("next"+i)) break;
		document.getElementById("next"+i).style.display = "none";
	}
	if(document.getElementById("prev"+no)) document.getElementById("prev"+no).style.display = "block";
	if(document.getElementById("next"+no)) document.getElementById("next"+no).style.display = "block";
	contentTransparent(no, no2, "content");
	if(document.getElementById("list1_over")) document.getElementById("list1_over").style.display = "none";
}

function mainCreate(no) {
	var no2=0;
	for(var i=1; i<100; i++) {
		if(!document.getElementById("main"+i)) break;
		if(document.getElementById("main"+i).style.display=="block") no2 = i;
	}
	if(no==no2) no2=0;
	if(tran != 1) return;
	contentTransparent(no, no2, "main");
}

function randomCreate(no) {
	var no2=no-1;
	if(no>15) no=1;
	if(tran == 1) 	contentTransparent(no, no2, "random");
	setTimeout("randomCreate("+(no+1)+");", 3000);
}
function randomStart() {
	document.getElementById("random").style.display = "none";
}

var tran=1;
function contentTransparent(no, no2, objname) {
	var content1 = document.getElementById(objname+no); //³ªÅ¸³¯ ·¹ÀÌ¾î
	if(no2 != 0) {
		var content2 = document.getElementById(objname+no2); //»ç¶óÁú ·¹ÀÌ¾î
	}
	if(content1.style.opacity != "1") {
		content1.style.display = "block";
		var a=Math.round(Math.abs(tran-1.1)*10)/10;
		content1.style.opacity = a;
		a=Math.abs(tran*100 - 110);
		content1.style.filter="alpha(opacity="+a+")";
		if(no2 != 0) {
			var b=Math.round((tran-0.1)*10)/10;
			content2.style.opacity = b;
			b=tran*100 - 10;
			content2.style.filter="alpha(opacity="+b+")";
		}
		tran=tran-0.1;
		setTimeout("contentTransparent("+no+","+no2+", '"+objname+"');", 50);
	} else {
		if(no2 != 0) {
			content2.style.display = "none";
		}
		tran = 1;
	}
}

function overOver() {
	document.getElementById("over2").style.display = "inline";
}

function overOut() {
	document.getElementById("over2").style.display = "none";
}

function listOver() {
	document.getElementById("listback").style.top = "400px";
	document.getElementById("listback").style.height = "90px";
	document.getElementById("list").style.display = "block";
	document.getElementById("listback_title").style.display = "none";
}
function listOut() {
	document.getElementById("listback").style.top = "465px";
	document.getElementById("listback").style.height = "25px";
	document.getElementById("list").style.display = "none";
	document.getElementById("listback_title").style.display = "block";
}

function load() {
	for(var i=0; i<document.getElementById("menu").getElementsByTagName("img").length; i++) {
		document.getElementById("menu").getElementsByTagName("img")[i].onmouseover = function () {
			this.src = "/studio/images/"+this.name+"-.gif";
		}
		document.getElementById("menu").getElementsByTagName("img")[i].onmouseout = function () {
			this.src = "/studio/images/"+this.name+".gif";
		}
	}
	if(document.getElementById("loading")) loadTransparent();
	if(document.getElementById("main")) {
		for(i=0; i<8; i++) {
			document.getElementById("main").getElementsByTagName("img")[i].onmouseover = function () {
				this.src = "/studio/portfolio/o/"+this.name+"-.gif";
			}
			document.getElementById("main").getElementsByTagName("img")[i].onmouseout = function () {
				this.src = "/studio/portfolio/o/"+this.name+".gif";
			}
		}
	}
	if(document.getElementById("main1")) document.getElementById("main1").style.display = "block";
	if(document.getElementById("random")) {
		setTimeout("randomCreate(1);", 5000);
		setTimeout("randomStart();", 5000);
	}
	if(document.getElementById("content1")) document.getElementById("content1").style.display = "block";
	if(document.getElementById("over") && document.getElementById("over2")) {
		document.getElementById("over").onmouseover = function () { overOver(); }
		document.getElementById("over2").onmouseover = function () { overOver(); }
		document.getElementById("over").onmouseout = function () { overOut(); }
		document.getElementById("over2").onmouseout = function () { overOut(); }
		for(i=0; i<document.getElementById("over2").getElementsByTagName("img").length; i++) {
			document.getElementById("over2").getElementsByTagName("img")[i].onmouseover = function () {
				this.src = "/studio/portfolio/o/"+this.name+".gif";
			}
			document.getElementById("over2").getElementsByTagName("img")[i].onmouseout = function () {
				this.src = "/studio/portfolio/o/"+this.name+"-.gif";
			}
		}
	}
	if(document.getElementById("list")) {
		setTimeout("listOut();", 1500);
		document.getElementById("listback").onmouseover = function () { listOver(); }
		document.getElementById("list").onmouseover = function () { listOver(); }
		document.getElementById("listback").onmouseout = function () { listOut(); }
		document.getElementById("list").onmouseout = function () { listOut(); }
		for(i=0; i<document.getElementById("list").getElementsByTagName("img").length; i++) {
			document.getElementById("list").getElementsByTagName("img")[i].onmouseover = function () {
				this.style.opacity = "1";
				this.style.filter = "alpha(opacity=100)";
				document.getElementById("list_title").innerHTML = this.alt;
			}
			document.getElementById("list").getElementsByTagName("img")[i].onmouseout = function () {
				this.style.opacity = "0.8";
				this.style.filter = "alpha(opacity=80)";
				document.getElementById("list_title").innerHTML = "";
			}
		}
	}
	for(i=1; i<=3; i++) {
		if(document.getElementById("graphic"+i)) {
			for(var j=1; j<(document.getElementById("graphic"+i).getElementsByTagName("img").length-1); j++) {
				document.getElementById("graphic"+i).getElementsByTagName("img")[j].onmouseover = function () {
					this.src = "/studio/portfolio/t/"+this.name+"-.gif";
				}
				document.getElementById("graphic"+i).getElementsByTagName("img")[j].onmouseout = function () {
					this.src = "/studio/portfolio/t/"+this.name+".gif";
				}
			}
		}
		if(document.getElementById("sub"+i)) {
			document.getElementById("sub"+i).getElementsByTagName("img")[0].onmouseover = function () {
				this.src = "/studio/portfolio/sub/"+this.name+"-.gif";
			}
			document.getElementById("sub"+i).getElementsByTagName("img")[0].onmouseout = function () {
				this.src = "/studio/portfolio/sub/"+this.name+".gif";
			}
		}
	}
}

function loadTransparent() {
	var load = document.getElementById("loading");
	if(load.style.opacity != "0") {
		var a=Math.round((tran-0.1)*10)/10;
		load.style.opacity = a;
		a=tran*100 - 10;
		load.style.filter="alpha(opacity="+a+")";
		tran=tran-0.1;
		setTimeout("loadTransparent();", 10);
	} else {
		document.getElementById("loading").style.display = "none";
		tran = 1;
	}
}

function viewer(m1, m2, m3) {
	document.getElementById("viewer").style.display = "block";
	document.getElementById("viewer2").style.display = "block";
	document.getElementById("viewer").innerHTML = '<iframe id="viewerFrame" src="/studio/'+m1+'/viewer/'+m2+'/'+m3+'" width="800" frameborder="0" scrolling="no"></iframe>';
}