
function insert_m_code(code,i)
 {
 var p_text = new Array();
     p_text[0] = "Enter the text you want to Bold";
     p_text[1] = "Enter the Text you want to be in Italics";
     p_text[2] = "Enter the Text you want to Underline";
     p_text[4] = "Enter the path to your image";
     p_text[5] = "Enter your spoiler text";

 var d_ta = document.main_form.m_body.value;
 var d_t_c = window.prompt(p_text[i],"");
 if (d_t_c != null)
  {
  var d_t_new = d_ta + "[" + code + "]" + d_t_c + "[/" + code + "]";
  document.main_form.m_body.value = d_t_new;
  }
 document.main_form.m_body.focus();
 }

function check_rating(total,title)
 {
 var rating_pre = new Array();
     rating_pre[1] = 'a';
     rating_pre[2] = 'm';
     rating_pre[3] = 'd';

 var error_text = new Array();
     error_text[0] = "Please rate your Anticipation Review\n";
     error_text[1] = "Please rate your Movie Review\n";
     error_text[2] = "Please rate your DVD Review\n";

 var number = document.main_form.a_rating.selectedIndex;
 for (i=1;i<=total;i++)
  {
  if (i==1) {
   var number = document.main_form.a_rating.selectedIndex;
   var error_code = document.main_form.a_rating.options[number].value;
   var this_error_a = (error_code == "") ? "0" : "900";
  }
  if (i==2) {
   var number = document.main_form.m_rating.selectedIndex;
   var error_code = document.main_form.m_rating.options[number].value;
   var this_error_b = (error_code == "") ? "0" : "900";
  }
  if (i==3) {
  var number = document.main_form.d_rating.selectedIndex;
  var error_code = document.main_form.d_rating.options[number].value;
  var this_error_c = (error_code == "") ? "0" : "900";
  }
 }

var bob = Array(this_error_a,this_error_b,this_error_c);
var bob_l = bob.length;
for (j=0;j<bob_l;j++)
 {
 if (bob[j] == 0)
  {
  if (!al_text)
   {
   var al_text = error_text[j];
   }
   else
   {
   al_text += error_text[j];
   }
  }
 }
 
 if (al_text)
 {
 alert(al_text)
 return(false);
 }
 else
 {
 return(true);
 }
} 

function insert_d_code(code,i)
 {
 var p_text = new Array();
     p_text[0] = "Enter the text you want to Bold";
     p_text[1] = "Enter the Text you want to be in Italics";
     p_text[2] = "Enter the Text you want to Underline";
     p_text[4] = "Enter the path to your image";
     p_text[5] = "Enter your spoiler text";

 var d_ta = document.main_form.d_body.value;
 var d_t_c = window.prompt(p_text[i],"");
 if (d_t_c != null)
  {
  var d_t_new = d_ta + "[" + code + "]" + d_t_c + "[/" + code + "]";
  document.main_form.d_body.value = d_t_new;
  }
 document.main_form.d_body.focus();
 }

function insert_a_code(code,i)
 {
 var p_text = new Array();
     p_text[0] = "Enter the text you want to Bold";
     p_text[1] = "Enter the Text you want to be in Italics";
     p_text[2] = "Enter the Text you want to Underline";
     p_text[4] = "Enter the path to your image";
     p_text[5] = "Enter your spoiler text";

 var d_ta = document.main_form.a_body.value;
 var d_t_c = window.prompt(p_text[i],"");
 if (d_t_c != null)
  {
  var d_t_new = d_ta + "[" + code + "]" + d_t_c + "[/" + code + "]";
  document.main_form.a_body.value = d_t_new;
  }
 document.main_form.a_body.focus();
 }

function check_empty()
 {
 var topic_c = document.main_form.title.value;
  if (topic_c.length < 1)
   {
   alert("Please enter a Title");
   return(false);
   }
   else
   {
   return(true);
   }
 }

function verify_fields(max_val)
 {
 var has_title = check_empty();
 var is_ok = check_rating(max_val);

 if (has_title && is_ok)
  {
  document.main_form.submit();  
  }
 }
