function validate_required(field,alerttxt){
with(field){
if(value==null||value==""){
alert(alerttxt)
return false}
else{
return true}}}
function toUpper(txt){
var a=txt.value.split(/\s+/g)
for(i=0;i<a.length;i++){
var firstLetter=a[i].substring(0,1).toUpperCase()
var restOfWord=a[i].substring(1,a.length).toLowerCase()
a[i]=firstLetter+restOfWord}
txt.value=a.join(' ')}
function check_extension(whichpage){
if(whichpage=='pbuploads'){
var file_name=document.upload_1.upload_file.value
var allowed_ext=document.upload_1.upload_format.value
var allowed_ext_extra=(typeof(document.upload_1.upload_format_extra)!='undefined')? document.upload_1.upload_format_extra.value : allowed_ext
var file_extension=file_name.substring(file_name.lastIndexOf(".")+1)
if(file_extension !=allowed_ext&&file_extension !=allowed_ext_extra){
alert('The "download" file you specified does not have the correct extension.')
return false}}}
function validate_form(thisform,whichpage){
with(thisform){
if(whichpage=='pbuploads'){
if(validate_required(upload_title,"You have not specified a title for your upload")==false){
upload_title.focus()
return false}
else if(validate_required(upload_folder,"You have not specified a folder for your upload")==false){
upload_folder.focus()
return false}
else if(validate_required(upload_file,"You have not specified a file to upload.")==false){
upload_file.focus()
return false}
if(check_extension('pbuploads')==false){
return false}
if(typeof document.getElementById('upload_previewimage_1')=='object'&&typeof document.getElementById('upload_previewimage_2')=='object'){
if(validate_required(upload_previewimage_1,"You have not selected preview 1.")==false){
upload_previewimage_1.focus()
return false}
else if(validate_required(upload_previewimage_2,"You have not selected preview 2.")==false){
upload_previewimage_2.focus()
return false}}}
else if(whichpage=='shoutbox'){
if(validate_required(shout_text,"You have not specified a shout message.")==false){
shout_text.focus()
return false}
if(document.cookie.indexOf('m24_shfl')!=-1){
alert("Please wait at least 60 seconds before posting another shout.")
return false}}
else if(whichpage=='ringtonecreator'){
if(userfile.value==''){
alert("You must specify a file to upload.")
userfile.focus()
return false}
else if(getCheckedValue(option_privacy)==''){
alert("You must select a privacy option.")
return false}
else if(getCheckedValue(option_privacy)=='public'&&ringtone_title.value==''){
alert("You must specify the title of your ringtone.")
ringtone_title.focus()
manshowHide('lyr_ringtone_title','on')
return false}
else if(getCheckedValue(option_privacy)=='public'&&upload_folder.value==''){
alert("You must specify the folder of your ringtone.")
upload_folder.focus()
return false}}}}
function getCheckedValue(radioObj){
if(!radioObj)
return ""
var radioLength=radioObj.length
if(radioLength==undefined)
if(radioObj.checked)
return radioObj.value
else
return ""
for(var i=0;i<radioLength;i++){
if(radioObj[i].checked){
return radioObj[i].value}}
return ""}
function gotourl(url){
if(url=='0'){
return false}
else{
location=url}}
function submitform(){
if(url==0){
return false}
else{
location=url}}
function mGlossaryQ(url){
window.open(url,"mGlossary","scrollbars=no,height=300,width=400,status=yes,toolbar=no,menubar=no,location=no")}
function mPhoneGallery(url){
window.open(url,"mPhoneGallery","scrollbars=no,height=640,width=450,status=yes,toolbar=no,menubar=no,location=no")}
function PopUp(url,h,w){
window.open(url,"mPhoneGallery","scrollbars=no,height="+h+",width="+w+",status=yes,toolbar=no,menubar=no,location=no")}
function mPreview(url,width,height){
var left=(screen.availWidth/2)-(width/2)
var top=(screen.availHeight/2)-(height/2)
window.open(url,"mPreview","scrollbars=no,height="+height+",width="+width+",status=yes,toolbar=no,menubar=no,location=no,left="+left+",top="+top+"")}
function popup(w,h,url,target){
var left=(screen.availWidth/2)-(w/2)
var top=(screen.availHeight/2)-(h/2)
window.open(url,target,'width='+w+',height='+h+',scrollbars=0,status=0, left='+left+', top='+top)}
function Insert_BBcode(bbcode,thisfield){
if(bbcode=='media'){
var videourl=prompt('Please enter a Google or YouTube Video URL.','')
if(videourl !=null&&videourl !=''){
document.myprofile.aboutme.value+='\n'+'[MEDIA=p:profile]'+videourl+'[/MEDIA]'
document.getElementById('vB_Editor_001_iframe').body.innerHTML='test'}
return false}
else{
return false}}
function showHide(elementid){
if(document.getElementById(elementid).style.display=='none'){
document.getElementById(elementid).style.display=''}
else{
document.getElementById(elementid).style.display='none'}}
function manshowHide(elementid,status){
if(status=='on'){
document.getElementById(elementid).style.display=''}
else if(status=='off'){
document.getElementById(elementid).style.display='none'}}
function confirmation(confirmtxt){
var answer=confirm(confirmtxt)
if(answer){
return true}
else{
return false}}