
// TIME FUNCTIONS

var NUMBER_OF_PHOTOS = 77; // starting from 1

var NUMBER_OF_MIDIS = 23; // starting from 0

var midi_titles = new Array(
"Havana Affair",
"Jam (John's Solo)- Off The Map",
"Otherside",
"Mellowship Slinki in B-major",
"Parallel Universe",
"Time",
"Zephyr Song",
"Scar Tissue Live",
"Universally Speaking",
"Around The World",
"Porcelain",
"Suck My Kiss",
"Lil' gift",
"Lovin' and Touchin'",
"Blood Sugar Sex Magic",
"Under The Bridge",
"By The Way",
"Californication",
"Can't Stop",
"Could Have Lied",
"Dosed",
"F.U.",
"Give It Away");

var midi_files = new Array(
"havana_affair",
"off_the_map",
"otherside",
"mellowship",
"parallel_universe",
"time",
"zephyr_song",
"scar_tissue",
"universally_speaking",
"around_the_world",
"porcelain",
"suck_my_kiss",
"lil_gift",
"lovin_and_touchin",
"bssm",
"under_the_bridge",
"by_the_way",
"californication",
"cant_stop",
"could_have_lied",
"dosed",
"F_U",
"give_it_away");

var days = 0;

months = new Array(
'Января','Февраля','Марта',
'Апреля','Мая','Июня','Июля',
'Августа','Сентября','Октября',
'Ноября','Декабря'
);

month_duration = new Array(31,29,31,30,31,30,31,31,30,31,30,31);

var today = new Date();

function getDateString() {
	return today.getDate()+" "+months[today.getMonth()];
}
	
function getPhotoDay() {
	for (var m = 0; m < today.getMonth(); m++) { days += month_duration[m]; }
	days += today.getDate();
	return (days % NUMBER_OF_PHOTOS);
}

function getMidiTitle() {
	return midi_titles[days % NUMBER_OF_MIDIS];
}

function getMidiFile() {
	return midi_files[days % NUMBER_OF_MIDIS];
}
	

// AUDIO FUNCTIONS

var paused = false;

function loadIntro() {
	var file = getMidiFile();
	initAudioAPI(['intro','audio/x-midi']);
	intro.src="/midi/"+file+".MID";
	players['intro'].load("/midi/"+file+".MID");
	//if (screen.width < 1024) alert("Ваше разрешение экрана слишком низкое и пока не поддерживается =)\n Rommie")
}

function play() {
	paused = false;
	if (intro.readystate == 4) players['intro'].play(1);
	else setTimeout("play()",1000);
}

function pause() {
	if (!paused) { players['intro'].stop(); paused = true; }
	else play();
}

function stop() {
	paused = false;
	players['intro'].stop();
	players['intro'].rewind();
}
	

