var user="";

function changeClass()
{
if (document.getElementById("titleS1")!=null && document.getElementById("subS1")!=null)
 {
 document.getElementById("titleS1").setAttribute("className","newsVitzTitleWhite");
 document.getElementById("subS1").setAttribute("className","newsMainVitzSubTitleWhite");
 }
}



											 function initRos()
              				{
              				var sCooVal=getCookie("last_action_act");
              				if(sCooVal!=null && sCooVal!="" && sCooVal!="undefined")
              				{
              						var sCommand=new String(sCooVal);		var n=sCommand.indexOf("addArt(");
              				if(n==-1)return;		sCommand=sCommand.substring(n);
              				try
              				{
              				eval(sCommand);
              				}		catch(err)
              				{
              				n=0;
              				}
              				document.cookie='last_action_act='+sCooVal+'; domain=nrg.co.il; expires='+(new Date((new Date()).getTime()/2).toGMTString());
              				}
              				}







							 				 function insertTO(c){	var cVal = getCookie("maariv_nrg_un");
											 if (cVal == null || cVal == "" || cVal=="undefined")		parent.location.href = "http://www.nrg.co.il/members/owa/MEMBER_LOGIN.showLoginForm";
											 else
											 {
											 						if ((c >=1 && c<=2) || c==7)            		window.location.href = "http://www.nrg.co.il/members/owa/MEMBER_PROFILE.profileOpenner?pCode="+c;
																	else if(c == 3)            		window.location.href = "http://www.nrg.co.il/members/owa/MEMBER_LOGIN.showLoginForm";
																	else if(c == 4)            		window.location.href = "http://www.nrg.co.il/members/owa/MEMBER_LOGIN.showRegistrationForm";
																	else if(c==11)
																	{
																											 var strHref=new String(window.location.href);
																											 while(strHref.indexOf('&')>-1)strHref=strHref.replace('&','*');
																										   window.open("http://www.nrg.co.il/members/owa/MEMBER_LOGIN.exitFromMemCenter?pHVal="+strHref+"&pTmp="+(new Date()).getTime(),"_self");
																  }
											 }}

											 function showUserName()
											 {
											 		var sCooVal=getCookie("maariv_nrg_un");
													if(sCooVal!=null && sCooVal!="" && sCooVal!="undefined")
													{
													    sCooVal=sCooVal.substring(sCooVal,"9","1");
															document.write("<a class='noLink' href='javascript:insertTO(1)'>"+sCooVal+"&nbsp,שלום&nbsp</a>");
													}
													else
													{
														  document.write("<font class='topfooter'>שלום, אורח</font>");
													}
											 }

function showBody() {
  var cur_date=new Date();
  var sCooVal=getCookie("maariv_nrg");
  if(sCooVal!=null && sCooVal!="" && sCooVal!="undefined") { // not signed in
	document.write(user+"<ul><li><a  id='mysutup' href='javascript:insertTO(2)' target='_top'>המזוודה שלי</a></li> | <li><a href='http://www.nrg.co.il/members/owa/MEMBER_PROFILE.profileOpenner?pCode=8&pTmp="+cur_date.getTime()+"' target='_top'>אלבום תמונות</a></li> | <li><a href='http://www.nrg.co.il/online/15/HP_1802.html' target='_top'>הורוסקופ</a></li></ul>");//<li><a id='enterup' href='javascript:insertTO(1)' target='_top'>כניסה לחשבון</a></li> | 
  } else { // signed in
	document.write(user+"<ul><li><a href='javascript:insertTO(3)' target='_top'>כניסה לחשבון</a></li> | <li><a href='http://www.nrg.co.il/members/owa/MEMBER_LOGIN.showRegistrationForm' target='_top'>הרשמה חינם</a></li> | <li><a href='http://www.nrg.co.il/online/15/HP_1802.html' target='_top'>הורוסקופ</a></li></ul>");//<ul><li>xxx</li></ul>")
  }//
}


              			 function validatePage()
              		   {


              		     var queryString = document.searchOptions.query.value;

              					       if(queryString == "")
              								 {
              								    alert("אנא הזן שאילתא");
              										document.searchOptions.query.focus();
              								 }
              								 else
              								 {
              								 submitPage();
              								 }
              			}

              			function checkKey()
              			{
              								 if(event.keyCode==13)
              								 {
              								 validatePage()
              								 }
              			}

              			function submitPage()
              			{
										var vTmp;

										 for (var x=0;x<searchOptions.searchEngine.length; x++){
										    if(searchOptions.searchEngine[x].checked){
 												vTmp=searchOptions.searchEngine[x].value;}
										 }


              								if(vTmp == "1")
              								{
              								document.searchOptions.searchAction.value = "search";
              								document.searchOptions.method = "GET";
              								document.searchOptions.action = "http://search.nrg.co.il/search/index.php";
              							  document.searchOptions.submit();
              								}
              								else
              								{
              								var query = document.searchOptions.query.value;
              								window.open("http://www.google.co.il/search?hl=he&lr=&ie=UTF-16&q="+query);
              								}
                             	

              			}
 

window.setTimeout('initRos()',2000);


 function ScoopMail(x)
    {
     var tdin=window.open("/images/nrg/write2writer.html?c="+x,"_blank", "toolbar=no,location=no,scrollbars=no,width=500,height=480"); 
    }

function ScoopMailNrgcity(x)
{
var tdin=window.open("/online/nrgcity/write2writer_nrgcity.html?c="+x,"_blank", "toolbar=no,location=no,scrollbars=no,width=600,height=267"); 
}


function showAdd(parent,art,channel,color,pW,appl){

  var pWi=pW;
	var pappl=appl;
	if (pWi=="" || (!pWi)){
	  pWi=408;
  }		
	if (pappl=="" || (!pappl)){
	  try{
	   pappl=new String(window.location.href);  
     pappl=pappl.substring(pappl.indexOf("online/")+7); 
     pappl=pappl.substring(0,pappl.indexOf("/"));  }
    catch(e){pappl = 0;}
  }
	
				
  if(parent > 0){
	    if (channel.indexOf("nrgcity")>-1){
        var w = window.open("/gevanew/owa/ARTICLES_COMMENTS.ADD_COMMENT_FORM_NRGCITY?parent="+parent+"&art="+art+"&channelName="+channel+"&backColor="+color+"&appl="+pappl+"","_blank","left=20,top=20,width="+pW+",height=193,scrollbars=1,resizable=0");
        w.focus();
		  }
		 else if (channel.indexOf("newnrg")>-1){
		    var w = window.open("/gevanew/owa/ARTICLES_COMMENTS.ADD_COMMENT_FORM_NRG?parent="+parent+"&art="+art+"&channelName="+channel+"&backColor="+color+"&appl="+pappl+"","_blank","left=20,top=20,width=500,height=533,scrollbars=1,resizable=0");
        w.focus();
		  }		
		 else{
       var w = window.open("/gevanew/owa/ARTICLES_COMMENTS.ADD_COMMENT_FORM?parent="+parent+"&art="+art+"&channelName="+channel+"&backColor="+color+"&appl="+pappl+"","_blank","left=20,top=20,width=400,height=550,scrollbars=1,resizable=0");
       w.focus();}
  }
  else{
	    if (channel.indexOf("nrgcity")>-1){
         if (document.getElementById("commentS").innerHTML==""){
           document.getElementById("commentS").innerHTML="<iframe src='/gevanew/owa/ARTICLES_COMMENTS.ADD_COMMENT_FORM_NRGCITY?parent="+parent+"&art="+art+"&channelName="+channel+"&backColor="+color+"&pwidth="+pW+"&appl="+pappl+"' frameborder=0 width=573 height=235 marginwidth=0 marginheight=0  scrolling=no hspace=0 vspace=0></iframe>";
					 document.getElementById("commentS").style.display = '';
		      }
         else{
           document.getElementById("commentS").innerHTML="";
 					 document.getElementById("commentS").style.display = 'none';					 
			      }
		 }
		 else if (channel.indexOf("newnrg")>-1){
         if (document.getElementById("commentS").innerHTML==""){
           document.getElementById("commentS").innerHTML="<iframe src='/gevanew/owa/ARTICLES_COMMENTS.ADD_COMMENT_FORM_NRG?parent="+parent+"&art="+art+"&channelName="+channel+"&backColor="+color+"&pwidth="+pW+"&appl="+pappl+"' frameborder=0 width=465 height=548 marginwidth=0 marginheight=0  scrolling=no hspace=0 vspace=0></iframe>";
					 document.getElementById("commentS").style.display = '';
		      }
         else{
           document.getElementById("commentS").innerHTML="";
 					 document.getElementById("commentS").style.display = 'none';					 
			      }
		 }
	   else{
        if (document.getElementById("commentS").innerHTML==""){
           document.getElementById("commentS").innerHTML="<iframe src='/gevanew/owa/ARTICLES_COMMENTS.ADD_COMMENT_FORM?parent="+parent+"&art="+art+"&channelName="+channel+"&backColor="+color+"&pwidth="+pWi+"&appl="+pappl+"' frameborder=0 width=408 height=538 marginwidth=0 marginheight=0  scrolling=no hspace=0 vspace=0></iframe>";
					
					 try{
							//code to add gif "close" to comment
							var str=document.getElementById("commentsImg").src;
							document.getElementById("commentsImg").src=str.replace(/FFutter1/,"close");
					 }
					 catch(e){}					
       }
       else{
      		 document.getElementById("commentS").innerHTML="";
					 try{
					 		 //code to add gif "close" to comment
							 var str=document.getElementById("commentsImg").src;
							 document.getElementById("commentsImg").src=str.replace(/close/,"FFutter1");
							 }
					catch(e){}			
       }
   }
	}
}





















   
   
    var refreshFlag = true;
    var sURL = unescape(window.location.pathname);
    function doLoad()
    {
        if(refreshFlag){
          setTimeout( "refresh()", 20*60*1000 );
        }
    }
    function refresh()
    {   if(refreshFlag){
        window.location.replace( sURL );
        }
    }
    window.onload= doLoad;
    /******************************************/
    function SetCookie(name, value, days) {
    var expire = new Date ();
    expire.setTime (expire.getTime() + (24 * 60 * 60 * 1000) * days);
    document.cookie = name + "=" + escape(value) + "; expires=" + expire.toGMTString();
    }
    function getCookie(Name)
    {
    var search=Name + "=";    
    if(document.cookie.length > 0)
    {
     var offset = document.cookie.indexOf(search);
     if (offset != -1)
     {
     offset += search.length;
     var end = document.cookie.indexOf(";", offset);
     if (end == -1)
     end = document.cookie.length;
     return (unescape(document.cookie.substring(offset, end)));
     }
    }
    }
    
    function openWin1(url,title,attrib)
    {
        wref=window.open(url,title,attrib);
    }
    
    function openInnewWindow1(url,width,height,toolbar)
    {
        if(toolbar==1)
        {
            openWin1(url,'_blank','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+width+',height='+height)
        }
        else
        {
            openWin1(url,'_blank','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,movable=yes,resizable=yes,width='+width+',height='+height)
        }
    }
    
    function addArt(aID,aHref,aChn,pFrom)
    {
     var cVal = getCookie("maariv_nrg");
     var vChn = aChn;
    
     while(vChn.indexOf('&')>-1)vChn=vChn.replace('&','*');
    
     if (cVal == null || cVal == "") {
     document.getElementById("launcher").innerHTML="<iframe id=imgcut height=0 src=/members/owa/MEMBER_ACOUNT.SAVE_LAST_ACTION?pArtRaz="+aID+"&pArtLink="+aHref+"&pChannelName="+vChn+"&pFrom="+window.location.href+"></iframe>";
     window.setTimeout('location.href = "/members/owa/MEMBER_LOGIN.showLoginForm"',2000);
     }
     else{
      document.getElementById("launcher").innerHTML="<iframe id=imgcut height=0 width=100 height=100 border=2  src=/members/owa/MEMBER_ACOUNT.addArtToMyFolder?pArtRaz="+aID+"&pArtLink="+aHref+"&pChannelName="+vChn+"&pFrom=></iframe>";
      var vURL = "/gevanew/owa/ADD_ART_TO_FOLDER?pArtRaz="+aID;
      openInnewWindow1(vURL, 600, 200, 0);
      document.getElementById("launcher").innerHTML="";
     }
    }
    
    var vabrod="N";
    function coo()
    {
     vabrod=getCookie("locusr");
     if(vabrod!="Y" && vabrod!="N")
     {
      document.write("<SCRIPT LANGUAGE=\"JavaScript\" src=\"" + "/location/locusr.php\">");
      document.write("<\/SCRIPT>");
     }
    }
    coo();
    function showMsg(msg,img){
     if(document.getElementById(msg).style.display == "none"){
    	document.getElementById(msg).style.display = "";
        if(document.getElementById(img)!= null) {
         if(document.getElementById(img).src != "/images/nrg/gifs/t.gif")
        	document.getElementById(img).src = "/images/nrg/gifs/comments/minus.gif";
        }
     }
     else{
    	document.getElementById(msg).style.display = "none";
        if(document.getElementById(img)!= null) {
          if(document.getElementById(img).src != "/images/nrg/gifs/t.gif")
           document.getElementById(img).src = "/images/nrg/gifs/comments/plus.gif";
        }
     }
    }
		
function showAllComments(maxComment){
   var msg="MSG";
	 var img="IMG";
	 
	 if(document.getElementById("openAll").style.display == "none"){
	    document.getElementById("openAll").style.display = "block";
	    document.getElementById("closeAll").style.display = "none";
			for(i=maxComment;i>0&&(maxComment-i)<1000;i--){
         closeAllMsg(msg+i,img+i);				 
	    }						
	 }
	 else{
	    document.getElementById("openAll").style.display = "none";
	    document.getElementById("closeAll").style.display = "block";
			for(i=maxComment;i>0&&(maxComment-i)<1000;i--){
         openAllMsg(msg+i,img+i);
	    }				
	 }
}
function showAllCommentsNrgcity(maxComment){
   var msg="MSG";
	 var img="IMG";
	 
	 if(document.getElementById("openAll").style.display == "none"){
	    document.getElementById("openAll").style.display = "block";
	    document.getElementById("closeAll").style.display = "none";
	    document.getElementById("openAll2").style.display = "block";
	    document.getElementById("closeAll2").style.display = "none";
      for(i=maxComment;i>0&&(maxComment-i)<1000;i--){
         closeAllMsg(msg+i,img+i);				 
	    }						
	 }
	 else{
	    document.getElementById("openAll").style.display = "none";
	    document.getElementById("closeAll").style.display = "block";
	    document.getElementById("openAll2").style.display = "none";
	    document.getElementById("closeAll2").style.display = "block";
      for(i=maxComment;i>0&&(maxComment-i)<1000;i--){
         openAllMsg(msg+i,img+i);
	    }				
	 }
}
function openAllMsg(msg,img){
 	 document.getElementById(msg).style.display = "";
   if(document.getElementById(img)!= null) {
      if(document.getElementById(img).src != "/images/nrg/gifs/t.gif")
         document.getElementById(img).src = "/images/nrg/gifs/comments/minus.gif";
   }
}
function closeAllMsg(msg,img){
 	 document.getElementById(msg).style.display = "none";
   if(document.getElementById(img)!= null) {
     if(document.getElementById(img).src != "/images/nrg/gifs/t.gif")
       document.getElementById(img).src = "/images/nrg/gifs/comments/plus.gif";
   }
}
/* Toggle Comments */

function toggleComment(id) {

		var commentContent = document.getElementById("c_"+id);
		var commentName = document.getElementById("n_"+id);
		var commentSpacer = document.getElementById("s_"+id);
		var commentItem = commentContent.parentNode;
		if (commentContent.style.display == "none") {
		commentContent.style.display = "";
		commentSpacer.style.display = "";
		var curcomment = document.getElementById("curcom"+id);
		curcomment.style.paddingTop="0px";
		commentItem.setAttribute("class", "commentsOpen");
		commentItem.setAttribute("className", "commentsOpen");
		commentName.style.fontWeight = "bold";
		} else {
		var curcomment = document.getElementById("curcom"+id);
		curcomment.style.paddingRight="0px";
		commentContent.style.display = "none";
		commentSpacer.style.display = "none";
		commentItem.setAttribute("class", "commentsClose");
		commentItem.setAttribute("className", "commentsClose");
		commentName.style.fontWeight = "normal";
		}
}



function toggleInlineComment(id) {

		var commentContent = document.getElementById("c_"+id);
		var commentName = document.getElementById("n_"+id);
		var commentSpacer = document.getElementById("s_"+id);
		var commentImage = document.getElementById("i_"+id);
		var commentItem = commentContent.parentNode;
		/*hs*/
		var commWidth=450;
		var commMargin=15;
		var commPadding=15; 
		var curcomment = document.getElementById("curcom"+id);
		var countSpan =parseInt(document.getElementById("innnerComNum"+id).innerHTML);		
  	/*hs*/
		if (commentContent.style.display == "none") {		
		commentContent.style.display = "";
		commentSpacer.style.display = "";
		curcomment.style.marginRight=-1*(commMargin*(countSpan))+"px";
		curcomment.style.paddingRight=(commPadding*(countSpan))+"px";		
		curcomment.setAttribute("class", "commentsInlineOpen");
		curcomment.setAttribute("className", "commentsInlineOpen");
		commentName.style.fontWeight = "bold";
		commentImage.src = "/images/nrg/include/img/comments_close.gif";

		} else {

		commentContent.style.display = "none";
		commentSpacer.style.display = "none";
		commentItem.setAttribute("class", "commentsInlineClose");
		commentItem.setAttribute("className", "commentsInlineClose");
		commentName.style.fontWeight = "normal";
		commentImage.src = "/images/nrg/include/img/comments_open.gif";
		}
}


/* General Functions */

function lv() {

	//

}


var allComments=Array();
var toggleAllConmentsSwitch=0;
function toggleAllConments()
{ toggleAllConmentsSwitch++;
  if (toggleAllConmentsSwitch>1)toggleAllConmentsSwitch=0;

  // var mobj = document.getElementById('comments');
   //for(a=0;a<=allComments.length; a++)
   for (a in allComments)
   if (a>0)
   {  
	  var id=a;
	  var commentContent = document.getElementById("c_"+id);
	  var commentName = document.getElementById("n_"+id);
	  var commentSpacer = document.getElementById("s_"+id);
	  var commentItem = commentContent.parentNode;

      if (toggleAllConmentsSwitch==1)
      { 
		//var aaa=mobj[a].id;
		commentContent.style.display = "";
		commentSpacer.style.display = "";
		var curcomment = document.getElementById("curcom"+id);
		curcomment.style.paddingTop="0px";
		commentItem.setAttribute("class", "commentsOpen");
		commentItem.setAttribute("className", "commentsOpen");
		commentName.style.fontWeight = "bold";
		document.getElementById('toggleAllConmentsId').innerHTML='סגור כל התגובות ברצף';
		}
      if (toggleAllConmentsSwitch==0)
      { 
     	var curcomment = document.getElementById("curcom"+id);
		curcomment.style.paddingRight="0px";
		commentContent.style.display = "none";
		commentSpacer.style.display = "none";
		commentItem.setAttribute("class", "commentsClose");
		commentItem.setAttribute("className", "commentsClose");
		commentName.style.fontWeight = "normal";
		document.getElementById('toggleAllConmentsId').innerHTML='לקריאת כל התגובות ברצף';
	  }
   }

   // Get elements by id: comments
   //     find by class: commentsClose
   // -> div _id 
}

// ss
