function viewPDF(selectedLicenseNo)
{
  winRef = window.open('', selectedLicenseNo, 'titlebar=yes,toolbar=no,directories=no,menubar=yes,location=no,resizable=yes,scrollbars=yes,status=no');
  winRef.document.open();
  winRef.document.write("<html>");
  winRef.document.write("<body bgcolor='white' onLoad='javascript:document.forms[0].submit();'> ");
  winRef.document.write("<form action='/songfile/ShowLicensePDF' method='post' target='_self' enctype=''>");
  winRef.document.write("<table width='100%' border='0'>");
  winRef.document.write("<tr><td>&nbsp;</td></tr>");
  winRef.document.write("<tr>");
  winRef.document.write("<td align='center' colspan='2'>");
  winRef.document.write("Please wait while the pdf format license is being loaded. You will be automatically redirected for viewing when it is finished.");
  winRef.document.write("</td>");
  winRef.document.write("</tr>");
  winRef.document.write("</table>");
  winRef.document.write("<input type='hidden' name='licenseNo' value='");
  winRef.document.write(selectedLicenseNo);
  winRef.document.write("'/>");
  winRef.document.write("</form>");
  winRef.document.write("</body>");
  winRef.document.write("</html>");
  winRef.document.close();
}
function set(target) {
     document.forms[0].forward.value=target;
}

function setAndSubmit(button,target)
{
	button.disabled=true;
	document.forms[0].forward.value=target;
	document.forms[0].submit();
}

function disableButtonAndSubmit(button,target)
{
	document.getElementById(button).disabled=true;
	document.forms[0].forward.value=target;
	document.forms[0].submit();
}

function setindex(target) {
     document.forms[0].index.value=target;
}

function setaddindex(index) {
     document.forms[0].addindex.value=index;
}

function ShowMenu(value)
{

	//starting at one, loop through until the number
	//chosen by the user
	if (value == "00")
	{
		document.getElementById('block1').style.display = 'block';
		document.getElementById('block2').style.display = 'none';
		document.getElementById('block3').style.display = 'none';		
	}
	else if (value == "01")
	{
		document.getElementById('block1').style.display = 'none';
		document.getElementById('block2').style.display = 'block';
		document.getElementById('block3').style.display = 'none';
	} else {
		document.getElementById('block1').style.display = 'none';
		document.getElementById('block2').style.display = 'none';
		document.getElementById('block3').style.display = 'block';
	
	}
}

function setYes() 
{
     document.forms[0].accept.value='Yes';
}

function setNo() 
{
     document.forms[0].accept.value='No';
}

function verify() {

	if(document.forms[0].accept.value=='No')
	{
		document.forms[0].forward.value='decline';
	}
}

function HideContent(d) 
{
	if(d.length < 1) 
	{ 	
		return; 
	}
	document.getElementById(d).style.display = "none";
}

function ShowContent(d) 
{
	if(d.length < 1) 
	{ 
		return; 
	}
	document.getElementById(d).style.display = "block";
}
// Following 2 functions will be used by publicsearchbody.jsp and cartsearch.jsp
function searchSong(e)
{
	if (submitted==true)
		return;
		
	var evtobj=window.event? event : e; //distinguish between IE's explicit event object (window.event) and Firefox's implicit.
	var unicode=evtobj.charCode? evtobj.charCode : evtobj.keyCode;

	if (unicode==13)
	{
		var inputList = document.getElementsByTagName("input");
		for(var i=0;i<inputList.length;i++) 
		{
      		var aInput = inputList[i];
      		var aType = aInput.getAttribute("type");
      		if(aType == "submit") 
      		{
				disableAndSubmit(aInput,'search');
	  		}
  		}
	}

}
function disableAndSubmit(button,target)
{
	if (submitted==true)
		return;
	submitted=true;  	  		
	button.disabled=true;
	document.forms[0].forward.value=target;
	document.forms[0].submit();
}
var submitted=false;

