// JavaScript Document

function addEvents(elm, evType, fn, useCapture) {
if (!elm) {return;}
if (elm.addEventListener) {elm.addEventListener(evType, fn, useCapture);
return true;} else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
return r;} else {
elm['on' + evType] = fn;}
}

if(!window.$) window.$ = function(e) { return document.getElementById(e); };

function showHide(el) {
if ($(el).style.display=='block') {
$(el).style.display='none';
} else {
$(el).style.display='block';
}
}



addEvents(window, 'load', preloadIt, false);

function preloadIt()
{
if ($('torat_psagot_panel')) {
//topsnet_scroller('torat_psagot_panel');
initializemarquee();
}
}


function MM_preloadImages() { 
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function highLightRows(id, color) {
	var table = document.getElementById(id);
	if (!table) {return;}
	for (var r = 0; r < table.rows.length; r++){
	  table.rows[r].onmouseover = function () {
          this.className += " light_row"; return false
    }
		table.rows[r].onmouseout = function () { 
          this.className = this.className.replace("light_row", ""); return false
    }
    
  }
}

function topsnet_scroller(id)
{
var content = $(id).innerHTML;

$(id).innerHTML = '<marquee behavior="Scroll" scrolldelay="40" scrollamount="1" direction="up" onMouseover="this.stop()" onMouseout="this.start()">'+content+'</marquee>';
}

function refreshed()
{
window.location.reload(false);
}
function resize_iframe(iframe) {
     if (iframe.contentDocument && iframe.contentDocument.body.scrollHeight) {
            iframe.style.height = iframe.contentDocument.body.scrollHeight + 'px';
     }
     else if (iframe.Document && iframe.Document.body.scrollHeight) {
         iframe.height = iframe.Document.body.scrollHeight + 'px';
     }
     
}
function showHideReply(id)
{
$('re_'+id).style.display=$('re_'+id).style.display=='none'? 'block' : 'none';
}

function update(id) {
window.open("/mpp/update_page.php?id="+id, "update_page","height=800,width=600,left=300;top=300;status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes");
}
function add(t) {
window.open("/mpp/add_page.php?type="+t, "add_page","height=800,width=600,left=300;top=300;status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes");
}
function ask(t) {
window.open("/mpp/ask.php?type="+t, "ask","height=600,width=600,left=300;top=300;status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes");
}
function eventManager(t) {
window.open("/events/connectors/psagot-events.php?type="+t, "event_man","height=800,width=600,left=300;top=300;status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes");
}
function showEvent(id) {
window.open("/events/connectors/events-pop.php?id="+id, "event_pop","height=600,width=400,left=300;top=300;status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes");
}
function openEventDetails(id) {
if ($('eventIf'+id).src=='about:blank') {
$('eventIf'+id).src='/events/connectors/events-reg.php?id='+id;
}
showHide('eventDetails'+id);
}
function report(t)
{
window.open("/mpp/report.php?type="+t, "report","height=600,width=600,left=300;top=300;status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes");
}
function buyAd(id)
{
window.open("/mpp/buyad.php?id="+id, "buyad","height=600,width=600,left=300;top=300;status=no,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes");
}

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=2000 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8))
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px"
else
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("torat_psagot_panel").offsetHeight
actualheight=cross_marquee.offsetHeight
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",50)', delayb4scroll)
}