﻿function loadpage ()
{
showcookies ();
}

// this area is for the text replacing sytem, to change text and html tags
	
function replaceText(str)
{
var result = new EditableString(str);
result = result.replaceAll("\"","qe");
result = result.replaceAll("'", "qw");

return result.data;
}

function replaceBack(str)
{
if (str)
{
return str.replace(/qe/g, "\"").replace(/qw/g, "\'");
}
}

function quoteXml (xmlStr) {
var result = new EditableString(xmlStr);
result = result.replaceAll("<", "&lt;");
result = result.replaceAll(">", "&gt;");
result = result.replaceAll("\"", "&quot;");
result = result.replaceAll("'", "&apos;");
return result.data;
}

function unquoteXml (xmlStr) {
var result = new EditableString(xmlStr);
result = result.replaceAll("&lt;", "<");
result = result.replaceAll("&gt;", ">");
result = result.replaceAll("&quot;", "\"");
result = result.replaceAll("&apos;", "'");
return result.data;
}

function EditableString(str) {
this.data = str;
}

EditableString.prototype.replaceAll = function (srcStr, dstStr) {
this.pat = new RegExp(srcStr,"g");
var newStr = this.data.replace (this.pat, dstStr);
return new EditableString(newStr);
}

// end of text replacing area

function addResponse (what, theid)
{
if (document.getElementById ("RessBody").value == "" | document.getElementById ("RessUserName").value == "" | document.getElementById ("RessHeader").value == "")
{
    document.getElementById ("addRessHeaderTD").innerHTML = "כל השדות הינם חובה";
}    
else{
var b = replaceBack (document.getElementById ("RessBody").value);
var n = replaceBack (document.getElementById ("RessUserName").value);
var h = replaceBack (document.getElementById ("RessHeader").value);

var vars = what + "'" + document.getElementById ("ItemID").value + "'" + b + "'" + n + "'" + h;

makeRequest("AddRess", vars);
}
}

function setfocus(what)
{
document.getElementById(what).value = "";
}

function polclicked(what)
{
  document.location.href = "http://www.shoresh.org.il/spages/pol/main.aspx?vote=" + what;
}

function showmovie(moviename, playerType)
   {   
    var showit;
    
    if (playerType == "ext"){
    showit = '<embed style="WIDTH: 190px; HEIGHT: 145px" type=application/x-mplayer2 align=baseline pluginspage=http://download.microsoft.com/download/winmediaplayer/nsplugin/6.4/WIN98/EN-US/wmpplugin.exe ';
    showit = showit + 'src=' + moviename + ' AutoStart="true">';
    }
    else if (playerType == "int"){
    showit = '<embed style="WIDTH: 190px; HEIGHT: 145px" type=application/x-mplayer2 align=baseline pluginspage=http://download.microsoft.com/download/winmediaplayer/nsplugin/6.4/WIN98/EN-US/wmpplugin.exe ';
    showit = showit + 'src=http://www.shoresh.org.il/music/mediaFiles/' + moviename + ' AutoStart="true">';
    }
    else if (playerType == "custom"){
    showit = moviename;
    }
    
    document.getElementById("videoholderTD").innerHTML = showit;
   }
   
   function closeBIG()
   {
   showhide('altDIVcontainer', 'none');
 showhide('mainheadertable', 'block');
 document.getElementById ("altDIV").innerHTML = "";
 }
 
 function showBIG(what, str)
 {
 showhide('altDIVcontainer', 'block');
 showhide('mainheadertable', 'none');
 

 if (what=='video')
 {
 var arr = new Array;
 
 arr = str.split(',');
 
  var showit="";

    if (arr[1] == "ext"){
    showit = '<embed style="WIDTH: 450px; HEIGHT: 343px" type=application/x-mplayer2 align=baseline pluginspage=http://download.microsoft.com/download/winmediaplayer/nsplugin/6.4/WIN98/EN-US/wmpplugin.exe ';
    showit = showit + 'src=' + arr[0] + ' AutoStart="true">';
    }
    else if (arr[1] == "int"){
    showit = '<embed style="WIDTH: 450px; HEIGHT: 343px" type=application/x-mplayer2 align=baseline pluginspage=http://download.microsoft.com/download/winmediaplayer/nsplugin/6.4/WIN98/EN-US/wmpplugin.exe ';
    showit = showit + 'src=http://www.shoresh.org.il/music/mediaFiles/' + arr[0] + ' AutoStart="true">';
    }
    else if (arr[1] == "custom"){
    showit = arr[0];
    }
    
 document.getElementById ("altDIV").innerHTML = showit;
 }
 else
 {
 document.getElementById ("altDIV").innerHTML = str;
 }
 
 }
  
function ShowTextInElement (element, text)
{
document.getElementById(element).innerHTML = text;
}

 function changemainvideo (i, movieName, Rabbi, Image, fileName)
 {
 for (var o=0; o<6; o++)
 {
    document.getElementById ("videoimage" + o).className = "videoimage";
}

    document.getElementById("videoimage" + i).className = "videoimageclicked";
    document.getElementById("textvideotd").innerHTML = movieName + "/ " + Rabbi;
    document.getElementById("showvideotd").innerHTML = "<IMG src='http://www.shoresh.org.il/usersfiles/hagimimages/big-" + Image + "' >"; 
    document.getElementById("showvideotd").onclick = function(){showmovie(fileName);};
    document.getElementById("textvideotd").onclick = function(){showmovie(fileName);};
 }
	
	function setasHomePage()
	{	
	theobj = document.anchors[0];  
       theobj.style.behavior='url(#default#homepage)';
       theobj.setHomePage('http://www.shoresh.org.il');
	}
	
function changetext(i, header, url, subtext, image)
{
     document.getElementById("mainheadertext").innerHTML = replaceBack(header);
     document.getElementById("mainimageholder").innerHTML = "<IMG class = 'simpleimage' alt='" + header + "' src='" + image + "'>"
     document.getElementById("subheadertext").innerHTML = replaceBack(subtext);
     document.getElementById("mainheadertext").onclick = function(){moveto(url);};
     document.getElementById("mainimageholder").onclick = function(){moveto(url);};
     document.getElementById("subheadertext").onclick = function(){moveto(url);};
     document.getElementById("context").onclick = function(){moveto(url);};

      for (var o=0; o<4 ; o++ )
      {     
        document.getElementById("leadslink" + o).className = "leads";
      }
     
      document.getElementById("leadslink" + i).className = "leadsclicked";
}

function changevideo(what)
{
showloading("videoholderTD");

var numitems = document.getElementById ("numVideo").innerHTML;

if (what=="+" && numitems < 20)
{
    numitems ++;
}
if (what=="-" && numitems > 1)
{
    numitems --;
}   

document.getElementById ("numVideo").innerHTML = numitems;

makeRequest("videos", "");
}

function changeleads(what)
{
showloading("mainimageholder");

var numitems = document.getElementById ("NumLeads").innerHTML;

if (what=="+" && numitems < 4)
{
    numitems ++;
}
if (what=="-" && numitems > 1)
{
    numitems --;
}   

document.getElementById ("NumLeads").innerHTML = numitems;

makeRequest("Headers", "");
}

function showloading(what)
{
document.getElementById (what).innerHTML = "<IMG class = 'simpleimage' alt='' src='http://www.shoresh.org.il/img/g_loading.gif' />";
}

function cleanrows(what)
{
// "leadstable"

 var tbl = document.getElementById(what);
 var lastRow = tbl.rows;

 while(lastRow.length)
         tbl.deleteRow(lastRow - 1);
}

function replacetags(what, tablenum)
{
for (var i=0; i<4; i++)
{
document.getElementById("shimushitag" + i).className = "mainlink";
showhide("shimushitable" + i, "none");
}

document.getElementById(what).className = "clickedtag";
showhide("shimushitable" + tablenum, "block");
}

function showhide(what, hideorshow)
{
var ele = document.getElementById(what);

if (hideorshow == '')
{
if (ele.style.display == "none")
 {
 ele.style.display = "block";
 }
 else
 {
 ele.style.display = "none";
 }
 }
 else
 {
 ele.style.display = hideorshow;
 }
}

function showHideClass(what){
if (document.getElementById (what).className == "nottoshow")
    {
	document.getElementById (what).className = "toshow";
    }
else
	{
	document.getElementById (what).className = "nottoshow";
	}
}
	
function msg(what)
{
alert(what);

return false;
}

function mouseover(item, cssclass)
{
 document.getElementById(item).className = cssclass;
}

function mouseout(item, cssclass)
{
document.getElementById(item).className = cssclass;
}

function addfavorite()
{
var title = "שורש, גולשים לתוכן";
var url = "http://www.shoresh.org.il/";

if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print)
{ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

function searchselectchange(what)
{
    document.getElementById("insite").className = "unselectedsearch";
    document.getElementById("askrabi").className = "unselectedsearch";
    document.getElementById("images").className = "unselectedsearch";
    document.getElementById("products").className = "unselectedsearch";
    document.getElementById("sites").className = "unselectedsearch";
    
    document.getElementById(what).className = "selectedsearch";
     
	var sel1 = document.getElementById("sel");
    sel1.value = what;
}

function navigate()
{

if (document.getElementById('wordtosearch').value.length < 3)
{
alert ("לא ניתן לחפש מילה בת פחות משלוש אותיות");
return false
}

var sel1 = document.getElementById('sel').value;
var word = escape(document.getElementById('wordtosearch').value);
var path

if (sel1 == 'insite')
{
 path = "http://search.shoresh.org.il/main.aspx?word=";
}
if (sel1 == 'askrabi')
{
 path = "http://search.shoresh.org.il/main.aspx?what=shut&word=";
}
if (sel1 == 'images')
{
 path = "http://www.shoresh.org.il/spages/album/main.aspx?id=sear&word=";
}
if (sel1 == 'products')
{
 path = "http://www.shoresh.org.il/shoreshstore/resaults.aspx?word=";
}
if (sel1 == 'sites')
{
 path = "http://www.shoresh.org.il/spages/sites/main.aspx?what=search&word=";
}

 document.location.href = path + word; 
}

function showcookies()
{
var username;
var password;

if (readCookie ('ShoreshUserName'))
{
if (readCookie ('ShoreshUserName') != "אורח")
{
username= decodeURI (readCookie ('ShoreshUserName')).replace(/\+/g, " ");
password="****";

 var row = document.getElementById("sighuptr");
 var lastCell = row.cells;
 
 while(lastCell.length - 2)
            row.deleteCell(lastCell - 1);
    
 var cell = row.insertCell(0); 
 var welcome = "שלום, "  + username + " ברוך שובך";
 cell.innerHTML = "<input class='welcomeinput' id='UserName' disabled='disabled' type='text' value='" + welcome + "' />";
 cell.cellSpan = "4";
 document.getElementById ('submitUser').value = "התנתק!";  
 document.getElementById("welcomeTD").innerHTML = "מחובר";      
}
else
{
username="שם משתמש";
password="סיסמא";

document.getElementById ('UserName').value = username;
document.getElementById ('UserPassword').value = password;
}
}

}

function createCookie(name,value,days,eraseCalling) {
	var expires
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	else  expires = "";
	
	document.cookie = name + "=" + encodeURI (value) + expires + ";" + "path=/;";
	if (eraseCalling == true){
	document.cookie = name + "=" + encodeURI (value) + expires + ";";
	}
	
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return "אורח";
}

function eraseCookie(name) {
	createCookie(name,"",-1, true);
}

function moveto(url)
{
 document.location.href = url;
}

function openNewWindow(what, url)
{
window.open(url ,"","80%, resizable, scrollbars");
}

function CreateActiveXFlash(FlashPath, FlashStyle, Alink)
{
    document.write('<OBJECT id="objFlash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
    document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ');
    document.write('style="' + FlashStyle + '" viewastext>');
    document.write('<PARAM NAME="movie" VALUE=http://' + FlashPath + ' ref>');
    document.write('<PARAM NAME="quality" VALUE="high">');
    document.write('<PARAM NAME="Menu" VALUE="0">');
    document.write('<PARAM NAME="Scale" VALUE="ExactFit">');
    document.write('<PARAM NAME="BGColor" VALUE="#495A74">');
       if (Alink != "")
    {        
    document.write('<PARAM NAME="flashvars" VALUE="alink1=' + escape(Alink) + '">');
    }
    document.write('<embed src=http://' + FlashPath + ' scale="ExactFit" quality="high" bgcolor="#495A74" ');
    document.write('type="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" ');
    document.write('style="' + FlashStyle + '" FlashVars="alink1=' + escape(Alink) + '"></embed>');
    document.write('</object>');
}

function sighin(what)
{
var button;

if (what=="nihul")
{
button = "התחבר"; 
}
else if (what=="logout"){
button = "התנתק";
}
else{button=document.getElementById ('submitUser').value;}

if (button == "התחבר!" || button == "התחבר")
{
var name = document.getElementById("UserName").value;
var pass = document.getElementById("UserPassword").value;

if (name !="שם משתמש" && name !="" && name !="אורח" && pass !="סיסמא" && pass !="" && pass !="****")
{
makeRequest ("sighin", name + "," + pass);
}
else{
alert ("אנא הכניסו שם משתמש וסיסמא תקינים");
}
}
else{
eraseCookie ("ShoreshUserName");
document.location.href = window.location.href;
}
}

var http_request = false;
  
   function makeRequest(what, vars) 
   {
      http_request = false;
      if (window.XMLHttpRequest) 
      { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/plain');
         }
    } 
      else if 
       (window.ActiveXObject) { // IE
         try 
         {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } 
         catch (e) 
         {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      
      if (!http_request) 
      {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
 
      var pre = "http://www.shoresh.org.il/newshoresh/"; 
      // var pre =  "http://localhost:52301/newshoresh/";
      
      var numitems; 
       
      if (what=="sighin")
      {
      var arr = new Array;
      arr = vars.split(",");
      
      
        var theurl = pre + "go.aspx?what=users&name=" + escape(arr[0]) + "&pass=" + escape(arr[1]);
         
        http_request.onreadystatechange = alertContentsSighIn;
      }
      else if (what=="Headers")
      {
         numitems = document.getElementById ("NumLeads").innerHTML;
         theurl = pre + "go.aspx?what=headers&num=" + numitems;

         http_request.onreadystatechange = alertHeadersContents;
      }
      else if (what=="videos")
      {
         numitems = document.getElementById ("numVideo").innerHTML;
         theurl = pre + "go.aspx?what=videos&num=" + numitems;

         http_request.onreadystatechange = alertVideosContents;
      }
      else if (what=="ArticelsLeads")
      {
         var arr1 = new Array;
         arr1 = vars.split(",");
         
         theurl = pre + "go.aspx?what=ArticelsLeads&section=" + arr1[0] + "&type=" + arr1[1] + "&ran=" + Math.floor(Math.random()*12342);
  
         http_request.onreadystatechange = alertHeadersContents;
      }
      else if (what=="ArticelsList")
      {
         var arr1 = new Array;
         arr1 = vars.split(",");
         
         theurl = pre + "go.aspx?what=ArticelsList&section=" + arr1[0] + "&type=" + arr1[1] + "&page=" + arr1[2] + "&ran=" + Math.floor(Math.random()*12342);

         http_request.onreadystatechange = alertArticlesListContent;
      }
      else if (what=="AddRess")
      {
         var arr1 = new Array;
         arr1 = vars.split("'");
         
         theurl = pre + "go.aspx?what=AddRess&table=" + arr1[0] + "&artID=" + arr1[1] + "&b=" + escape(arr1[2]) + "&n=" + escape(arr1[3]) + "&h=" + escape(arr1[4]) + "&ran=" + Math.floor(Math.random()*12342);

         http_request.onreadystatechange = alertContentsAddRess;
      }
      else if (what=="GetRess")
      {
         var arr1 = new Array;
         arr1 = vars.split("'");
         var Para = "what=GetRess&table=" + arr1[0] + "&artID=" + arr1[1] + "&ran=" + Math.floor(Math.random()*12342);
         
         theurl = pre + "go.aspx?" + Para;
         
         http_request.onreadystatechange = alertContentsGetRess;
      }
      else if (what=="shutList")
      {
         var arr1 = new Array;
         arr1 = vars.split(",");
         
         theurl = pre + "go.aspx?what=ShutList&type=" + arr1[0] + "&rabbi=" + arr1[1] + "&page=" + arr1[2] + "&ran=" + Math.floor(Math.random()*12342);

         http_request.onreadystatechange = alertShutListContent;
      }
      else if (what=="shutCount")
      {
         var arr1 = new Array;
         arr1 = vars.split(",");
         
         theurl = pre + "go.aspx?what=ShutCount&type=" + arr1[0] + "&rabbi=" + arr1[1] + "&ran=" + Math.floor(Math.random()*12342);

         http_request.onreadystatechange = alertShutCount;
      }
      
      http_request.open('GET', theurl, true);
      http_request.send(null);
   }

function alertContentsAddRess() 
{ 
if (http_request.readyState == 4) {
         if (http_request.status == 200) {

         var xmldoc = http_request.responseText;
        
        if (xmldoc=="done")
        {
            cleanrows ("addRessTable");
            var tbl = document.getElementById ("addRessTable");
            var lastRow = tbl.rows.length;
            var row = tbl.insertRow(0);  
            var cell = row.insertCell(0);
            cell.innerHTML ="ההודעה נקלטה והיא תפורסם, המערכת שומרת לעצמה את הזכות למחוק הודעות שיש בהן משום פגיעה, לשון זולה ועוד...";
            
            buildArticlesResponseTable();    
       }
       else
       {
            cleanrows ("addRessTable");
            var tbl = document.getElementById ("addRessTable");
            var lastRow = tbl.rows.length;
            var row = tbl.insertRow(0);  
            var cell = row.insertCell(0);
            cell.innerHTML ="ההודעה לא נקלטה בשל טעות טכנית-" + xmldoc;
        } 
   }  
 }    
}

function alertVideosContents() 
{ 
if (http_request.readyState == 4) {
         if (http_request.status == 200) {

         var xmldoc = http_request.responseText;

        var arr = new Array;
        arr = xmldoc.split('^');
          
        if (arr[0]!="none")
        {
            document.getElementById("videoholderTD").innerHTML = "<IMG class = 'simpleimage' width='190px' height='145px' alt='' src='http://www.shoresh.org.il/music/mediaIMG/" + arr[3] + "'>"; 
            var imgsrc = "playVideo_btn.png";
            
            if (arr[6]=="mp3")
            {
            imgsrc = "playSound_btn.png";
            }
            
            document.getElementById("videoholderTD").innerHTML += "<IMG class = 'watermark' alt='' src='img/" + imgsrc + "'>";
            
            document.getElementById("videoNameRabbi").innerHTML = arr[2].replace(/qe/g, "\"").replace(/qe/g, "\'") + "-" + arr[1].replace(/qe/g, "\"").replace(/qe/g, "\'");
            var str = "showBIG('video','" + arr[5] + "," + arr[4] + "');";            
            document.getElementById("showbigvideoTD").onclick = new Function(str); 
           
            var str1 = "showmovie('" + arr[5] + "','" + arr[4] + "');";
            document.getElementById("videoholderTD").onclick = new Function(str1); 
              
       }
       else
       {
            alert ("שם המשתמש לא זוהה");
        }
         
   }  
 }    
}
    
   function alertContentsSighIn() 
{ 
if (http_request.readyState == 4) {
         if (http_request.status == 200) {
         var showgame;
         
         var xmldoc = http_request.responseText;

        var arr = new Array;
        arr = xmldoc.split('^');
        
        if (arr[0]!="none")
        {
       document.getElementById("UserName").value = arr[0];       
       createCookie ("ShoreshUserName", arr[0], 30);
       showcookies();
       }
       else
       {
       alert ("שם המשתמש לא זוהה");
        document.getElementById("UserName").value = "אורח";
        }
         
   }  
 }    
}
   
   function alertHeadersContents() 
{              
if (http_request.readyState == 4) {
         if (http_request.status == 200) { 
         var xmldoc = http_request.responseText;

        var arr = new Array;
         var theurl;
        
        arr = xmldoc.split('*');
        
        // get the number of articles and pages only in articles leads
        if (arr.length == 4)
        {
        var count = new Array;
        count = arr[4].split('^');
        
        document.getElementById("pagescount").innerHTML = count[0];
        document.getElementById("numPages").innerHTML = count[1];
        document.getElementById("currentPages").innerHTML = "1";
        }
        
        // set the leads
        
        for (var o=0; o<4; o++)
        {
       var arr1 = new Array; 
       arr1 = arr[o].split('^');
       

        if (arr[0]!="")
        {
        var leftstr = String(arr1[4]).substring(0, 4);
        var imagepath = ""; 
               
        if (leftstr=="http"){
        theurl = arr1[4];
        imagepath = "http://www.shoresh.org.il/usersfiles/wnimages/" + arr1[3]; 
        }
        else if (leftstr=="Arti"){ // get articles list...
        theurl = "http://www.shoresh.org.il/spages/articles/" + arr1[5];
        var arr2 = new Array;
        arr2 = arr1[3].split("#");
        imagepath = "http://www.shoresh.org.il/usersfiles/articlesimages/" + arr2[0];
        } 
        else{
        theurl = "http://www.shoresh.org.il/" + arr1[4];
        imagepath = "http://www.shoresh.org.il/usersfiles/wnimages/" + arr1[3]; 
        }
    
        var cell =  document.getElementById("leadslink" + o);
        var str1 = "changetext('" + o + "','" + arr1[1] + "','" + theurl + "','" + arr1[2] + "','" + imagepath + "');";
        var str2 = "moveto('" + theurl + "')";
        
        cell.onmouseover = new Function(str1); 
        cell.onclick = new Function (str2);
        
        var inHTM = "<IMG class = 'leadsimage' alt='' src='" + imagepath  + "' />" + "<br>" + replaceBack(arr1[1]); 
        
        cell.innerHTML = inHTM;
       }
       else
       {
       alert ("לא ניתן להשיג את המידע הדרוש");
        }
        
        
         } // end for
         
        arr1 = arr[0].split('^'); 
          
        if (arr[1]!="")
        {
        leftstr = String(arr1[4]).substring(0, 4);

         if (leftstr=="http"){
        theurl = arr1[4];
        "http://www.shoresh.org.il/usersfiles/wnimages/" + arr1[3]; 
        }
        else if (leftstr=="Arti"){ // get articles list...
        theurl = "http://www.shoresh.org.il/spages/articles/" + arr1[5];
        var arr2 = new Array;
        arr2 = arr1[3].split("#");
        imagepath = "http://www.shoresh.org.il/usersfiles/articlesimages/" + arr2[0];
        } 
        else{
        theurl = "http://www.shoresh.org.il/" + arr1[4];
        imagepath = "http://www.shoresh.org.il/usersfiles/wnimages/" + arr1[3]; 
        }
        
          changetext(0,arr1[1],theurl,arr1[2],imagepath);
        if (leftstr == "Arti") // only in articles leads move to first page in the articles list
        {
          movetopage(1);
          }
     }
   }  
 }    
}

function alertArticlesListContent()
{
    if (http_request.readyState == 4) {
         if (http_request.status == 200) {
                 
        var xmldoc = http_request.responseText;

        var arr = new Array;
        var theurl;
        
        cleanrows ("LastArticlesTable");
        var tbl = document.getElementById("LastArticlesTable");
         
        arr = xmldoc.split('*');
        
        for (var i = 0; i < arr.length -1; i++)
        {
            var arr1 = new Array; 
            arr1 = arr[i].split('^');

            var lastRow = tbl.rows.length;
            var row = tbl.insertRow(i);  
            var cell = row.insertCell(0);
            var theurl = "http://www.shoresh.org.il/spages/articles/" + arr1[7];
            
            var arr2 = new Array;
            arr2 = arr1[3].split("#");
            cell.innerHTML = "<img src='http://www.shoresh.org.il/usersfiles/articlesimages/" + replaceBack (arr2[0]) + "' class='leadsimage' />";            
            var str = "moveto('" + theurl + "')";
            cell.onclick = new Function (str);
            
            var cell1 = row.insertCell(1);
            var inhtm = "<a href='" + theurl + "' class='specialConst'>" + replaceBack (arr1[1]) + "</a>";            
            inhtm += "<br><font class='more'>" + replaceBack(arr1[5]) + "</font>";
            inhtm += "&nbsp;&nbsp;(<a href='main.htm?section=" + getSectionNum(arr1[6]) + "&type=" + encodeURI(arr1[4]) + "' class='more'>" + arr1[4] + "</a>)";
            inhtm += "<br>" + replaceBack (arr1[2]);
            
            cell1.innerHTML = inhtm;
        }//end for
       }
       else
       {
       alert ("לא ניתן להשיג את המידע הדרוש");
        }
        
  }  
}

function alertContentsGetRess()
{
    if (http_request.readyState == 4) {
         if (http_request.status == 200) {
                 
        var xmldoc = http_request.responseText;

        var arr = new Array;
        
        cleanrows ("responsesTable");
        var tbl = document.getElementById("responsesTable");
         
        arr = xmldoc.split('*');
       
        var o = 0;
        var count = arr.length - 1;
         
        for (var i = 0; i <  arr.length -1; i++)
        {
            var arr1 = new Array; 
            arr1 = arr[i].split('^');

            var lastRow = tbl.rows.length;
            var row = tbl.insertRow(o);  
            var cell = row.insertCell(0);
            
            cell.innerHTML = "<div class='resHeader'>" + count + ".&nbsp;" + replaceBack (arr1[2]) + "</div>";
            var str = "openCloseResponse('" + arr1[0] + "')";
            cell.onclick = new Function (str);
            
            var row1 = tbl.insertRow(o + 1)
            var cell1 = row1.insertCell(0);
            var inhtm = replaceBack(arr1[3]) + "<br>&nbsp;<br>";
            cell1.innerHTML = inhtm;
            
            cell1.className = "articlesResponseTable";
            cell1.style.display = "none";
            cell1.id = "ResponseNUM" + arr1[0];
            
            var row2 = tbl.insertRow(o + 2)
            var cell2 = row2.insertCell(0);
            inhtm = "<font class= 'more'>&nbsp;&nbsp;" + replaceBack(arr1[1]) + "</font><br>&nbsp;<br>";
            cell2.innerHTML = inhtm;
            cell2.id = "ResponseUserName" + arr1[0];
            cell2.className = "BIGmore";
            
            var row3 = tbl.insertRow(o + 3)
            var cell3 = row3.insertCell(0);
            cell3.id= "showAD" + arr1[0];
            cell3.className = "nottoshow";
            cell3.onclick = new Function ("showadd1(data(),'" + arr1[0] + "')"); 
            
            o = o + 4;
            count --;
        }//end for
       }
       else
       {
       alert ("לא ניתן להשיג את המידע הדרוש");
        }
        
  }  
}
   
   function alertShutCount()
{
    if (http_request.readyState == 4) {
         if (http_request.status == 200) {
                 
        var xmldoc = http_request.responseText;

        var count = new Array;
        count = xmldoc.split('^');

        document.getElementById("pagescount").innerHTML = count[0];
        document.getElementById("numPages").innerHTML = count[1];
        document.getElementById("currentPages").innerHTML = "1";
        
        movetopage(1);
       }
       else
       {
       alert ("!לא ניתן להשיג את המידע הדרוש");
        }
        
  }  
}
     
function alertShutListContent()
{
    if (http_request.readyState == 4) {
         if (http_request.status == 200) {
                 
        var xmldoc = http_request.responseText;

        var arr = new Array;
        var theurl;
        
        cleanrows ("LastShutTable");
        var tbl = document.getElementById("LastShutTable");
        tbl.className = "ArticlesTable";
        
        arr = xmldoc.split('*');
        
        for (var i = 0; i < arr.length -1; i++)
        {
            var arr1 = new Array; 
            arr1 = arr[i].split('^');

            var lastRow = tbl.rows.length;
            var row = tbl.insertRow(lastRow);  
            var cell = row.insertCell(0);
            var theurl = "http://www.shoresh.org.il/spages/shut/";
            
            var cell1 = row.insertCell(1);
            var inhtm = "<a href='" + theurl + arr1[4] + "' class='specialConst'>" + replaceBack (arr1[1]) + "</a>"; 
            cell.className = "specialConst";
            cell1.innerHTML = inhtm;
            
            var cell2 = row.insertCell(2);           
            inhtm = "<a href='" + theurl + "main.htm?rabbi=" + encodeURI(arr1[3]) + "' class='specialConst'>" + replaceBack (arr1[3]) + "</a>"; 
            cell.className = "specialConst";
            cell2.innerHTML = inhtm;
            
            var cell3 = row.insertCell(3);
            inhtm = "(" + "<a href='" + theurl + "main.htm?type=" + encodeURI(arr1[2]) + "' class='specialConst'>" + replaceBack (arr1[2]) + "</a>" + ")"; 
            cell.className = "specialConst";
            cell3.innerHTML = inhtm;

                         
            var row1 = tbl.insertRow(lastRow +1); 
            var cell4 = row1.insertCell(0);
            cell4.cellSpan = "3";
            cell4.innerHTML = "&nbsp;";
        }//end for
       }
       else
       {
       alert ("לא ניתן להשיג את המידע הדרוש");
        }
        
  }  
}
