// small function to check if a download-option (mp3,wav) is selected
// now we also check if we have a sound selection and mp3 chosen which isn't possible  

function CheckDownloadOption(radioname,message,message2) 
{
 	var inputs,i,c;
    //	alert(radioname);
 	inputs=document.getElementsByTagName('input');
 	cut = false;
	c = false;
 	cif=document.getElementById('cutsound');
	//alert(cif);
	if(cif != null) {
		if(cif.value == 1) cut = true;
	}
	
	// this one is set if any cut has happened = the accept/delete buttons are shown
	// set by SoundPartSelected in ajax_sx_shop.php
	cselected = false;
 	csel=document.getElementById('cutselected');
	if(csel != null) {
		if(csel.value == 1) cselected = true;
	}
	
	//alert('cval='+cut); 
 	mp3 = false;
 	ocount = 0;
 	for(i=0;i<inputs.length;i++)
 	{
  		if(inputs[i].type == 'radio' && inputs[i].name == radioname)
   		{
  			//alert(inputs[i].name + ' ' + inputs[i].checked);
  			ocount++;
   			// now we have the radio we want ...
   			if(inputs[i].checked) {
   				if(ocount<2) mp3=true;  // the number is the first wav option; lower = mp3
	   			c=true; // one is checked !
	   			break;
   			}
   		}
  	}	
 	
 	if(mp3 && cut) {
 		alert(message2);
 		return false;
 	}	
	
 	if(!cut && mp3 && cselected) {
 		// if somebody cut a sound but didn't press "akzepted" ! Throw away any cuts !
 		// we only do that for mp3s as they are not cutable. For wav it's ok: convenience ...
		alert(message2);
	 	xajax_ResetSelection(1);
		return false;
 	}
 	
 	//alert(cut);
	//if(c) alert('one is checked');
  	//else alert('no checked ones');
  	if(!c) {
  		alert(message);
  	}
	
	return c;
}


//
// advanced search 
//

var hh=0;
var inter;

//we show the box by setting the visibility of the element and incrementing the height smoothly
function ShowBox()
{
	//alert(navigator.appName);
	if(navigator.appName.indexOf("Microsoft") != -1) {
		hhs=220;
	}
	else {
		hhs=180
	}

//Depending on the amount of text, set the maximum height here in pixels
	if(hh>=hhs)
	{
	clearInterval(inter);
	return;
	}

	obj = document.getElementById("coveradvanced");
	obj.style.visibility = 'visible';
	hh+=5;
	obj.style.height = hh + 'px';
}

//same way as above but reversed
function HideBox()
{
	obj = document.getElementById("coveradvanced");

	if(hh==5)
	{
	obj.style.visibility = 'hidden';
	obj.style.height = '0.1em';
	clearInterval(inter);
	return;
	}
	hh-=5;
	obj.style.height = hh + 'px';
}
