function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		home_over = newImage("images/navigation/home-over.gif");
		about_over = newImage("images/navigation/about-over.gif");
		news_over = newImage("images/navigation/news-over.gif");
		press_over = newImage("images/navigation/press-over.gif");
		volume_over = newImage("images/main/volume_select.gif");
		preloadFlag = true;
	}
}

var active = [ 0,0,0,0,0,0,0,0,0,0,0 ];

function playMusic( songURL, itemObj ) {


str = '<object type="application/x-shockwave-flash" data="musicplayer.swf?autoplay=true&repeat=true&song_url='  + songURL + '" width="17" height="17">';
str = str + '<param name="movie" value="musicplayer.swf?autoplay=true&repeat=true&song_url='  + songURL + '" />';
str = str + '</object>';

	for ( i = 1; i <= 11; i++ ) { 

		if ( itemObj != ('song' + i) ) {

			document.getElementById("song" + i + "link").style.backgroundColor = "transparent";
			changeImages('song' + i, 'images/main/volume.gif');
			active[i-1] = 0;

		} else {

			active[i-1] = (active[i-1] == 0) ? 1 : 0;
			
			if ( active[i-1] == 1 ) {
				document.getElementById(itemObj + "link").style.backgroundColor = "#2f2b22";
				changeImages( itemObj, 'images/main/volume_select.gif');
				document.getElementById("music").innerHTML = str; 
			} else {
				document.getElementById("song" + i + "link").style.backgroundColor = "transparent";
				changeImages('song' + i, 'images/main/volume.gif');
				document.getElementById("music").innerHTML = "";
			}
		}
	}

	
	
	

}
