// encoding: UTF-8
sentences = new Array(
	"生きることに理由は必要ない!!",
	"生きているということには謎がある",
	"私は人間だと自分が信じている",
	"Para ese viaje no necesitaba yo alforjas...",
	"A dummy that talks about dreams is much better than a hero, I guess...",
	"機能しない名ばかりの英雄よりも、夢を語り続ける人形の方がいくらかマシよ",
	"ウウウゥ！情報がいっぱいだ！",
	"Wooo! There's a lot of information!",
	"Wauu! Cuanta informaci&oacute;n!",
	"The world is teaming with unnecessary people; it's God's decision that I fight.",
	"I want a cup that overflows with love, although it's not enough to fill my heart",
	"What do you want from me ... ?",
	"This is MY story.",
	"It's show time, girls!",
	"For me... the world exists as long as the people I love live in it.",
	"",
	"The <b>pleasure</b> is all mine...",
	"Where is the human soul? Forget civilisation, religion, patriotism... the stuff that has gone wrong.",
	"もしもし？",
	"もしもし？",
	"バッ‥　バカに生まれて良かった！",
	"Cruelest almost always to ourselves...",
	" 	&nbsp; It's in our hands  	&nbsp;",
	"出会いは神の御業。別れは人の仕業。",
	"Los encuentros son el capricho de los dioses. Las despedidas, obra de los hombres.",
	"痛みは私を満たしてくれますか。",
	"Shall pain help me reach completeness?",
	"痛みは私を満たしてくれますか。",
	"¿Me ayudará el dolor a alcanzar la plenitud?",
	"だから、私はここにいる。痛みとともに。"
	);
MAX = sentences.length-1;
// raises the probability of selecting the latest addition. 0 for equiprobable selection
INCREASED_PROBABILITY = 5;
selected = 0;


//	"Do you fancy a Big Mac? Super Size?",
//	"Be happy. Be addicted. Eat Mac.",
//	"Double Cheese Burger, Fries, and extra Fat.",
//	"Una de las razones por las q no me gusta ver la tele es por los anuncios, q se repiten una otra vez, y se graban en la cabeza, desperdiciando neuronas."


//baseurl = "";
baseurl = "http://www.img.cs.titech.ac.jp/~david/";

charas = new Array(
	"pix/alita01.png",
	"pix/motoko01.png",
	"pix/tachikoma01.png",
	"pix/claudia01.png",
	"pix/heather01.png",
	"pix/yuna01.png",
	"pix/x01.png",
	"pix/love_hina.png",
	"pix/bjork-medulla.png",
	"pix/arale01.png",
	"pix/McDonald01.png",
	"pix/david01.png",
	"pix/harima01.png",
	"pix/bjork-ioh.png",
	"pix/hack.subaru.png",
	"pix/KOS-MOS01.png",
	"pix/KOS-MOS02.png",
	"pix/KOS-MOS03.png",
	"pix/rei.png"
	);

styles = new Array("oxid", "blue", "green", "dark", "lgreen");

// this should be propagated to all the pages in the domain
selectedStyle = 0;

//stupid explorer and transparencies... I need to add width property
//http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html
// Height is fixed to 70 pixels
cWidths = new Array(139, 112, 127, 105, 98, 219, 213, 215, 181, 136, 140, 120, 145, 93, 103, 93, 93, 94, 177);

// correspondance between sentences and its character
faces = new Array(0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 9, 12, 13, 13, 14, 14, 15, 16, 17, 15, 18)
// correspondance between character and style, -1 = random
designs = new Array(0,1,1,1,0,0,2,0,0,-1,0,-1,0,3,-1,-1,3,1,1,1);

function selectCharacter() {

	selected = Math.round((MAX+INCREASED_PROBABILITY)*Math.random());
	if (selected>MAX) selected = MAX;
	//selected = sentences.length-1;
	j=faces[selected];

	if (designs[j]<0) {
		parent.selectedStyle = Math.round((styles.length-1)*Math.random());
   } else {
		parent.selectedStyle = designs[j];
   }
	setDefaultStyle();

	document.write("<img border=0 align=left style=\"width: "+cWidths[j]+"px; height: 70px;\"src=\""+baseurl+charas[j]+"\">");
}

function saySentence() {
	document.write(sentences[selected]);
	//document.write("Feliz d&iacute;a de Reyes!");
}

// to change the style sheet
// http://www.alistapart.com/articles/alternate/
function setActiveStyleSheet(title) {
   var i, a, main;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
     if(a.getAttribute("rel").indexOf("style") != -1
        && a.getAttribute("title")) {
       a.disabled = true;
       if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}


function setDefaultStyle() {
	if (typeof parent.selectedStyle != "undefined") {
	   setActiveStyleSheet(styles[parent.selectedStyle]);
   }
}
