function validateSubmitText(phn)
{
	if(phn.length != 10)
	{
		alert("Your phone number should be a total of 10 digits, please try again.");
		return false;
	}
	$.post("/uowyn/GetRingTones/?number="+phn, 
	
	function(data)
	{ 
		var tmp = data.toUpperCase();
		if(tmp.indexOf('SUCCESS') != -1)
		{
			alert('Thanks for pledging to save water, tough guy. The manly Denver Water text message you ordered will be sent to your phone. Stay burly and continue using only what you need.');
		}else{
			alert("Uh oh, there's been an issue and your text subscription was not sent.");
		}
	}
	
	);
}

function validateSubmit(phn,content)
{
	if(phn.length != 10)
	{
		alert("Your phone number should be a total of 10 digits, please try again.");
		return false;
	}
	$.post("/uowyn/GetRingTones/?number="+phn+"&content="+content, 
	
	function(data)
	{ 
		var tmp = data.toUpperCase();
		if(tmp.indexOf('SUCCESS') != -1)
		{
			alert('Thanks for pledging to save water, tough guy. The manly Denver Water ringtone you ordered will be sent to your phone, shortly. Stay burly and continue using only what you need.');
		}else{
			alert("Uh oh, there's been an issue and your ringtone was not sent.");
		}
	}
	
	);	
}

function validate(txtObj)
{
   var sText = txtObj.value;
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   if(!IsNumber)
   {
		alert('Please enter only numbers');
		txtObj.value='';
		txtObj.focus();
   }
   return IsNumber;
}


function playRingtone (ringtoneSrc,ringtoneAutoplay) {
	var audioControllerContent = ''; 
	
	 audioControllerContent = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" id="audioControllerObj" data="' + ringtoneSrc + '" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="200" height="20">';
	audioControllerContent += '<param name="src" value="' + ringtoneSrc + '" />';
	audioControllerContent += '<param name="EnableJavaScript" value="True" />';
	audioControllerContent += '<param name="postdomevents" value="True" />';
	audioControllerContent += '<param name="controller" value="true" />';
	audioControllerContent += '<param name="autostart" value="' + ringtoneAutoplay + '" />';
	audioControllerContent += '<param name="bgcolor" value="#FFFFFF" />';
	audioControllerContent += '<param name="pluginspage" value="http://www.apple.com/quicktime/download/" />';
	audioControllerContent += '<!--[if !IE]> <-->';
	audioControllerContent += '<embed src="' + ringtoneSrc + '" bgcolor="#FFFFFF" type="audio/x-mpeg" id="audioControllerObjID" name="audioControllerObj"  postdomevents="True" width="200" height="20" autostart="' + ringtoneAutoplay + '" controller="true" ></embed>';
	audioControllerContent += '<!--> <![endif]-->';
	audioControllerContent += '</object>';                          
															 
	$('#audioControllerDiv').html( audioControllerContent );
}
