

function validAPO2()
	{
	if(!validateAll('firstname', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('lastname', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('address1', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('address2', 'isValidString'))
		{return false;}

	if(!validateAll('city', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('state', 'isNotEmpty','isValidString'))
		{return false;}


	if('' == document.getElementById('country').value)
		{
		alert("A country must be selected");
		return false;
		}

	if(!validateAll('zip', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('phone', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('email', 'isNotEmpty','isValidEmail'))
		{return false;}

	if(!validateAll('creditcard', 'isNotEmpty','isValidCC'))
		{return false;}

	if(!validateAll('expdate', 'isNotEmpty','isValidExpDate'))
		{return false;}

	if(!validateAll('cvv', 'isNotEmpty','isValidCCV'))
		{return false;}

	var noGenre = parseInt(document.getElementById('noGenre').value);
	var count = 0;
	for(var i = 0; i < noGenre; i++)
		{
		var cb = 'genreCB'+i.toString();
		if(true == document.getElementById(cb).checked)
			count++;
		}
	if(0 == count)
		{
		alert('At least one Genre must be selected');
		return false;
		}

	if(false == document.getElementById('legal').checked)
		{
		alert('You must read and agree to the legal terms.');
		return false;
		}
	return true;
	}
	
function validAPO1()
	{
	if(!validateAll('firstname', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('lastname', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('company', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('password', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('address1', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('address2', 'isValidString'))
		{return false;}

	if(!validateAll('city', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('state', 'isNotEmpty','isValidString'))
		{return false;}


	if('' == document.getElementById('country').value)
		{
		alert("A country must be selected");
		return false;
		}

	if(!validateAll('zip', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('phone', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('email', 'isNotEmpty','isValidEmail'))
		{return false;}

	if(!validateAll('website', 'isNotEmpty','isValidURL'))
		{return false;}

	if(!validateAll('creditcard', 'isNotEmpty','isValidCC'))
		{return false;}

	if(!validateAll('expdate', 'isNotEmpty','isValidExpDate'))
		{return false;}

	if(!validateAll('cvv', 'isNotEmpty','isValidCCV'))
		{return false;}

	var noGenre = parseInt(document.getElementById('noGenre').value);
	var count = 0;
	for(var i = 0; i < noGenre; i++)
		{
		var cb = 'genreCB'+i.toString();
		if(true == document.getElementById(cb).checked)
			count++;
		}
	if(0 == count)
		{
		alert('At least one Genre must be selected');
		return false;
		}

	if(false == document.getElementById('legal').checked)
		{
		alert('You must read and agree to the legal terms.');
		return false;
		}



	return true;
	}


function genreUpdate()
	{
	var firstGenre = 99;
	var addGenre = 69;
	var noGenre = parseInt(document.getElementById('noGenre').value);
	var count = 0;
	var price = 0;
	for(var i = 0; i < noGenre; i++)
		{
		var cb = 'genreCB'+i.toString();
		if(true == document.getElementById(cb).checked)
			count++;
		}
	if(0 < count)
		{	
		count -= 1;
		price = firstGenre + addGenre * count;
		}

    achotac = parseInt(document.getElementById('achotac').value);
    if(document.getElementById('genreCB0').checked)
        achotac |= 0x01;
    else  
        achotac &= ~0x01;      
    if(document.getElementById('genreCB1').checked)
        achotac |= 0x02;
    else  
        achotac &= ~0x02;      

    document.getElementById('achotac').value = achotac.toString();

	document.getElementById('totalPrice').innerHTML = 'Total Price: $'+price+'.00';
	}	
	
function validUpload()
	{
	if(!validateAll('artistname', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('biotour', 'isValidString'))
		{return false;}

	if(!validateAll('songtitle', 'isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('website', 'isValidURL'))
		{return false;}

	if(!validateAll('albumtitle', 'isValidString'))
		{return false;}

	if(!validateAll('label','isNotEmpty','isValidString'))
		{return false;}

	if(!validateAll('labelLogo','isValidCDCoverExt'))
		{return false;}

	if(!validateAll('songupload','isNotEmpty','isValidMP3Ext'))
		{return false;}

	if(!validateAll('albumcover','isValidCDCoverExt'))
		{return false;}

	if(!validateAll('publishingname', 'isNotEmpty','isValidString'))
		{return false;}

	if('' == document.getElementById('publishing').options[document.getElementById('publishing').selectedIndex].value)
		{
		alert('Publishing company required'); 
		return false;
		}

	if('' == document.getElementById('songupload').value)
		{
		alert('Valid MP3 File Name Required');
		return false;
		}

	document.getElementById('upgraphic').style.zIndex="10";
	document.getElementById('publishing').style.visibility="hidden";
	setTimeout("document.getElementById('ugraphic').src ='http://www.spinstrackingsystem.com/secure/images/uploadscreen2.gif'", 200); 
	return true;
	}
	
