// JavaScript Document

brsw_ie=(document.all&&navigator.userAgent.indexOf("Opera")==-1)?true:false;

cPos=0;
function cDown(){
	if(cPos!=1){
		if(gT("photoslot").childNodes.length>0){
			gT("photoslot").childNodes[0].id="image"+Math.floor(Math.random()*80);
			changevOpac(100,gT("photoslot").childNodes[0].id);
			vopac(gT("photoslot").childNodes[0].id,100,5,750);
		}
		cPos=1;gT("bdAfMn").style.visibility="visible";
	}
};function cUp(){
	if(cPos!=0){
		if(gT("photoslot").childNodes.length>0){
			changevOpac(5,gT("photoslot").childNodes[0].id);
			vopac(gT("photoslot").childNodes[0].id,5,100,450);
		}
		cPos=0;gT("bdAfMn").style.visibility="hidden";
	}
}

function muhaphotos(locRe){
	if(!defsltd){hltd(locRe);defsltd=locRe;}
	cTransUp("cData");cDown();
	new Ajax("oto/mp.oto", {
		method: 'get',
		update: $('cData')
	}).request();
};function contactme(locRe){
	if(focusImage){recluseP();tcalls=0;initialize();}
	if(defsltd&&locRe!=defsltd){
		defsltd.style.backgroundColor="#0f0f0f";
		defsltd.style.color="#4f4f4f";
	};hltd(locRe);defsltd=locRe;
	cTransUp("cData");cDown();
	blankset("4");blankset("3");blankset("2");
	new Ajax("dview.php", {
		method: 'get',
		update: $('cData')
	}).request();
};function events(locRe){
	cTransUp("cData");cDown();
	new Ajax("eview.php", {
		method: 'get',
		update: $('cData')
	}).request();
}

defsltd=null;
function hltd(td){
	td.style.backgroundColor="#0a0a0a";
	td.style.color="#368795";
}
function ultd(td){
	if(defsltd==td)return false;
	td.style.backgroundColor="#0f0f0f";
	td.style.color="#4f4f4f";
}

defhltd=null;
function hstd(td){
	td.style.backgroundColor="#0a0a0a";
	td.style.color="#368795";
}
function ustd(td){
	if(defhltd==td)return false;
	td.style.backgroundColor="#0f0f0f";
	td.style.color="#4f4f4f";
}

subhltd=null;
function hbtd(td){
	td.style.backgroundColor="#0a0a0a";
	td.style.color="#368795";
}
function ubtd(td){
	if(subhltd==td)return false;
	td.style.backgroundColor="#0f0f0f";
	td.style.color="#4f4f4f";
}

function dcolb(dtd){
	if(defsltd&&dtd!=defsltd){
		defsltd.style.backgroundColor="#0f0f0f";
		defsltd.style.color="#4f4f4f";
	};defsltd=dtd;
	cbuild='<table class="lframe" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#2f2f2f">';
	for(ci=0;ci<MM_cols.length;ci++){
		cbuild+='<tr>';
		cbuild+='<td width="199" align="left" valign="top" class="lnk" onMouseOver="hstd(this)" onMouseOut="ustd(this)" onClick="colbuild('+ci+',this)"><div class="mx"><strong>'+MM_cols[ci][0]+'</strong></div></td>';
		cbuild+='</tr>';
	};cbuild+='</table>';
	gT("col2").innerHTML=cbuild;
	gT("col2").childNodes[0].id="cell"+Math.floor(Math.random()*80);
	var bgAnim=new Fx.Styles(gT("col2").childNodes[0].id,{duration:400,transition:Fx.Transitions.linear});
	bgAnim.start({'background-color':['2f2f2f','0f0f0f']});
	blankset("3");blankset("4");
	//if(focusImage)recluseP();
}
function colbuild(cidx,ctd){
	if(defhltd&&ctd!=defhltd){
		defhltd.style.backgroundColor="#0f0f0f";
		defhltd.style.color="#4f4f4f";
	};defhltd=ctd;
	gbuild='<table class="lframe" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#2f2f2f;">';
	for(xi=0;xi<MM_cols[cidx][1].length;xi++){
		gbuild+='<tr>';
		gbuild+='<td width="199" align="left" valign="top" class="lnk" onMouseOver="hbtd(this)" onMouseOut="ubtd(this)" onClick="indexbuild(\''+cidx+'\',\''+xi+'\',this);"><div class="mx"><strong>'+MM_cols[cidx][1][xi][0]+'</strong></div></td>';
		gbuild+='</tr>';
	};if(MM_cols[cidx][1].length<4){
		for(ti=0;ti<(4-MM_cols[cidx][1].length);ti++)gbuild+='<tr><td width="199" align="left" valign="top">&nbsp;</td></tr>';
	};gbuild+='</table>';
	gT("col3").innerHTML=gbuild;
	gT("col3").childNodes[0].id="cell"+Math.floor(Math.random()*80);
	var cgAnim=new Fx.Styles(gT("col3").childNodes[0].id,{duration:400,transition:Fx.Transitions.linear});
	cgAnim.start({'background-color':['2f2f2f','0f0f0f']});blankset("4");
	//if(focusImage)recluseP();
}
function indexbuild(cidx,sidx,ctd){
	if(subhltd&&ctd!=subhltd){
		subhltd.style.backgroundColor="#0f0f0f";
		subhltd.style.color="#4f4f4f";
	};subhltd=ctd;
	bbuild='<table class="lframe" border="0" align="center" cellpadding="0" cellspacing="0" style="background-color:#2f2f2f;">';
	rowcal=MM_cols[cidx][1][sidx][1].length/9;
	rowcal.toString().indexOf(".")!=-1?rowcal=(Math.floor(rowcal)+1):rowcal=Math.floor(rowcal);
	rownode=0;
	for(vs=0;vs<rowcal;vs++){
		bbuild+='<tr>';
		bbuild+='<td width="199" align="left" valign="top"><div class="mx"><strong>';
		Bforge="";
		for(vx=0;vx<9;vx++){
			if(rownode==MM_cols[cidx][1][sidx][1].length)break;
			tdsply=rownode+1;
			tdsply<10?tdsply="0"+tdsply:tdsply=tdsply;
			bbuild+=Bforge+'<span onMouseOver="su(this,1)" onMouseOut="su(this,0)" class="lnk" onClick="setPicture(\''+MM_cols[cidx][1][sidx][1][rownode]+'\',this)">'+tdsply+'</span>';
			rownode++;Bforge=" &nbsp; ";
		};bbuild+='</strong></div></td>';
		bbuild+='</tr>';
	};if(rowcal<4){
		for(ti=0;ti<(4-rowcal);ti++)bbuild+='<tr><td width="199" align="left" valign="top">&nbsp;</td></tr>';
	};bbuild+='</table>';
	gT("col4").innerHTML=bbuild;
	gT("col4").childNodes[0].id="cell"+Math.floor(Math.random()*80);
	var cgAnim=new Fx.Styles(gT("col4").childNodes[0].id,{duration:400,transition:Fx.Transitions.linear});
	cgAnim.start({'background-color':['2f2f2f','0f0f0f']});
	//if(focusImage)recluseP();
}
focusImage=null;
function recluseP(){
	var ssEff=new Fx.Styles('muhaslider',{duration:900,transition:Fx.Transitions.Quint.easeOut});
	ssEff.start({'height':[parseFloat(gT('muhaslider').style.height),1]});
	focusImage=null;picsel=null;naviS=0;
	gT("mcol2").innerHTML="&nbsp;";gT("mcol3").innerHTML="&nbsp;";gT("mcol4").innerHTML="&nbsp;";
}
function showInfo(){
	if(focusImage){
		infBuffer='<div class="mx"><div><strong class="turq">INFO</strong></div><div id="infobOOX" class="mp">';
		infBuffer+='</div></div></div>';
		gT("mcol2").innerHTML=infBuffer;
		cTransUp("infobOOX");
		new Ajax("oto/graveyard/"+focusImage+"i.oto", {
			method: 'get',
			onComplete: function(response) {
				iliGoth=new String(response);
				if(!iliGoth.split(" ").join("")){iliGoth="n/a";}
				gT("infobOOX").innerHTML=iliGoth;
			}
		}).request();
	}
}naviS=0;
function showComm(){
	if(focusImage){
		infBuffer='<div class="mx"><div><a onClick="popUpWindow(\'m'+'c'+'.'+'ph'+'p?phot'+'oid='+focusImage+'\',450,290);return false;" style="float:right" href="#">Post New</a><strong class="turq">COMMENTS</strong></div><div id="commbOOX" class="mp">';
		infBuffer+='</div></div></div>';
		gT("mcol3").innerHTML=infBuffer;
		cTransUp("commbOOX");
		new Ajax("cview.php?p="+focusImage+"&s="+naviS, {
			method: 'get',
			onComplete: function(response) {
				cliGoth=new String(response);
				if(!cliGoth.split(" ").join("")){cliGoth="n/a";}
				gT("commbOOX").innerHTML=cliGoth;
			}
		}).request();
	}
}
function sendPicture(){
	if(focusImage){
		popUpWindow('e'+'p'+'.'+'ph'+'p?phot'+'oid='+focusImage+'',450,290);
	}
}
function showWeb(){
	if(focusImage){
		infBuffer='<div class="mx"><div><strong class="turq">RELATED WEB</strong></div><div id="webbOOX" class="mp">';
		infBuffer+='</div></div></div>';
		gT("mcol4").innerHTML=infBuffer;
		cTransUp("webbOOX");
		new Ajax("oto/graveyard/"+focusImage+"w.oto", {
			method: 'get',
			onComplete: function(response) {
				sliGoth=new String(response);
				if(!sliGoth.split(" ").join("")){sliGoth="n/a";}
				if(sliGoth.indexOf("\n")!=-1){
					sliGoth=sliGoth.split("\n");
					for(bslice=0;bslice<sliGoth.length;bslice++){
						sliGoth[bslice]='<a href="'+sliGoth[bslice]+'" target="_blank">'+sliGoth[bslice]+'</a>';
					};sliGoth=sliGoth.join("<br>");
				};gT("webbOOX").innerHTML=sliGoth;
			}
		}).request();
	}
}
function biCube(){
	if(focusImage)gT("photoslot").innerHTML='<img src="oto/graveyard/'+focusImage+'.jpg">';
};picsel=null;rudni=null;rudna=null;rudnb=null;
function setPicture(sPic,piXel){
	focusImage=sPic;
	if(picsel){try{picsel.style.color="#4f4f4f";}catch(e){}}
	picsel=null;su(piXel,1);picsel=piXel;cUp();
	gT("photoslot").innerHTML='<img src="imagethumb.php?s=oto/graveyard/'+focusImage+'.jpg&w=250" class="lnk" onClick="biCube()">';
	var ssEff=new Fx.Styles('muhaslider',{duration:900,transition:Fx.Transitions.Quint.easeOut});
	ssEff.start({'height':[parseFloat(gT('muhaslider').style.height),160]});
	gT("mcol2").innerHTML="&nbsp;";gT("mcol3").innerHTML="&nbsp;";gT("mcol4").innerHTML="&nbsp;";
	clearTimeout(rudni);
	rudni=setTimeout("showInfo()",200);
	clearTimeout(rudna);
	rudna=setTimeout("showComm()",400);
	clearTimeout(rudnb);
	rudnb=setTimeout("showWeb()",600);
}
function su(ispan,vitm){if(picsel!=ispan){vitm==1?ispan.style.color="#368795":ispan.style.color="#4f4f4f";}}
function blankset(colID){
	sbuild='<table class="lframe" border="0" align="center" cellpadding="0" cellspacing="0">';
	for(si=0;si<4;si++)sbuild+='<tr><td width="199" align="left" valign="top">&nbsp;</td></tr>';
	sbuild+='</table>';gT("col"+colID).innerHTML=sbuild;
};function cTransUp(cLoc){gT(cLoc).innerHTML='<img src="src/ald.gif" width="16" height="16" border="0">';}
function vopac(id,opacStart,opacEnd,millisec){var speed=Math.round(millisec/100);var timer=0;if(opacStart>opacEnd){
for(i=opacStart;i>=opacEnd;i--){setTimeout("changevOpac("+i+",'"+id+"')",(timer*speed));timer++;}}
else if(opacStart<opacEnd){for(i=opacStart;i<=opacEnd;i++){setTimeout("changevOpac("+i+",'"+id+"')",(timer*speed));timer++;}}} 
function changevOpac(opacity,id){var object=gT(id).style;object.opacity=(opacity/100);
object.MozOpacity=(opacity/100);object.KhtmlOpacity=(opacity/100);object.filter="alpha(opacity="+opacity+")";}
function gT(iv){return document.getElementById(iv);};


rows=3;
columns=4;
cellwidth=196;
cellheight=131;
tcalls=0;
cspace=0;
gwidth=(columns * cellwidth) + (cspace * columns);

function initialize() {
	if(splashsw){gT("photoslot").innerHTML = '<img width="800" height="400" src="oto/splash.jpg" border="0">';
	}else{
		if(tpics.length==0){
			gT("photoslot").innerHTML = '<div style="width:800px;height:400px;padding:0px;margin:0px;">&nbsp;</div>';
			return;
		};scache = '<table align="center" border="0" cellspacing="0" cellpadding="0" style="border:none;"><tr><td valign="bottom" align="center" style="border:none;">';
		scache += '<table align="center" cellspacing="'+cspace+'" cellpadding="0" border="0" style="border:none;">\n';
		for (i = 0; i < rows; i ++) {
			scache += '\t<tr>\n';
				for (n = 0; n < columns; n ++) {
					scache += '\t\t<td id="r'+i+'c'+n+'" width="'+ (cellwidth+2) +'" height="'+ (cellheight+2) +'" valign="middle" align="center" style="border:none;"></td>\n';
				}
			scache += '\t</tr>\n';
		}
		scache += '</table></td></tr></table>';
		gT("photoslot").innerHTML = scache;
		randomThrw();
	}
}

function randomThrw() {
	tRow=Math.floor(Math.random()*rows);
	if(tRow>(rows-1))tRow=rows-1;
	tCol=Math.floor(Math.random()*columns);
	if(tCol>(columns-1))tCol=columns-1;
	if((!document.getElementById("r"+tRow+"c"+tCol).innerHTML)&&(tcalls<(rows*columns))){
		document.getElementById("r"+tRow+"c"+tCol).innerHTML='<img src="src/ald.gif">';
		tcalls ++;
		ph_blst = new Image();
		ph_url = Math.floor(Math.random() * tpics.length);
		if(ph_url==tpics.length)ph_url=tpics.length-1;
		ph_url=tpics[ph_url];
		ph_blst.src = "imagethumb.php?s=oto/graveyard/"+ph_url +"&w="+cellwidth+"&h="+cellheight;
		if (ph_blst.complete) {
			document.getElementById("r"+tRow+"c"+tCol).innerHTML='<img id="i'+tRow+'c'+tCol+'" src="'+ph_blst.src+'" width="'+cellwidth+'" height="'+cellheight+'" class="phBig">';
			vopac("i"+tRow+"c"+tCol, 0, 100, 500);
			setTimeout("randomThrw()", 2000);
		} else {
			ph_blst.onload = function() {
				document.getElementById("r"+tRow+"c"+tCol).innerHTML='<img id="i'+tRow+'c'+tCol+'" src="'+ph_blst.src+'" width="'+cellwidth+'" height="'+cellheight+'" class="phBig">';
				vopac("i"+tRow+"c"+tCol, 0, 100, 500);
				setTimeout("randomThrw()", 1000);
			}
		}
	}else{
		if(tcalls>=(rows*columns)){
			document.getElementById("r"+tRow+"c"+tCol).innerHTML = '<img src="src/ald.gif">';
			ph_blst = new Image();
			ph_url = Math.floor(Math.random() * tpics.length);
			if(ph_url==tpics.length){ph_url=tpics.length-1;}
			ph_url=tpics[ph_url];
			ph_blst.src = "imagethumb.php?s=oto/graveyard/"+ph_url +"&w="+cellwidth+"&h="+cellheight;
			if (ph_blst.complete) {
				document.getElementById("r"+tRow+"c"+tCol).innerHTML='<img id="i'+tRow+'c'+tCol+'" src="'+ph_blst.src+'" width="'+cellwidth+'" height="'+cellheight+'" class="phBig">';
				vopac("i"+tRow+"c"+tCol, 0, 100, 500);
				setTimeout("randomThrw()", 2000);
			} else {
				ph_blst.onload = function() {
					document.getElementById("r"+tRow+"c"+tCol).innerHTML='<img id="i'+tRow+'c'+tCol+'" src="'+ph_blst.src+'" width="'+cellwidth+'" height="'+cellheight+'" class="phBig">';
					vopac("i"+tRow+"c"+tCol, 0, 100, 500);
					setTimeout("randomThrw()", 1000);
				}
			}
		} else randomThrw();
	}
}