var isNS4 = (navigator.appName=="Netscape")?1:0;

function populateArtistInfo()
{
	artistcombo  = document.Form1.artistcombo.value;
	if ((artistcombo == "other") || (artistcombo == ""))
	{
		document.Form1.birthname.value = "";

		var albums = document.Form1.albumcombo;
		albums.options.length = 0;
		albums.options[0] = new Option('Select One','');
		albums.options[1] = new Option('Other','other');
	}
	else
	if (artistcombo != "")
	{
		includeScript('js/getArtistInfo.php?artist='+artistcombo, 'lastLoadedCmds');
	}


	//var head = document.getElementsByTagName('head').item(0);
	//var old  = document.getElementById('lastLoadedCmds');
	//if (old) head.removeChild(old);
	//script = document.createElement('script');
	//script.src = 'js/getArtistInfo.php?artist=1';
	//script.type = 'text/javascript';
	//script.defer = true;
	//script.id = 'lastLoadedCmds';
	//void(head.appendChild(script));
}

function includeScript(url, id)
{
	//alert(url);
	var head = document.getElementsByTagName('head').item(0);
	var old  = document.getElementById(id);
	if (old) head.removeChild(old);
	script = document.createElement('script');
	script.src = url;
	script.type = 'text/javascript';
	script.defer = true;
	script.id = id;
	void(head.appendChild(script));



}

function buildPlayer()
{
	includeScript('js/buildplayer.php?client=1', 'player');
}


function ValidSongForm()
{
	song         = document.Form1.song.value;
	artistcombo  = document.Form1.artistcombo.value;
	artist       = document.Form1.artist.value;
	birthname    = document.Form1.birthname.value;
	albumcombo   = document.Form1.albumcombo.value;
	album        = document.Form1.album.value; 
	genre        = document.Form1.genre.value; 
	slength       = document.Form1.slength.value; 
	albumphoto   = document.Form1.albumphoto.value; 
	artistphoto  = document.Form1.artistphoto.value; 
	mp3          = document.Form1.mp3.value; 

	
		
		if (song == "")
		{
			alert("Please enter the name of the song.");
			document.Form1.song.focus();
			return false;
		}
		else
		if (artistcombo == "")
		{
			alert("Please select a artist or select Other and type artist name below.");
			document.Form1.artistcombo.focus();
			return false;
		}
		else
		if ((artistcombo == "other") && (artist == ""))
		{
			alert("Please enter artist name in the other field or select a artist name above.");
			document.Form1.artist.focus();
			return false;
		}
		else
		if (albumcombo == "")
		{
			alert("Please select a album or select Other and enter album name below.");
			document.Form1.albumcombo.focus();
			return false;
		}
                else
		if ((albumcombo == "other") && (album == ""))
		{
			alert("Please enter album name in the other field or select an album name above.");
			document.Form1.album.focus();
			return false;
		}
		else
		if (genre == "")
		{
			alert("Please select the genre of music.");
			document.Form1.genre.focus();
			return false;
		}
		else
		if (mp3 == "")
		{
			alert("Please click the browse button and select music file to upload.");
			document.Form1.mp3.focus();
			return false;
		}
		else
                {
                      return true;
                }
		

		
  	
}


  