var http,constRemove

var theFiles = new Array();

var theFolders = new Array();

var userIDs = new Array();
var userNames = new Array();

var popstart,maxitems

var box_checked=Array();
var isSelectallUsers=false;

var timeout;

if (!Array.prototype.indexOf)
{
  Array.prototype.indexOf = function(elt /*, from*/)
  {
    var len = this.length;

    var from = Number(arguments[1]) || 0;
    from = (from < 0)
         ? Math.ceil(from)
         : Math.floor(from);
    if (from < 0)
      from += len;

    for (; from < len; from++)
    {
      if (from in this &&
          this[from] === elt)
        return from;
    }
    return -1;
  };
}


function strrev(str)
{
   if (!str) return '';
   var revstr='';
   for (h = str.length-1; h>=0; h--)
       revstr+=str.charAt(h)
   return revstr;
}

function GetSelectedFiles()
{
    var arr1=document.getElementsByTagName('input');
    var arr2=Array();
	for( var x = 0; x<arr1.length; x++ ){
	    if (arr1[x].name=='selfiles[]' && arr1[x].checked){
	        arr2.push(arr1[x]);
	    }
	}
   return arr2;
}
function GetAllFiles()
{
    var arr1=document.getElementsByTagName('input');
    var arr2=Array();
	for( var x = 0; x<arr1.length; x++ ){
	    if (arr1[x].name=='selfiles[]'){
	        arr2.push(arr1[x]);
	    }
	}
   return arr2;
}

function GetSelectedFilesId()
{
	file_ids=Array();
	arr=GetSelectedFiles();
	for (i = 0; i < arr.length; i++)
			if ( arr[i].checked == true &&  arr[i].getAttribute('brief_type')!='folder'){
				file_ids.push( arr[i].value);
			}
	return file_ids;

}

function GetSelectedFolders()
{
	file_ids=Array();
	arr=GetSelectedFiles();
	for (i = 0; i < arr.length; i++)
			if ( arr[i].checked == true &&  arr[i].getAttribute('brief_type')=='folder')
				file_ids.push( arr[i].value);
	return file_ids;
}


function getPageSize(){

	var xScroll, yScroll;

	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	return arrayPageSize;
}

function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll)
	return arrayPageScroll;
}
function HideUserList()
{
    isSelectallUsers=false;
	if (document.getElementById("popup_userlist"))
	{
		document.getElementsByTagName("BODY")[0].removeChild(document.getElementById("popup_userlist"));
	}
}
function GroupList(nrfiles)
{
	if(nrfiles==1)
	{
		xajax_jax_GetGroupList(0,arr[0].value,1);
	}
	else
	{
		xajax_jax_GetGroupList(0,-1,1);
	}

}
function UserList(nrfiles)
{
	if(nrfiles==1)
	{
		xajax_jax_GetUserList(0,arr[0].value,1);
	}
	else
	{
		xajax_jax_GetUserList(0,-1,1);
	}

}
function changeTabs(tab)
{
	document.getElementById("userlist").innerHtml='';
	if(tab == 'groups')
	{

		arr=GetSelectedFiles();
		count=arr.length;

	    if(count>0)
		{
			ShowUserList(tab);
			GroupList(count)
		}
		else
		{
			if(count == 0)
				alert(JS_ERROR_NOFILES)
		}

	}
	else
	{

		arr=GetSelectedFiles();
		count=arr.length;

	    if(count>0)
		{
			ShowUserList(tab);
			UserList(count)
		}
		else
		{
			if(count == 0)
				alert(JS_ERROR_NOFILES)
		}

	}

}


function ShowUserList(tab)
{
	//arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
	//arrayPageScroll = new Array('',yScroll)
	var pageSize = getPageSize();
	var pageScroll = getPageScroll();
	var popupTop = pageScroll[1] + (pageSize[3] / 3);
	var popupLeft = (pageSize[2]/2.5);

	var currentTime = new Date()
	var month = currentTime.getMonth() + 1
	var day = currentTime.getDate()
	var year = currentTime.getFullYear()

	var elDiv = document.createElement("DIV");
	HideUserList();
	elDiv.style.top = popupTop +'px';
	elDiv.style.left = popupLeft +'px';
	elDiv.id = "popup_userlist";

	elDiv.innerHTML = '<input class="button" type="button" style="cursor:move; " value="Drag!" onmousedown="dragStart(event, \'popup_userlist\')" />';
  elDiv.innerHTML +='<br/>'+ BRIEF_WORD_4_SHARE_UNTIL+':&nbsp;'+
        '<input class="inputbox" type="text" name="timelimit" id="timelimit" size="10" maxlength="19" value="">'+
    	'<input type="reset" class="button" value="..." onClick="return showCalendar(\'timelimit\', \'y-mm-dd\');">';

	if (BRIEF_JACL_INTEGRATION == '1')
	{
	  if (BRIEF_JACL_SHARELEVEL == 'both')
	  {
      elDiv.innerHTML +='<br><input class="button" type="button" onclick="changeTabs(\'users\')" value="'+BRIEF_WORD_4_USERS+'"/>&nbsp;&nbsp;&nbsp;&nbsp;';
      elDiv.innerHTML +='<input class="button" type="button" onclick="changeTabs(\'groups\')" value="'+BRIEF_WORD_4_GROUPS+'"/>';

      if (tab == undefined)
	    {
  	    tab = 'users';
	    }
	  }
	  else
	  {
	    if (tab == undefined)
	    {
  	    tab = BRIEF_JACL_SHARELEVEL + 's';
	    }
	  }
  }

	elDiv.innerHTML +=  '<div id="userlist" style="display:block">'
							+'<img align="center" src="/components/com_brief/processing.gif">'
						+'</div>';

  elDiv.innerHTML += '<label for="quick_search" style="margin-right: 10px;">' + LANG_QUICK_SEARCH + ':</label>';
  elDiv.innerHTML += '<input type="text" id="quick_search" name="quick_search" onkeyup=\'javascript: QuickSearch(this.value, "' + tab + '"); \' />';
  elDiv.innerHTML += '<img style="margin-right: 5px; display: none;" src="' + JURI_ROOT + 'components/com_brief/icons/ajax-loader.gif" id="ajax-loader" />';

	if (BRIEF_JACL_INTEGRATION=='1')
	{
	    if(BRIEF_JACL_SHARELEVEL=='both'){
        	if(tab == "groups")
		      elDiv.innerHTML +='<br/><br/><input id="sharebutton" type="button" class="button" onClick="doShare('+"'groups'"+')" value="'+LANG_SHARED+'" disabled/> ';
	        else
		      elDiv.innerHTML +='<br/><br/><input id="sharebutton" type="button" class="button" onClick="doShare('+"'users'"+')" value="'+LANG_SHARED+'" disabled/> ';
	    }
	    if(BRIEF_JACL_SHARELEVEL=='group'){
	      elDiv.innerHTML +='<br/><br/><input id="sharebutton" type="button" class="button" onClick="doShare('+"'groups'"+')" value="'+LANG_SHARED+'" disabled/> ';
	    }
	    if(BRIEF_JACL_SHARELEVEL=='user'){
	      elDiv.innerHTML +='<br/><br/><input id="sharebutton" type="button" class="button" onClick="doShare('+"'users'"+')" value="'+LANG_SHARED+'" disabled/> ';
	    }
	}
	else
	{
    elDiv.innerHTML +='<br/><br/><input id="sharebutton" type="button" class="button" onClick="doShare('+"'users'"+')" value="'+LANG_SHARED+'" disabled/> ';
	}

	elDiv.innerHTML += '<input type="button" class="button" value="'+LANG_UNSHARE_ALL+'" onClick="unshareAllUsers();"/>';
	elDiv.innerHTML += '<input type="button" class="button" value="'+LANG_CANCEL+'" onClick="this.parentNode.parentNode.removeChild(this.parentNode);"/>';
    elDiv.innerHTML += '<!--[if lte IE 6.5]><iframe></iframe><![endif]-->';
	document.getElementsByTagName("BODY")[0].appendChild(elDiv);
}

function QuickSearch(keyword, tab)
{
  switch (tab)
  {
    case 'users':
      SearchUserList(keyword);
    break;

    case 'groups':
      SearchGroupList(keyword);
    break;
  }
}

function SearchUserList(keyword)
{
  clearTimeout(timeout);
  timeout = setTimeout("xajax_jax_GetUserList('0', '0', '', '" + keyword + "')", 500);

  document.getElementById('ajax-loader').style.display = 'inline';
}

function SearchGroupList(keyword)
{
  clearTimeout(timeout);
  timeout = setTimeout("xajax_jax_GetGroupList('0', '0', '', '" + keyword + "')", 500);

  document.getElementById('ajax-loader').style.display = 'inline';
}

function ShowGroupUsers(){
	//var pageSize = getPageSize();
//	var pageScroll = getPageScroll();
//	var popupTop = pageScroll[1] + (pageSize[3] / 2);
//	var popupLeft = (pageSize[2]/2.5);
//
//	HideGroupUsers();
//
//	var elDiv = document.createElement("DIV");
//
//	//elDiv.style.top = popupTop +'px';
//	//elDiv.style.left = popupLeft +'px';
//	elDiv.style.top = '100px';
//	elDiv.style.left = '100px';
//	elDiv.id = "popup_group_users";
//	elDiv.innerHTML = '<input class="button" type="button" style="cursor:move; float:right; " value="Drag!" onmousedown="dragStart(event, \'popup_group_users\')" />';
//	document.getElementsByTagName("BODY")[0].appendChild(elDiv);
}
function HideGroupUsers(){
	if (document.getElementById("popup_group_users"))
	{
		document.getElementsByTagName("BODY")[0].removeChild(document.getElementById("popup_userlist"));
	}
}

function ShowMakeFolderDiv() {
	var pageSize = getPageSize();
	var pageScroll = getPageScroll();
	var popupTop = pageScroll[1] + (pageSize[3] / 2);
	var popupLeft = (pageSize[2]/2.5);

	var elDiv = document.createElement("DIV");
	HideUserList();
	elDiv.style.top = popupTop +'px';
	elDiv.style.left = popupLeft +'px';
	elDiv.id = "popup_userlist";
	elDiv.innerHTML = '<input class="button" type="button" style="cursor:move; float:right; " value="Drag!" onmousedown="dragStart(event, \'popup_userlist\')" />';
	elDiv.innerHTML += '<input  class="button"  name="newfolder" id="newfolder" type="text" value="" size="20" maxlength="255"  /><br>';
	elDiv.innerHTML += '<input type="button" class="button" value="'+MAKEFOLDER+'" onClick="makeFolder();"/>';
	elDiv.innerHTML += '<input type="button" class="button" value="'+LANG_CANCEL+'" onClick="this.parentNode.parentNode.removeChild(this.parentNode);"/>';
	document.getElementsByTagName("BODY")[0].appendChild(elDiv);
}

function ShowModifyDescriptionDiv()
{
	var pageSize = getPageSize();
	var pageScroll = getPageScroll();
	var popupTop = pageScroll[1] + (pageSize[3] / 2);
	var popupLeft = (pageSize[2]/2.5);
	var elDiv = document.createElement("DIV");
	HideUserList();
	elDiv.style.top = popupTop +'px';
	elDiv.style.left = popupLeft +'px';
	elDiv.id = "popup_userlist";
	elDiv.innerHTML = '<input class="button" type="button" style="cursor:move; float:right; " value="Drag!" onmousedown="dragStart(event, \'popup_userlist\')" />';
	elDiv.innerHTML +=  '<input  class="button" id="modifydesc" type="text" value="" size="20" maxlength="255"  /><br>';
	elDiv.innerHTML += '<input type="button" class="button" value="'+BRIEF_MODIFY_DESCRIPTION+'" onClick="modifyDescription();"/>';
	elDiv.innerHTML += '<input type="button" class="button" value="'+LANG_CANCEL+'" onClick="this.parentNode.parentNode.removeChild(this.parentNode);"/>';
	document.getElementsByTagName("BODY")[0].appendChild(elDiv);
}
function ShowPricesDiv()
{
	var pageSize = getPageSize();
	var pageScroll = getPageScroll();
	var popupTop = pageScroll[1] + (pageSize[3] / 2);
	var popupLeft = (pageSize[2]/2.5);
	var elDiv = document.createElement("DIV");
	HideUserList();
	elDiv.style.top = popupTop +'px';
	elDiv.style.left = popupLeft +'px';
	elDiv.id = "popup_userlist";
	elDiv.innerHTML = '<input class="button" type="button" style="cursor:move; float:right; " value="Drag!" onmousedown="dragStart(event, \'popup_userlist\')" />';
	elDiv.innerHTML +=  '<input  class="button" id="modifyvodes" type="text" value="" size="2" /><br>';
	elDiv.innerHTML += '<input type="button" class="button" value="'+BRIEF_SET_PRICE_VODES+'" onClick="modifyVodes();"/>';
	elDiv.innerHTML += '<input type="button" class="button" value="'+LANG_CANCEL+'" onClick="this.parentNode.parentNode.removeChild(this.parentNode);"/>';
	document.getElementsByTagName("BODY")[0].appendChild(elDiv);
}

function doShare(option)
{
    if (isSelectallUsers)
    	box_checked.push(-1);

    var timelimit = document.getElementById("timelimit")

    if (option == "users")
    {
    	//alert(box_checked);
		xajax_jax_ShareToUsers( GetSelectedFolders(),GetSelectedFilesId(),box_checked,timelimit.value);
    }
    else if (option == "groups")
    {
    	//alert(box_checked);
    	xajax_jax_ShareToGroups( GetSelectedFolders(),GetSelectedFilesId(),box_checked,timelimit.value);
    }

    unselectAll();
	box_checked.splice(0,box_checked.length);
}

function boxcheck(checkbox)
{

	if(box_checked.indexOf(parseInt(checkbox.value))>=0){
		box_checked.splice(box_checked.indexOf(parseInt(checkbox.value)),1);
	}else{
		box_checked.push(parseInt(checkbox.value));
	}

}
function clickfile(checkbox)
{
	f = document.listFrm
	if (!checkbox.checked) f.selectall.checked=false;

}
function ShowShareDiv()
{
	count =0;
	box_checked.splice(0,box_checked.length);
	arr=GetSelectedFiles();
	count=arr.length;

	if (count <= 0)
	{
    alert(JS_ERROR_NOFILES);
    return;
  }

  ShowUserList();

  if (BRIEF_JACL_INTEGRATION=='1' && BRIEF_JACL_SHARELEVEL=='group')
  {
    GroupList(count);
    return;
  }

	UserList(count);
}

function DeleteUser(userID,fileID,userName)
{
	if(window.confirm(JS_CONFIRM_USERDEL+" "+userName))
		sendRequest('get', 'index.php?option=com_brief&task=deleteaccess&fileid='+fileID+'&userid='+userID);
}

function makeFolder()
{
  f = document.listFrm;

  b=document.getElementById("newfolder");
  var div = f.appendChild(document.createElement('div'));
  div.style.display = 'none';
  var a = div.appendChild(document.createElement('input'));
  a.type='text';
  a.name='newfolder';
  a.value=b.value;
  f.task.value='makefolder';
  f.submit();
}

function modifyDescription()
{
	f = document.listFrm;
	newdesc=document.getElementById("modifydesc").value;
	var div = f.appendChild(document.createElement('div'));
	div.style.display = 'none';
	var a = div.appendChild(document.createElement('input'));
	a.type='text';
	a.name='modifydesc';
	a.value = newdesc

	arr=GetSelectedFiles();
	count = arr.length;
	for (i = 0; i < arr.length; i++)
	{
		if ( arr[i].checked == false ||  arr[i].getAttribute('brief_type')=='folder')
			count=count-1;
	}
	if(count>0)
	{
		f.task.value='modifydescription'
		f.submit()
	}
	else
		alert(JS_ERROR_NOFILES)

	f.submit();
}
function modifyVodes()
{
	f = document.listFrm;
	newvodes=document.getElementById("modifyvodes").value;
	var div = f.appendChild(document.createElement('div'));
	div.style.display = 'none';
	var a = div.appendChild(document.createElement('input'));
	a.type='text';
	a.name='modifyvodes';
	a.value =newvodes;

	arr=GetSelectedFiles();
	count = arr.length;
	for (i = 0; i < arr.length; i++)
	{
		if ( arr[i].checked == false ||  arr[i].getAttribute('brief_type')=='folder')
			count=count-1;
	}
	if(count>0)
	{
		f.task.value='modifyvodes'
		f.submit()
	}
	else
		alert(JS_ERROR_NOFILES)

	f.submit();
}
function changeSelected()
{
	f = document.listFrm
    arr=GetSelectedFiles();
	count = arr.length;
	for (i = 0; i < arr.length; i++)
	{
		if ( arr[i].checked == true &&  arr[i].getAttribute('brief_type')=='folder')
				count=count-1;

	}
	if(count>0)
	{
		f.task.value='changewindow'
		f.submit()
	}
	else
		alert(JS_ERROR_NOFILES)
}

function moveSelected()
{
	f = document.listFrm
    arr=GetSelectedFiles();
	count = arr.length;
	if(count>0)
	{
		f.task.value='move'
		f.submit()
	}
	else
		alert(JS_ERROR_NOFILES)

}



function delFile()
{
	f = document.listFrm
    arr=GetSelectedFiles();
	count = arr.length;
	if(count>0)
	{
			if(window.confirm(JS_CONFIRM_FILEDEL_PLURAL))
			{
				f.task.value='delete';
				f.submit();
			}

	}
	else
		alert(JS_ERROR_NOFILES)

}


function selectAll()
{

	f = document.listFrm;

	c = f.selectall.checked;

	if(c==true)
	{
        arr=GetAllFiles();
		for (i = 0; i < arr.length; i++)
				arr[i].checked = true;

	}
	else
		unselectAll()


}

function unselectAll()
{
	f = document.listFrm;
	f.selectall.checked=false;
    arr=GetAllFiles();
	for (i = 0; i < arr.length; i++)
			arr[i].checked = false;
}

function addFiles()
{
	f = document.listFrm
	f.task.value='add'
	f.submit()
}

function gotoFolder(newvfolder)
{
	f = document.listFrm
	f.curvfolder.value = newvfolder
	f.task.value='myfiles'
	f.submit()
}

function unshareUser(fileid,userid,gid){
    xajax_jax_UnshareUser(fileid,userid,gid);
}
function unshareAllUsers(){

    xajax_jax_UnshareFile(GetSelectedFolders(),GetSelectedFilesId(),file_ids);
}
function showShareStatus(fileid){
	var pageSize = getPageSize();
	var pageScroll = getPageScroll();
	var popupTop = pageScroll[1] + (pageSize[3] / 3);
	var elDiv = document.createElement("DIV");
	HideUserList();
	elDiv.style.top = popupTop +'px';
	elDiv.id = "popup_userlist";
	elDiv.innerHTML =  '<div id="sharestatus"><img align="center" src="/components/com_brief/processing.gif"></div><br/> ';
	elDiv.innerHTML += '<input type="button" class="button" value="'+LANG_CANCEL+'" onClick="this.parentNode.parentNode.removeChild(this.parentNode);"/>';
	document.getElementsByTagName("BODY")[0].appendChild(elDiv);
    xajax_jax_ShareStatus(fileid);
}
function selectAll_userlist(){
    isSelectallUsers=!isSelectallUsers;
    var arr1=document.getElementsByTagName('input');
	for( var x = 0; x<arr1.length; x++ ){
	    if (arr1[x].name=='checkboxes[]' && arr1[x].id!='public_chk'){
	        arr1[x].checked=isSelectallUsers;
	    }
	}
}
function selectAll_userlist2()
{
    var arr1=document.getElementsByTagName('input');
	for( var x = 0; x<arr1.length; x++ ){
	    if (arr1[x].name=='checkboxes[]' && arr1[x].id!='public_chk')
	        arr1[x].checked=true;

	    if(arr1[x].name=='selectall')
	      arr1[x].checked=true;
	}
}

function list_2_list (frmName, srcListName, tgtListName)
{
	var form = eval( 'document.' + frmName );
	var srcList = eval( 'form.' + srcListName );
	var tgtList = eval( 'form.' + tgtListName );

	var srcLen = srcList.length;
	var tgtLen = tgtList.length;
	var tgt = "x";

	for (var i = tgtLen - 1; i > -1; i--)
	{
		tgt += "," + tgtList.options[i].value + ","
	}

	for (var i=0; i < srcLen; i++)
	{
		if (srcList.options[i].selected && tgt.indexOf( "," + srcList.options[i].value + "," ) == -1)
		{
			opt = new Option( srcList.options[i].text, srcList.options[i].value );
			tgtList.options[tgtList.length] = opt;
		}
	}
}

function del_from_list( frmName, srcListName )
{
	var form = eval( 'document.' + frmName );
	var srcList = eval( 'form.' + srcListName );

	var srcLen = srcList.length;

	for (var i = srcLen - 1 ; i > -1; i--)
	{
		if (srcList.options[i].selected)
		{
			srcList.options[i] = null;
		}
	}
}

function submitform(pressbutton)
{
	document.adminForm.task.value=pressbutton;
	try
	{
		if(pressbutton == "savesettings")
		{
			var share_restricted = document.getElementById("share_restricted")
			if(share_restricted != null)
			{
				for (var i=share_restricted.length-1; i > -1; i--)
				{
					share_restricted.options[i].selected = true
				}
			}

			var receive_restricted = document.getElementById("receive_restricted")

			if(receive_restricted !=null)
			{
				for (var i=receive_restricted.length-1; i > -1; i--)
				{
					receive_restricted.options[i].selected = true
				}
			}

		}

		document.adminForm.onsubmit();
	}
	catch(e)
	{

	}
	document.adminForm.submit();
}
function CheckUpload()
{
    if (with_vodes==1){
        var arr1=document.getElementsByTagName('input');

        if (VODES_MIN_PRICE>0){
        	for( var x = 0; x<arr1.length; x++ ){
        	    var s=arr1[x].name;
        	    if (s.substring(0,12)=='vodes_price_' && (parseInt(arr1[x].value)<VODES_MIN_PRICE || isNaN(parseInt(arr1[x].value))) ){
        	        alert(JS_ERROR_MIN_PRICE+VODES_MIN_PRICE);
        	        return false;

        	    }
        	}


        }
        if (VODES_MAX_PRICE>0){
        	for( var x = 0; x<arr1.length; x++ ){
        	    var s=arr1[x].name;
        	    if (s.substring(0,12)=='vodes_price_' && parseInt(arr1[x].value)>VODES_MAX_PRICE ){
        	        alert(JS_ERROR_MAX_PRICE+VODES_MAX_PRICE);
        	        return false;

        	    }
        	}

        }
    }

    PrepareAjaxUpload();

    return true;
}

function PrepareAjaxUpload()
{
  var files = document.getElementById('files');
  var status = document.getElementById('upload-status');

  files.style.display = 'none';
  status.style.display = 'inline';

  status.innerHTML = '<h1>Please wait! The files are being uploaded...</h1><img src="components/com_brief/icons/ajax-loader2.gif" />';
}

function AjaxUploadResponse()
{
  var status = document.getElementById('upload-status');
  var response = document.getElementById('ajax_uploader').contentWindow.document.body.innerHTML;

  status.innerHTML = response;
}

function getcontent(id){
	if (document.getElementById){
		el=document.getElementById(id);
		if (el){
			return el.innerHTML;
		}
	}

	return '&nbsp;';
}

function clear_content(content){
	content = content.replace(/\n/,' ');
	return content;
}
