var rcdc;

function paragraphStatus(paragraph, status, error)
{
	paragraph.innerHTML = "<br /><center" + (error ? " class=\"fftcolor fbweight\"" : "") + "><b>" + status + "</b></center><br />";
	return true;
}

function setParagraph(paragraph, paragraph_id, picture_id, content)
{
 if (content == "denied") return paragraphStatus(paragraph, "&#352;itas paveiksl&#279;lis priklauso ne Jums!", true);
 if (content == "notfound")
 {
  paragraphStatus(paragraph, "&#352;itas paveiksl&#279;lis buvo i&#353;trintas!", true);
  setTimeout("location.reload(true)", 2000);
  return true;
 }
 var ncon = PLT;

 var pvalues = content.split(":");
 var pviews = parseInt(pvalues[12]);

 if (pviews.toString().substr(pviews.toString().length - 2) == "11") pviews += " kart&#371;";
 else switch (pviews.toString()[pviews.toString().length - 1])
 {
  case "0":
   pviews += " kart&#371;";
   break;
  case "1":
   pviews += " kart&#261;";
   break;
  default:
   pviews += " kartus";
 }

 getElement("plitem" + paragraph_id.toString() + "5").innerHTML = pvalues[13];
 getElement("plitem" + paragraph_id.toString() + "4").innerHTML = pvalues[14];

 var original_name = "";
 for (var i = 0; i < pvalues[0].length; i += 25) original_name += ((original_name == "") ? "" : "-<br />") + pvalues[0].substr(i, 25);

 ncon = ncon.replace(/\[picture_id\]/gi, picture_id);
 ncon = ncon.replace(/\[picture_index\]/gi, paragraph_id);
 ncon = ncon.replace(/\[form_id\]/gi, "plform" + paragraph_id);
 ncon = ncon.replace(/\[link_row\]/gi, "plurls_" + picture_id);
 ncon = ncon.replace(/\[desc_link\]/gi, mURL("desc/" + picture_id + "/" + ((pvalues[10] == "") ? "" : pvalues[10] + "/")));
 ncon = ncon.replace(/\[thumb_location\]/gi, mURL("thumbs/" + picture_id + "/" + ((pvalues[10] == "") ? "" : pvalues[10] + "/")));
 ncon = ncon.replace(/\[original\]/gi, original_name);
 ncon = ncon.replace(/\[filesize\]/gi, pvalues[2]);
 ncon = ncon.replace(/\[bandwidth\]/gi, pvalues[3]);
 ncon = ncon.replace(/\[dimensions\]/gi, pvalues[4]);
 ncon = ncon.replace(/\[address\]/gi, pvalues[5]);
 ncon = ncon.replace(/\[added\]/gi, pvalues[6]);
 ncon = ncon.replace(/\[is_public\]/gi, ((pvalues[9] == "1") ? "ne" : "taip"));
 ncon = ncon.replace(/\[password\]/gi, pvalues[10]);
 ncon = ncon.replace(/\[description\]/gi, pvalues[11]);
 ncon = ncon.replace(/\[views\]/gi, pviews);
 ncon = ncon.replace(/\[link_desc\]/gi, mURL("desc/" + picture_id + "/" + ((pvalues[10] == "") ? "" : pvalues[10] + "/")));
 ncon = ncon.replace(/\[link_image\]/gi, mURL("images/" + picture_id + "/" + ((pvalues[10] == "") ? "" : pvalues[10] + "/")));
 ncon = ncon.replace(/\[link_bbit\]/gi, "[url=" + mURL("desc/" + picture_id + ((pvalues[10] == "") ? "" : "/" + pvalues[10])) + "][img]" + mURL("thumbs/" + ((pvalues[10] == "") ? "" : pvalues[10] + "/") + picture_id + "." + pvalues[1]) + "[/img][/url]");
 paragraph.innerHTML = ncon;

 var pform = (getElement("plform" + paragraph_id) ? getElement("plform" + paragraph_id) : document.forms["plform" + paragraph_id]);

 for (var i = 0; i < pform.elements["cat"].options.length; i++) if (pform.elements["cat"].options[i].value == pvalues[7]) pform.elements["cat"].selectedIndex = i;
 for (var i = 0; i < pform.elements["gal"].options.length; i++) if (pform.elements["gal"].options[i].value == pvalues[8]) pform.elements["gal"].selectedIndex = i;

 pform.elements["pub"].selectedIndex = pvalues[9];

 if (isFF)
 {
  if (!pform.elements["shadowbutt"].style) pform.elements["shadowbutt"].style = document.forms[formnum].elements["shadowbutt"];
  pform.elements["shadowbutt"].style.verticalAlign = -1;
 }

 if (isOP)
 {
  if (!pform.elements["shadowbutt"].style) pform.elements["shadowbutt"].style = document.forms[formnum].elements["shadowbutt"];
  pform.elements["shadowbutt"].style.paddingLeft = "4px";
 }
}


function fillParagraph(paragraph, paragraph_id, picture_id)
{
 paragraphStatus(paragraph, "Kuriama u&#382;klausa...", false);

 var AJAX = initializeAJAX();

 AJAX.onreadystatechange = function()
 {
  switch (AJAX.readyState)
  {
   case 1:
    paragraphStatus(paragraph, "Siun&#269;iama u&#382;klausa...", false);
    break;
   case 2:
    paragraphStatus(paragraph, "Vykdoma u&#382;klausa...", false);
    break;
   case 3:
    paragraphStatus(paragraph, "Gr&#261;&#382;inami u&#382;klausos rezultatai...", false);
    break;
   case 4:
    setParagraph(paragraph, paragraph_id, picture_id, AJAX.responseText);
    break;
  }
 }

 try
 {
  AJAX.open("GET", mURL("ajax/plinfo/" + picture_id), true);
  AJAX.send(null);
 }
 catch (e)
 {
  paragraphStatus(paragraph, "Pas Jus i&#353;jungtas AJAX!", true);
 }
}

function checkECAB(paragraph_id, collision)
{
 if (collision)
 {
  if (paragraph_id) eXpanded[paragraph_id] = "yes";

  if (ecALL.childNodes[0].childNodes[0].src == n_expand.src) ecALL.childNodes[0].childNodes[0].src = n_collapse.src;
 }
 else
 {
  if (paragraph_id) eXpanded[paragraph_id] = "no";

  if (ecALL.childNodes[0].childNodes[0].src == n_collapse.src)
  {
   var nExpand = true;

   for (var i = 0; i < eXpanded.length; i++) if (eXpanded[i] == "yes")
   {
    nExpand = false;
    break;
   }

   if (nExpand) ecALL.childNodes[0].childNodes[0].src = n_expand.src;
  }
 }
}

function invertParagraph(paragraph_id, picture_id)
{
 var pbutton, paragraph;

 pbutton = getElement("pltree" + paragraph_id);
 paragraph = getElement("plinfo" + paragraph_id);

 if ((pbutton == null) || (paragraph == null)) return false;

 var AJAX = initializeAJAX();

 if (pbutton.src == n_collapse.src)
 {
  cssHide(paragraph.parentNode);
  pbutton.src = n_expand.src;

  if (ecALL) checkECAB(paragraph_id, false);
 }
 else
 {
  cssShow(paragraph.parentNode);
  pbutton.src = n_collapse.src;

  if (ecALL) checkECAB(paragraph_id, true);

  if (!paragraph.innerHTML.match(/pid/i))
  {
   if (AJAX != null)
   {
    if (!PLT)
   	{
     paragraphStatus(paragraph, "Kuriama u&#382;klausa...", false);
     AJAX.onreadystatechange = function()
     {
      switch (AJAX.readyState)
      {
       case 1:
        paragraphStatus(paragraph, "Siun&#269;iama u&#382;klausa...", false);
        break;
       case 2:
        paragraphStatus(paragraph, "Vykdoma u&#382;klausa...", false);
        break;
       case 3:
        paragraphStatus(paragraph, "Gr&#261;&#382;inamas &#353;ablonas...", false);
        break;
       case 4:
        PLT = AJAX.responseText;
        fillParagraph(paragraph, paragraph_id, picture_id);
        break;
      }
     }

     try
     {
      AJAX.open("GET", mURL("ajax/plinfo/"), true);
      AJAX.send(null);
     }
     catch (e)
     {
      paragraphStatus(paragraph, "Pas Jus i&#353;jungtas AJAX!!", true);
      return true;
     }
    }
    else fillParagraph(paragraph, paragraph_id, picture_id);
   }
   else
   {
    if (!noAJAX) paragraphStatus(paragraph, "J&#363;s&#371; nar&#353;ykl&#279; nepalaiko AJAX!<br />J&#363;s tuoj b&#363;site perkelti &#303; kit&#261; puslap&#303;.", true);
    setTimeout("location.href = '" + mURL("desc/" + picture_id + "/") + "'", (noAJAX ? 100 : 3000));
    noAJAX = true;
   }
  }
 }

 return true;
}

function shadowPassword(form_button, password_field, input_field)
{
 var shadow = !cssHidden(input_field);

 if (shadow) cssHide(input_field);
 else cssShow(input_field);

 if (shadow) cssShow(password_field);
 else cssHide(password_field);

 form_button.innerHTML = (shadow ? "*" : "T");

 return true;
}

function submitPChange(form_id, form_index)
{
	var dholder, but_update, but_genurl, but_remove;

	if (!(dholder = (document.forms[form_id] ? document.forms[form_id] : getElement(form_id)))) return false;

	var post_data = "pid=" + encodeURIComponent(dholder.elements["pid"].value) + "&cat=" + encodeURIComponent(dholder.elements["cat"].value) + "&gal=" + encodeURIComponent(dholder.elements["gal"].value) + "&pub=" + encodeURIComponent(dholder.elements["pub"].value) + "&tag=" + encodeURIComponent(dholder.elements["tag"].value) + "&shadow=" + encodeURIComponent(dholder.elements["shadow"].value);
	var AJAX = initializeAJAX();

	if (but_update = dholder.elements["butt_update"])
	{
		but_update.innerHTML = "Palaukite..";
		but_update.disabled = true;
		but_update.blur();
	}

	if (but_genurl = dholder.elements["butt_genurl"]) but_genurl.disabled = true;
	if (but_remove = dholder.elements["butt_remove"]) but_remove.disabled = true;

	dholder.action = mURL("ajax/plchange/" + pl_page_number + ":" + pl_item_count + "/");

	if (AJAX != null)
	{
		AJAX.onreadystatechange = function()
		{
			if (AJAX.readyState == 4)
			{
				if (!AJAX.responseText.match(/String\.fromCharCode/))
				{
					var picture_id = dholder.elements["pid"].value;
					invertParagraph(form_index, picture_id);
					var pholder = dholder.parentNode.parentNode.parentNode.parentNode.parentNode;
					while (pholder.hasChildNodes())	pholder.removeChild(pholder.firstChild);
					return !invertParagraph(form_index, picture_id);
				}

				alert(String.fromCharCode(302, 118, 121, 107, 111, 32, 107, 108, 97, 105, 100, 97, 32, 107, 101, 105, 269, 105, 97, 110, 116, 32, 112, 97, 118, 101, 105, 107, 115, 108, 279, 108, 105, 111, 32, 100, 117, 111, 109, 101, 110, 105, 115, 33));
				location.reload(true);
				return true;
			}
		}

		try
		{
			if (AJAX.overrideMimeType) AJAX.overrideMimeType("text/html");
			AJAX.open("POST", dholder.action, true);
			AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			AJAX.setRequestHeader("Content-length", post_data.length);
			AJAX.setRequestHeader("Connection", "close");
			AJAX.send(post_data);
		}
		catch (e)
		{
			dholder.submit();
		}
	}
	else dholder.submit();

	return true;
}

function generateURL(picture_id, ubutton)
{
	var row, eholder;

	if (ubutton) ubutton.blur();

	if (!(row = getElement("plurls_" + picture_id))) return false;

	cssShow(row);
	return true;
}

function confirmRemoval(picture_id, picture_index, data_form, button_td)
{
 if (confirm(String.fromCharCode(65, 114, 32, 116, 105, 107, 114, 97, 105, 32, 110, 111, 114, 105, 116, 101, 32, 112, 97, 353, 97, 108, 105, 110, 116, 105, 32, 353, 303, 32, 112, 97, 118, 101, 105, 107, 115, 108, 279, 108, 303, 32, 105, 353, 32, 116, 97, 108, 112, 121, 107, 108, 111, 115, 63)))
 {
 	var but_update;
 	var but_genurl;
 	var but_remove;

  if (data_form != null)
  {
   if (but_update = data_form.elements["butt_update"]) but_update.disabled = true;
   if (but_genurl = data_form.elements["butt_genurl"]) but_genurl.disabled = true;
   if (but_remove = data_form.elements["butt_remove"])
   {
    but_remove.innerHTML = "Palaukite..";
    but_remove.blur();
    but_remove.disabled = true;
   }
  }

  if (button_td != null)
  {
  	while (button_td.firstChild) button_td.removeChild(button_td.firstChild);
  	button_td.innerHTML = "Trinama...";
  }

  var AJAX = initializeAJAX();

  if (AJAX != null)
  {
   AJAX.onreadystatechange = function()
   {
    if (AJAX.readyState == 4)
    {
     if (AJAX.responseText.match(/String\.fromCharCode/)) alert(String.fromCharCode(302, 118, 121, 107, 111, 32, 107, 108, 97, 105, 100, 97, 32, 116, 114, 105, 110, 97, 110, 116, 32, 112, 97, 118, 101, 105, 107, 115, 108, 279, 108, 303, 33));

 	   removeElement(getElement("plword" + picture_index));
 	   removeElement(getElement("plinfo" + picture_index).parentNode);

 	   eXpanded.splice(picture_index, 1);
 	   if (getElement("pltree" + picture_index).src == n_collapse.src) invertParagraph(picture_index, picture_id);
 	   checkECAB(null, false);

     getElement("picture_count").value = (parseInt(getElement("picture_count").value) - 1);

     if (AJAX.responseText.match(/String\.fromCharCode/) || (parseInt(getElement("picture_count").value) < 1)) location.reload(true);

     return true;
    }
   }

   try
   {
    AJAX.open("GET", mURL("ajax/plremove/" + picture_id + "/" + pl_page_number + ":" + pl_item_count + "/"), true);
    AJAX.send(null);
   }
   catch (e)
   {
    location.href = mURL("ajax/plremove/" + picture_id + "/" + pl_page_number + ":" + pl_item_count + "/");
   }
  }
  else location.href = mURL("ajax/plremove/" + picture_id + "/" + pl_page_number + ":" + pl_item_count + "/");
 }
 return true;
}

function PLItemCount(selectbox, pagenum)
{
	location.href = mURL("my/images/items:" + selectbox.options[selectbox.selectedIndex].innerHTML + "/page:" + pagenum + "/");
	return false;
}

function PLPageNumber(selectbox, itemcount)
{
	location.href = mURL("my/images/items:" + itemcount + "/page:" + selectbox.options[selectbox.selectedIndex].innerHTML + "/");
	return false;
}

function ExCoALL(ecbutt)
{
	if (!ecbutt) return;

	var _eca_max = getElement("plicnt").value;
	var _eca_itm;

	if (ecbutt.src == n_expand.src) for (var i = 1; i <= _eca_max; i++)
	{
		if ((_eca_itm = getElement("pltree" + i)) && (getElement("pltree" + i).src == n_expand.src)) getElement("pltree" + i).onclick();
	}
	else for (var i = 1; i <= _eca_max; i++)
	{
		if ((_eca_itm = getElement("pltree" + i)) && (getElement("pltree" + i).src == n_collapse.src)) getElement("pltree" + i).onclick();
	}

	return true;
}

function addUField(parentObj)
{
	if (!parentObj) return;

	var image_index, image_limit, ambutt, elem_tr, elem_td, elem_input, elem_a, elem_img, elem_select, elem_button;

	for (image_index = 1; document.forms["uploadform"].elements["up_image" + image_index]; image_index++);

	image_limit = parseInt(document.forms["uploadform"].elements["MAX_FILE_COUNT"].value);

	if (image_index > image_limit) return false;

	elem_td = (elem_tr = document.createElement("tr")).appendChild(document.createElement("td"));

	elem_tr.id = "ufbox" + image_index + "_1";

	elem_td.className = "slpad wtpad wbpad wlboard wtboard wbboard fwtcolor fzbcolor tralign vmalign";
	elem_td.innerHTML = "Paveiksl&#279;lis:";

	elem_td = elem_tr.appendChild(document.createElement("td"));
	elem_td.colSpan = 2;
	elem_td.className = "slpad srpad wtpad wbpad wtboard wbboard wrboard fwtcolor fzbcolor tcalign vmalign";

	elem_input = document.createElement("input");
	elem_input.className = "small wfboard";
	elem_input.type = "file";
	elem_input.name = "up_image" + image_index;
	elem_input.id = "up_image" + image_index;
	elem_input.size = 45;
	elem_td.appendChild(elem_input);

	elem_td = elem_tr.appendChild(document.createElement("td"));
	elem_td.className = "slpad srpad wtpad wbpad wfboard fwtcolor fzbcolor tcalign vmalign";

	elem_a = elem_td.appendChild(document.createElement("a"));
	elem_a.href = "#";
	elem_a.onclick = new Function("var ufElem; for (var i = 1; ufElem = getElement('ufbox" + image_index + "_' + i); i++) ufElem.parentNode.removeChild(ufElem); return false");

	elem_img = document.createElement("img");
	elem_img.className = "fouwidth foheight";
	elem_img.src = theme_image_dir + "remove.gif";
	elem_img.alt = String.fromCharCode(80, 97, 353, 97, 108, 105, 110, 116, 105, 32, 303, 114, 97, 353, 261); //"Pa&#353;alinti &#303;ra&#353;&#261;";
	elem_img.title = String.fromCharCode(80, 97, 353, 97, 108, 105, 110, 116, 105, 32, 303, 114, 97, 353, 261);
	elem_a.appendChild(elem_img);

	parentObj.appendChild(elem_tr);

	(elem_tr = document.createElement("tr")).appendChild(document.createElement("td"));

	elem_tr.id = "ufbox" + image_index + "_2";

	elem_td = elem_tr.appendChild(document.createElement("td"));
	elem_td.className = "small dlboard drboard";
	elem_td.colSpan = 2;
	elem_td.innerHTML = "&nbsp;";

	elem_tr.appendChild(document.createElement("td"));

	parentObj.appendChild(elem_tr);

	(elem_tr = document.createElement("tr")).appendChild(document.createElement("td"));

	elem_tr.id = "ufbox" + image_index + "_3";

	elem_td = elem_tr.appendChild(document.createElement("td"));

	elem_td.className = "tralign dlboard tlpad";
	elem_td.innerHTML = "Kategorija:";

	elem_td = elem_tr.appendChild(document.createElement("td"));

	elem_td.className = "tlalign drboard slpad trpad";
	elem_select = elem_td.appendChild(getElement("select_categories").cloneNode(true));
	elem_select.id = null;
	elem_select.name = "up_category" + image_index;

	elem_tr.appendChild(document.createElement("td"));

	parentObj.appendChild(elem_tr);

	(elem_tr = document.createElement("tr")).appendChild(document.createElement("td"));

	elem_tr.id = "ufbox" + image_index + "_4";

	elem_td = elem_tr.appendChild(document.createElement("td"));

	elem_td.className = "tralign dlboard tlpad";
	elem_td.innerHTML = "Galerija:";

	elem_td = elem_tr.appendChild(document.createElement("td"));

	elem_td.className = "tlalign drboard slpad trpad";
	elem_select = elem_td.appendChild(getElement("select_galleries").cloneNode(true));
	elem_select.id = null;
	elem_select.name = "up_gallery" + image_index;

	elem_tr.appendChild(document.createElement("td"));

	parentObj.appendChild(elem_tr);

	(elem_tr = document.createElement("tr")).appendChild(document.createElement("td"));

	elem_tr.id = "ufbox" + image_index + "_5";

	elem_td = elem_tr.appendChild(document.createElement("td"));

	elem_td.className = "tralign dlboard tlpad";
	elem_td.innerHTML = "Vie&#353;inimas:";

	elem_td = elem_tr.appendChild(document.createElement("td"));

	elem_td.className = "tlalign drboard slpad trpad";
	elem_select = elem_td.appendChild(getElement("select_publicity").cloneNode(true));
	elem_select.id = null;
	elem_select.name = "up_publicity" + image_index;

	elem_tr.appendChild(document.createElement("td"));

	parentObj.appendChild(elem_tr);

	(elem_tr = document.createElement("tr")).appendChild(document.createElement("td"));

	elem_tr.id = "ufbox" + image_index + "_6";

	elem_td = elem_tr.appendChild(document.createElement("td"));

	elem_td.className = "tralign dlboard tlpad";
	elem_td.innerHTML = "Apra&#353;ymas:";

	elem_td = elem_tr.appendChild(document.createElement("td"));

	elem_td.className = "tlalign drboard slpad trpad";

	elem_input = document.createElement("input");
	elem_input.className = "small bfboard fsbcolor pliwidth";
	elem_input.type = "text";
	elem_input.name = "up_tag" + image_index;
	elem_input.maxLength = 128;
	elem_input.value = "";
	elem_td.appendChild(elem_input);

	elem_tr.appendChild(document.createElement("td"));

	parentObj.appendChild(elem_tr);

	(elem_tr = document.createElement("tr")).appendChild(document.createElement("td"));

	elem_tr.id = "ufbox" + image_index + "_7";

	elem_td = elem_tr.appendChild(document.createElement("td"));

	elem_td.className = "tralign dlboard tlpad";
	elem_td.innerHTML = "Slapta&#382;odis:";

	elem_td = elem_tr.appendChild(document.createElement("td"));
	elem_td.className = "tlalign drboard slpad trpad";

	elem_input = document.createElement("input");
	elem_input.className = "small fsbcolor bfboard nrboard plpwidth";
	elem_input.type = "text";
	elem_input.id = "up_password" + image_index;
	elem_input.onchange = new Function("getElement('up_shadow" + image_index + "').value = this.value");
	//elem_input.autocomplete = "off";
	elem_input.setAttribute("autocomplete", "off");	// FireFox compilant!
	elem_input.value = "";
	elem_td.appendChild(elem_input);
	cssHide(elem_input);

	elem_input = document.createElement("input");
	elem_input.className = "small fsbcolor bfboard nrboard plpwidth";
	elem_input.type = "password";
	elem_input.name = "up_shadow" + image_index;
	elem_input.id = "up_shadow" + image_index;
	elem_input.onchange = new Function("getElement('up_password" + image_index + "').value = this.value");
	//elem_input.autocomplete = "off";
	elem_input.setAttribute("autocomplete", "off"); 
	elem_input.value = "";
	elem_td.appendChild(elem_input);

	elem_button = document.createElement("button");
	elem_button.className = "small bfboard plswidth plsheight" + (isFF ? " voalign" : "") + (isOP ? " rlpad" : "");
	elem_button.onfocus = new Function("this.blur()");
	elem_button.onclick = new Function("shadowPassword(this, getElement('up_shadow" + image_index + "'), getElement('up_password" + image_index + "')); return false");
	elem_button.innerHTML = "*";
	elem_td.appendChild(elem_button);

	elem_tr.appendChild(document.createElement("td"));

	parentObj.appendChild(elem_tr);

	(elem_tr = document.createElement("tr")).appendChild(document.createElement("td"));

	elem_tr.id = "ufbox" + image_index + "_8";

	elem_td = elem_tr.appendChild(document.createElement("td"));
	elem_td.className = "small dlboard dbboard drboard";
	elem_td.colSpan = 2;
	elem_td.innerHTML = "&nbsp;";

	parentObj.appendChild(elem_tr);

	elem_td = (elem_tr = document.createElement("tr")).appendChild(elem_tr = document.createElement("td"));

	elem_tr.id = "ufbox" + image_index + "_9";

	elem_td.colSpan = 3;
	elem_td.innerHTML = "&nbsp;";

	parentObj.appendChild(elem_tr);

	if ((image_index == image_limit) && (ambutt = getElement("amorebutt"))) cssHide(ambutt);

	return true;
}

function resizeImage(image_id)
{
	var targetImage, rsTag, osTag;

	if (targetImage = getElement("image_" + image_id))
	{
		rsTag = getElement("rsitag_" + image_id);
		//osTag = getElement("ositag_" + image_id);

		if (targetImage.className.match(/ssewidth/))
		{
			targetImage.className = targetImage.className.replace(/ssewidth/, "");
			//osTag.className = osTag.className.replace(/smxwidth/, "");
			rsTag.className = rsTag.className.replace(/ssewidth/, "");
			//cssShow(osTag);
			cssHide(rsTag);
		}
		else
		{
			targetImage.className = targetImage.className.replace(/ssewidth/, "") + " ssewidth";
			//osTag.className = osTag.className.replace(/smxwidth/, "") + " smxwidth";
			rsTag.className = rsTag.className.replace(/ssewidth/, "") + " ssewidth";
			cssShow(rsTag);
			//cssHide(osTag);
		}

		return true;
	}
	else return false;
}

function rcdUpdate()
{
	var dd, dh, dm = Math.ceil(((new Date(2008, 5, 1).getTime()) - (new Date().getTime())) / 60000); //06.01, min.

	if (dm < 1)
	{
		cssHide(rcdc);
		return;
	}

	dm -= ((dd = Math.floor(dm / 1440)) * 1440);
	dm -= ((dh = Math.floor(dm / 60)) * 60);

	rcdc.innerHTML = " (u&#382; " + ((dd > 0) ? (dd + " d. ") : "") + ((dh > 0) ? (" " + dh + " val.") : "") + ((dm > 0) ? (" " + dm + " min.") : "") + ")";

	setTimeout("rcdUpdate()", 1000);
}

function bodyLoaded()
{
	if (rcdc = getElement("remcont"))
	{
		//cssShow(rcdc);
		rcdUpdate();
	}

	if (ecALL = getElement("ecall"))
	{
		ecALL.className = "tlpad trpad tcalign vmalign wfboard fzbcolor";
		ecALL.innerHTML = "<a href=\"#\" onClick=\"this.blur(); ExCoALL(this.childNodes[0]); return false\"><img src=\"" + theme_image_dir + "expand.gif\" class=\"elewidth elheight\"></a>";
	}

	var colelem, gbelem, txelems, elindex, emlength;

	for (var i = 1; getElement("plitem" + i.toString() + "1"); i++)
	{
		for (var i2 = 1; colelem = getElement("plitem" + i.toString() + i2.toString()); i2++)
		{
			colelem.onmouseover = new Function("for (var i = 1; colelem = (document.getElementById ? document.getElementById('plitem" + i + "' + i) : (document.all ? document.all['plitem" + i + "' + i] : ((typeof(eval) != 'undefined') ? eval('plitem" + i + "' + i) : null))); i++) colelem.className = colelem.className.replace(/dcbcolor/, 'atbcolor')");
			colelem.onmouseout = new Function("for (var i = 1; colelem = (document.getElementById ? document.getElementById('plitem" + i + "' + i) : (document.all ? document.all['plitem" + i + "' + i] : ((typeof(eval) != 'undefined') ? eval('plitem" + i + "' + i) : null))); i++) colelem.className = colelem.className.replace(/atbcolor/, 'dcbcolor')");
		}
	}

	for (var i = 1; gbelem = getElement("gblock_" + i.toString()); i++)
	{
		gbelem.onmouseover = new Function("while (this.className.indexOf('  ') != -1) this.className = this.className.replace(/  /, ' '); this.className = this.className.replace(/efbcolor/, '') + ' efbcolor';");
		gbelem.onmouseout = new Function("while (this.className.indexOf('  ') != -1) this.className = this.className.replace(/  /, ' '); this.className = this.className.replace(/efbcolor/, '')");
	}

	txelems = document.getElementsByTagName("textarea");
	for (elindex = 0; elindex < txelems.length; elindex++)
	{
		if (emlength = txelems[elindex].getAttribute("maxlength"))
		{
			txelems[elindex].onkeypress = new Function("event_data", "if (window.event) event_data = event; return ((this.value.length < " + emlength + ") || ((event_data.keyCode ? event_data.keyCode : event_data.which) < 32) || event_data.ctrlKey || (this.value.substring(this.selectionStart, this.selectionEnd).length > 0))");
			txelems[elindex].onkeyup = new Function("this.value = this.value.substr(0, " + emlength + ")");
			txelems[elindex].onblur = new Function("this.selectionStart = (this.selectionEnd = 0)");
		}
	}

	if (location.href.match(new RegExp(mURL("upload") + "/?")))
	{
		var uFHolder = getElement("uFHolder");
		var ambutt;

		if (uFHolder)
		{
			while (uFHolder.firstChild) uFHolder.removeChild(uFHolder.firstChild);

			if ((parseInt(document.forms["uploadform"].elements["MAX_FILE_COUNT"].value) == 1) && (ambutt = getElement("amorebutt"))) cssHide(ambutt);

			addUField(uFHolder);
			uFHolder.className = "";
		}
	}

//	FixPNG(getElement("hlogo"));

	var images = document.getElementsByTagName("img");
	for (var i = 0; i < images.length; i++) if (images[i].src.indexOf(".png") != -1) FixPNG(images[i]);
}

if (document.images)
{
	var n_collapse = new Image(11, 11);
	var n_expand = new Image(11, 11);

	n_collapse.src = theme_image_dir + "collapse.gif";
	n_expand.src = theme_image_dir + "expand.gif";
}
