// Hint show functions by DSC
// (c) 2004

function showEarTool(artist, album)
{
	var inHTML;

	document.all.tool.style.display = "";

	inHTML = "<table cellspacing=0 cellpadding=0 class='tooltip'>";
	inHTML += "<tr><td class='td_tooltip'>";
	inHTML += "<b>" + artist + "</b><br>";
	inHTML += album;
	inHTML += "</td></tr>";
	inHTML += "</table>";

	tool.innerHTML = inHTML;

	document.all.tool.style.top = document.body.scrollTop + event.y + 15;
	document.all.tool.style.left = document.body.scrollLeft + event.x + 10;
}

function showATool(composer, author, lang)
{
	var inHTML;

	document.all.tool.style.display = "";

	inHTML = "<table cellspacing=0 cellpadding=0 class='tooltip'>";
	inHTML += "<tr><td class='td_tooltip'>";

	if(lang == "ru") {
		if(composer != "")
		{
			inHTML += "<b>Композитор:</b> " + composer + "<br>";
		}

		if(author != "")
		{
			inHTML += "<b>Автор слов:</b> " + author + "<br>";
		}
	}
	else {
		if(composer != "")
		{
			inHTML += "<b>B&#601;st&#601;kar:</b> " + composer + "<br>";
		}

		if(author != "")
		{
			inHTML += "<b>S&#246;z:</b> " + author + "<br>";
		}
	}

	inHTML += "</td></tr>";
	inHTML += "</table>";

	tool.innerHTML = inHTML;

	document.all.tool.style.top = document.body.scrollTop + event.y + 15;
	document.all.tool.style.left = document.body.scrollLeft + event.x + 10;
}

function showNATool(letter, lang)
{
	var inHTML;
	document.all.tool.style.display = "";

	inHTML = "<table cellspacing=0 cellpadding=0 class='tooltip'>";
	inHTML += "<tr><td class='td_tooltip' width=220>";

	if(lang == "ru") {
		inHTML += "В данный момент в базе отсутствуют исполнители на букву <b>" + letter + "</b>. ";
		inHTML += "Следите за обновлениями на сайте.";
	}
	else {
		inHTML += "Haz&#305;rda saytda ad&#305; <b>" + letter + "</b> h&#601;rfi il&#601; ba&#351;layan ifa&#231;&#305;lar yoxdur. ";
		inHTML += "Saytdak&#305; yenil&#601;&#351;m&#601;ni izl&#601;yin.";
	}

	inHTML += "</td></tr>";
	inHTML += "</table>";

	tool.innerHTML = inHTML;

	document.all.tool.style.top = document.body.scrollTop + event.y + 15;
	document.all.tool.style.left = document.body.scrollLeft + event.x + 10;
}

function hideTool()
{
	document.all.tool.style.display = "none";
}

function doDown(file_id)
{
	window.open( "/cgi-bin/get_track.cgi?id=" + file_id, "self_upd", "width=400,height=300,status=no,scroll=auto" );
}

function doSample(file_id)
{
	document.location.href= "/cgi-bin/get_sample.cgi?id=" + file_id;
}

function help(lang)
{	
	window.open( "/help_"+ lang +".html", "help", "width=400,height=400,status=no,scrollbars=yes" );
}

function wish()
{	
	window.open( "/cgi-bin/wish.cgi", "musiqi_wish", "width=330,height=420,status=no,scrollbars=no" );
}

function winclose () {

	window.close();

}

function checkform(forcheck,status) {

	check = new String(forcheck);
	check = check.split(";");
	
	delspace();

	for (i=0; i<check.length; i = i + 2) {

		checkinfo = (document.forms[0].elements[check[i]].value == check[i+1]) ? "true" : "false";
		if (checkinfo == "true") {
			alert('Please fill all fields!');
			break;
		}

	}
	
	if (checkinfo == "false") {
		updhid(status);
	}
	
}

function updform(status){

	document.forms[0].status.value = status;
	document.forms[0].submit();

}

function delspace() {

	temp = new String();
	formleng = document.forms[0].length;

	for (i=0; i<formleng; i++ )	{
		temp = document.forms[0].elements[i].value;
		temp = temp.replace(/\s+$/, "");
		temp = temp.replace(/^\s+/, "");
		document.forms[0].elements[i].value = temp;

	}
}

function updhid(val) {

	if (val) {
			
		value = new String(val);
		value = value.split(",");
	
		hidden = new Array;
		temp = new String;

		for (i=0; i < value.length; i++ ) {
	
			temp = value[i].split("=")
			hidden.push(temp[0]);
			hidden.push(temp[1]);
	
		}

		for (i=0; i<hidden.length; i = i + 2) {

			document.forms[0].elements[hidden[i]].value = hidden[i+1];
		}
	
	
	}
	
	document.forms[0].submit();
}

function swapLeft(val) {
	document.cookie = "musiqi_left=" + val + "; expires=Fri, 1-Jan-2010 12:00:00 GMT; path=/;";
	document.location.reload();
}

function swapLang(val) {
	document.cookie = "musiqi_lang=" + val + "; expires=Fri, 1-Jan-2010 12:00:00 GMT; path=/;";
	document.location.reload();
}
