﻿
tag_prompt = "أدخل النص ليكون بالشكل :";

link_text_prompt = "أدخل النص ليتم عرضها للربط (اختياري)";
link_url_prompt = "ادخل العنوان الكامل للوصله";
link_email_prompt = "ادخل عنوان البريد الالكتروني للوصله";
list_type_prompt = "ما هو نوع قائمة هل تريد؟ ادخل '1' لقائمة تعداد رقمي ، ادخل 'ا' لقائمة أبجدية ، أو أتركه فارغا لائحة النقاط.";
list_item_prompt = "ادخل قائمة البند. ترك الخانه فارغه او انقر 'الغاء' لاستكمال القائمة.";

tags = new Array();

function getarraysize(thearray) {
  for (i = 0; i < thearray.length; i++) {
    if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null)) {
      return i;
    }
  }
  return thearray.length;
}

function arraypush(thearray,value) {
  thearraysize = getarraysize(thearray);
  thearray[thearraysize] = value;
}

function arraypop(thearray) {
  thearraysize = getarraysize(thearray);
  retval = thearray[thearraysize - 1];
  delete thearray[thearraysize - 1];
  return retval;
}

function bbcode(theform,bbcode,prompttext) {
  inserttext = prompt(tag_prompt+"\n["+bbcode+"] *** [/"+bbcode+"]",prompttext);
  if ((inserttext != null) && (inserttext != "")) {
    formcomment.comm_details.value += "["+bbcode+"]"+inserttext+"[/"+bbcode+"] ";
    formcomment.comm_details.focus();
  }
}

function namedlink(theform,thetype) {
  linktext = prompt(link_text_prompt,"");
  var prompttext;
  if (thetype == "URL") {
    prompt_text = link_url_prompt;
    prompt_contents = "http://";
  }
  else {
    prompt_text = link_email_prompt;
    prompt_contents = "";
  }
  linkurl = prompt(prompt_text,prompt_contents);
  if ((linkurl != null) && (linkurl != "")) {
    if ((linktext != null) && (linktext != "")) {
      formcomment.comm_details.value += "["+thetype+"="+linkurl+"]"+linktext+"[/"+thetype+"] ";
    }
    else {
      formcomment.comm_details.value += "["+thetype+"]"+linkurl+"[/"+thetype+"] ";
    }
  }
  formcomment.comm_details.focus();
}

function dolist(theform) {
  listtype = prompt(list_type_prompt, "");
  if ((listtype == "a") || (listtype == "1")) {
    thelist = "[list="+listtype+"]\n";
    listend = "[/list="+listtype+"] ";
  }
  else {
    thelist = "[list]\n";
    listend = "[/list] ";
  }
  listentry = "initial";
  while ((listentry != "") && (listentry != null)) {
    listentry = prompt(list_item_prompt, "");
    if ((listentry != "") && (listentry != null)) {
      thelist = thelist+"[*]"+listentry+"[/*]\n";
    }
  }
  formcomment.comm_details.value += thelist+listend;
  formcomment.comm_details.focus();
}

function sm(x1) {
        document.form.comm_details.value = document.form.comm_details.value + x1;
}

function su_del(val) { 
	if (confirm(val))
	{
		return true;
	} else {
		return false;
	}
} 