


function doUnderline(o)
	{
	o.style.textDecorationUnderline = true
}

function undoUnderline(o)
	{
	o.style.textDecorationUnderline = false
}

function playAudio(audioStream){
	parent.document.getElementById("scoreFrames").rows="100%, 0%, 0%"
	parent.audio.location.href = "audioPlay.asp?score_id=" + audioStream
}

function downloadAudio(audioStream){
	parent.document.getElementById("scoreFrames").rows="100%, 0%, 0%"
	parent.audio.location.href = "audioDownload.asp?score_id=" + audioStream
}

function viewSamplePDF(){
	var w = window.open("dorm40musicSampleScore.PDF", "pdf", "directories=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no,  height=640, width=480, top=0, left=0")
	w.focus()
}	

function playFreeAudio(){
	parent.audio.location.href = "freeAudioPlay.asp"
}

function downloadFreeAudio(){
	parent.audio.location.href = "freeAudioDownload.asp"
}

function viewFreePDF(){
	// var w = window.open("dorm40musicSampleScore.PDF", "pdf", "directories=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no,  height=640, width=480, top=0, left=0")
	// w.focus()
	parent.audio.location.href = "freePDFDownload.asp"
}	


function goModalWindow(w){
	window.showModalDialog(w,'','help:no;status:no;scroll=no')
}


function goCD(){
	window.showModalDialog('cdInfo.asp','','help:no;status:no;scroll=no;dialogHeight:640px; dialogWidth:400px')
}

function goMail(){
	window.showModalDialog('sendMailSet.asp','','help:no;status:no;scroll=no;dialogHeight:420px; dialogWidth:640px')
}


//***************************************************************

function changeStatus(s){

	var banner
	if (arguments.length == 0){
		banner = "dorm40music.com - Publication Database"
		}else{
		banner = s
	}
	window.status = banner
	return(true)
}

function showStatus(){
	window.status = "dorm40music.com - Publication Database"
	return(true)
}


function buyStatus(){
	window.status = "Click to add this music to your shopping cart."
	return(true)
}
//******************************************************************


function buyThis(){
	alert("You bought this score!")
}



function viewPDF(score_id){

	// testing in-line
	// parent.audio.location.href = "testPop.asp?score_id=" + score_id
	// parent.document.getElementById("scoreFrames").rows="50%, 50%, 0%"	

	w = top.main.window.open("pdfView.asp?score_id=" + score_id, "pdf", "directories=no, location=no, menubar=no, resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no,  height=640, width=480, top=0, left=0")

	// don't use this:
	// w.opener.blur()
}


function closeScore(){
	parent.document.getElementById("scoreFrames").rows="100%, 0%, 0%"
	parent.audio.location.href = ""
}



function showScoreDetail(score_id, audio){

	document.getElementById("audioWMA").src = "embedAUDIO.asp?wmaBIN=AudioPlay.asp&score_id="+score_id
	document.getElementById("scorePDF").src = "embedPDF.asp?pdfBin=pdfView.asp&score_id="+score_id
	document.getElementById("PDF").style.visibility="visible"

}



function showFreeScoreDetail(){

	document.getElementById("audioWMA").src = "embedAUDIO.asp?wmaBIN=freeAudioPlay.asp"
	document.getElementById("scorePDF").src = "embedPDF.asp?pdfBin=freePDFDownload.asp"
	document.getElementById("PDF").style.visibility="visible"
}



function hideScoreDetail(){

	document.getElementById("PDF").style.visibility="hidden"
	document.getElementById("audioWMA").src = ""
	document.getElementById("scorePDF").src = ""
}



function showSampleScoreDetail(){

//  No Audio	
	document.getElementById("scorePDF").src = "embedPDF.asp?pdfBin=dorm40musicSampleScore.PDF"
	document.getElementById("PDF").style.visibility="visible"

}




function goShop(score_id){
	parent.shopcart.location.href = "updateShopcartMain.asp?score_id=" + score_id
}


/*
Sort Orders:
0 = Title
1 = Composer
2 = Arranger
3 = Instrumentation
*/
function changePage(s, o){
	var sortOrder = s
	var pageNo = o.value
	location.href = "scoresByComposer.asp?sortOrder=" + sortOrder + "&currentPage=" + pageNo
}

/*
Need pageForward & pageBack function
*/


/*
Sort Orders:
0 = Title
1 = Composer
2 = Arranger
3 = Instrumentation
*/
function changePage0(s, p){
	var sortOrder = s
	var pageNo = p
	location.href = "scoresByComposer.asp?sortOrder=" + sortOrder + "&currentPage=" + pageNo
}

/*
Need pageForward & pageBack function
*/

/*
SEARCH Sort Orders:
0 = Title
1 = Composer
2 = Arranger
3 = Instrumentation
*/
function changePage2(s, o, sVar){
	var sortOrder = s
	var pageNo = o.value
	var memVar = sVar
	//alert(sortOrder)
	//alert(pageNo)
	//alert(memVar)
	location.href = "scoresReturnedBySearch.asp?sortOrder=" + sortOrder + "&currentPage=" + pageNo + "&searchItem=" + memVar
}

/*
SEARCH Sort Orders:
0 = Title
1 = Composer
2 = Arranger
3 = Instrumentation
*/
function changePage3(s, p, sVar){
	var sortOrder = s
	var pageNo = p
	var memVar = sVar
	//alert(sortOrder)
	//alert(pageNo)
	//alert(memVar)
	location.href = "scoresReturnedBySearch.asp?sortOrder=" + sortOrder + "&currentPage=" + pageNo + "&searchItem=" + memVar
}

/*
Need pageForward & pageBack function
*/

function getMoreInfo(s){

	document.all.moreInfo.src = "dummy.asp?score_id=" + s
	document.all.moreInfo.style.display = "block"
	document.all.moreInfo.style.visibility = "visible"


}

function getLessInfo(){
	parent.document.all.moreInfo.style.display = "none"
	parent.document.all.moreInfo.style.visibility = "hidden"
	parent.document.all.moreInfo.src = ""
}


function Show(evt, i){

o = eval(i)

/* get the mouse left position */
x = evt.clientX + document.body.scrollLeft;
/* get the mouse top position  */
y = evt.clientY + document.body.scrollTop + 5;
/* display the pop-up */
//Popup.style.display="block";
o.style.display="block";
/* set the pop-up's left */
//Popup.style.left = x;
o.style.left = x;
/* set the pop-up's top */
// Popup.style.top = y;
o.style.top = y;

}


function Hide(evt, i){
	o = eval(i)
	/* hide the pop-up */
    //Popup.style.display="none";
    o.style.display="none";
}



//from shoppingCart
//***********************************************

function init(e){

	var errCondition = e

	if (errCondition.length > 0){
		alert(errCondition)
		parent.location.href = "index.asp"
	}
}


function kill(){
	parent.location.href = "index.asp"
}


function checkOut(){
	var totalAmount = form1.grandTotal.value

	//  this only works with ie	
	//	parent.process.mainCheckOut.amount.value = totalAmount

	// this works with everything
	parent.process.document.mainCheckOut.amount.value = totalAmount
	parent.extra.location.href = "customCreate.asp"

	// 2 lines of code below issued in customCreate
	// parent.scoreFrames.rows = "0%, 100%, 0%, 0%"
	// parent.process.mainCheckOut.submit()
}


function clearMsg(){

//	msgHolder.innerText = ''
	msgHolder.style.visibility = 'hidden'

}


function processDiscount(){

	var secretWord = form1.mDC.value

	if ( secretWord.length == 0 ) {
		alert("You must enter the secret word!  It's a common word; something you find around the house every day.")
		return(false)
	}
	parent.extra.location.href = "processDiscount.asp?secretWord=" + secretWord
}




function clearCart(){
	if ( confirm("Are you sure you want to clear your Shopping Cart items?") ){
		parent.location.href = "clearShoppingCart.asp"		
	}
}


function updateCart(){

	var cartItems = cartUpdateForm.length
	var x, totalOnes = 0
	
	
	for (x = 0; x < cartItems; x++){
		if (cartUpdateForm[x].value == "1") {
			totalOnes = (totalOnes + 1)
		}
	}
	
	
	if (cartItems == 1 || totalOnes == cartItems){
		if ( confirm("This action will clear your Shopping Cart item.\nDo you want to do this?") ){
			parent.location.href = "clearShoppingCart.asp"		
		}
		}else{
		cartUpdateForm.submit()
	}

}

function enableUpdateButton(o){

	var n = o.name
	var x = cartUpdateForm.length
	var y

	if (o.checked == true){
		for (y = 0; y < x; y++){
			if (cartUpdateForm[y].name == n) {
				cartUpdateForm[y].value = "1"
			}
		}
		}else {
		for (y = 0; y < x; y++){
			if (cartUpdateForm[y].name == n) {
				cartUpdateForm[y].value = "0"
			}
		}
	}

	form1.bUpdate.disabled = false
}




function goHelp(){
	window.showModalDialog('productHelp.asp?help=shoppingCart.asp','','help:no;status:no;scroll=no')
}



function goReCalc(){

	var x, y, i
	var prefix
	var quantity, cost, subtotal, display, grandTotal

	grandTotal = 0

	x = form1.elements.length - 2
	y = 4


	for (i = 0;  i < x; i = i + y){
		quantity = form1.elements[i].value.valueOf()

		if (quantity < 0 || isNaN(quantity) ){
			quantity = 0
			form1.elements[i].value = "0"
		}
		cost = form1.elements[i + 1].value.valueOf()

		total = (quantity * cost)

		form1.elements[i + 2].value = fCurrency(total)

		// alert(fCurrency(total))

		form1.elements[i + 3].value = total
		grandTotal = grandTotal + total

	}

	form1.grandTotal.value = grandTotal
	form1.grandTotal_DISPLAY.value = fCurrency(grandTotal)
}


function fCurrency(amount)
{
	var i = parseFloat(amount);
	if (isNaN(i)) { 
		i = 0.00; 
	}
	var minus = ''
	if (i < 0) { 
		minus = '-'; 
	}
	i = Math.abs(i)
	i = parseInt((i + .005) * 100)
	i = i / 100
	s = new String(i)
	if (s.indexOf('.') < 0) { 
		s += '.00'
	}
	if (s.indexOf('.') == (s.length - 2)) { 
		s += '0'
	}
	s = minus + s
	// s = "$" + s
	return s
}


//********************************************************
//End From Shopping Cart

function checkLog(myfield, e){

	var keycode

	if (window.event){
		keycode = window.event.keyCode
		}else{
		if (e) {
			keycode = e.which
			}else{
			return(true)
		}
	}

	if (keycode == 13){
	   custLogin()
	   }else{
	   return(true)
	}
	
}


function custLogin(){
	if (document.customerLogin.payPalEmail.value == ""){
		alert("You forgot to enter your email address.\nPlease try again.")
		return(true)
	}
	document.customerLogin.action = "myMedia.asp"
	document.customerLogin.submit()	
}


function check_Log(myfield, e){

	var keycode

	if (window.event){
		keycode = window.event.keyCode
		}else{
		if (e) {
			keycode = e.which
			}else{
			return(true)
		}
	}

	if (keycode == 13){
	   cust_Login()
	   }else{
	   return(true)
	}
	
}




function cust_Login(){
	if (document.xCustomerLogin.payPalEmail.value == ""){
		alert("You forgot to enter your email address.\nPlease try again.")
		return(true)
	}
	document.xCustomerLogin.action = "xMyMedia.asp"
	document.xCustomerLogin.submit()	
}


function adobeGillis(){
	parent.location.href = "http://www.adobe.com/acrobat"
}


function getFreeScore(){
	parent.location.href = "freeScoreSet.asp"
}



function checkLogSrch(myfield, e){

	var keycode

	if (window.event){
		keycode = window.event.keyCode
		}else{
		if (e) {
			keycode = e.which
			}else{
			return(true)
		}
	}

	if (keycode == 13){
	   searchScores("keyword")
	   return(false)
	   }else{
	   return(true)
	}
	
}


function searchScores(s)
{

if (s == "title")
	{
		searchItem = form1.mTitle.value	
		location.href = "scoresReturnedBySearch.asp?sortOrder=0&searchItem=" + searchItem
	}

if (s == "composer")
	{
		searchItem = form1.mComposer.value	
		location.href = "scoresReturnedBySearch.asp?sortOrder=1&searchItem=" + searchItem
	}

if (s == "instrumentation")
	{
		searchItem = form1.instrumentation.value	
		location.href = "scoresReturnedBySearch.asp?sortOrder=2&searchItem=" + searchItem
	}

if (s == "keyword")
	{
		searchItem = form1.mKeyWord.value
		if ( searchItem.length >= 4 )
			{
				location.href = "scoresReturnedBySearch.asp?sortOrder=3&searchItem=" + searchItem
			}
	}

}


//********************************************************
// RSS Window

function rssWindow(url) {
	popupWindow = window.open(
		url,'rssPopUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,location=no,directories=no,status=no')
}

//********************************************************