﻿function OpenRow(rowID){
    var ElementID = "rowData";
    
    for(i=0; i<20; i++){
        if (document.getElementById(ElementID + i)){
            document.getElementById(ElementID + i).className='RowMoreContentHidden';
        }
    }
    
    if (document.getElementById(ElementID + rowID)){
        if (document.getElementById(ElementID + rowID).className=='RowMoreContentHidden'){
            document.getElementById(ElementID + rowID).className='RowMoreContentVisible';
        }
        else
        {
            document.getElementById(ElementID + rowID).className='RowMoreContentHidden';
        }
           
    }
    else
    {
        alert('huston we have a problem');
    }

}

function showMeSystemMessageNotify()
{
    //
}

function HelloAvi(){
    document.getElementById('bgCenter').style.height='100px';
}

var uniquepageid=window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, "") //get current page path and name, used to uniquely identify this page for persistence feature

function animatedcollapse(divId, animatetime, persistexpand, initstate){
	this.divId=divId
	this.divObj=document.getElementById(divId)
	this.divObj.style.overflow="hidden"
	this.timelength=animatetime
	this.initstate=(typeof initstate!="undefined" && initstate=="block")? "block" : "contract"
	this.isExpanded=animatedcollapse.getCookie(uniquepageid+"-"+divId) //"yes" or "no", based on cookie value
	this.contentheight=parseInt(this.divObj.style.height)
	var thisobj=this
	if (isNaN(this.contentheight)){ //if no CSS "height" attribute explicitly defined, get DIV's height on window.load
		animatedcollapse.dotask(window, function(){thisobj._getheight(persistexpand)}, "load")
		if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes" && this.isExpanded!="") //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
			this.divObj.style.visibility="hidden" //hide content (versus collapse) until we can get its height
	}
	else if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes" && this.isExpanded!="") //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
		this.divObj.style.height=0 //just collapse content if CSS "height" attribute available
	if (persistexpand)
		animatedcollapse.dotask(window, function(){animatedcollapse.setCookie(uniquepageid+"-"+thisobj.divId, thisobj.isExpanded)}, "unload")
}

animatedcollapse.prototype._getheight=function(persistexpand){
	this.contentheight=this.divObj.offsetHeight
	if (!persistexpand && this.initstate=="contract" || persistexpand && this.isExpanded!="yes"){ //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
		this.divObj.style.height=0 //collapse content
		this.divObj.style.visibility="visible"
	}
	else //else if persistence is enabled AND this content should be expanded, define its CSS height value so slideup() has something to work with
		this.divObj.style.height=this.contentheight+"px"
}


animatedcollapse.prototype._slideengine=function(direction){
	var elapsed=new Date().getTime()-this.startTime //get time animation has run
	var thisobj=this
	if (elapsed<this.timelength){ //if time run is less than specified length
		var distancepercent=(direction=="down")? animatedcollapse.curveincrement(elapsed/this.timelength) : 1-animatedcollapse.curveincrement(elapsed/this.timelength)
	this.divObj.style.height=distancepercent * this.contentheight +"px"
	this.runtimer=setTimeout(function(){thisobj._slideengine(direction)}, 10)
	}
	else{ //if animation finished
		this.divObj.style.height=(direction=="down")? this.contentheight+"px" : 0
		this.isExpanded=(direction=="down")? "yes" : "no" //remember whether content is expanded or not
		this.runtimer=null
	}
}


animatedcollapse.prototype.slidedown=function(){
	if (typeof this.runtimer=="undefined" || this.runtimer==null){ //if animation isn't already running or has stopped running
		if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
            showMeSystemMessageNotify()						
			//alert("Please wait until document has fully loaded then click again")
		else if (parseInt(this.divObj.style.height)==0){ //if content is collapsed
			this.startTime=new Date().getTime() //Set animation start time
			this._slideengine("down")
		}
	}
}

animatedcollapse.prototype.slideup=function(){
	if (typeof this.runtimer=="undefined" || this.runtimer==null){ //if animation isn't already running or has stopped running
		if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
			showMeSystemMessageNotify()
			//alert("Please wait until document has fully loaded then click again")
		else if (parseInt(this.divObj.style.height)==this.contentheight){ //if content is expanded
			this.startTime=new Date().getTime()
			this._slideengine("up")
		}
	}
}

animatedcollapse.prototype.slideit=function(){
	if (isNaN(this.contentheight)) //if content height not available yet (until window.onload)
		showMeSystemMessageNotify()
		//alert("Please wait until document has fully loaded then click again")
	else if (parseInt(this.divObj.style.height)==0)
		this.slidedown()
	else if (parseInt(this.divObj.style.height)==this.contentheight)
		this.slideup()
}


animatedcollapse.curveincrement=function(percent){
	return (1-Math.cos(percent*Math.PI)) / 2 //return cos curve based value from a percentage input
}


animatedcollapse.dotask=function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
	var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
	if (target.addEventListener)
		target.addEventListener(tasktype, functionref, false)
	else if (target.attachEvent)
		target.attachEvent(tasktype, functionref)
}

animatedcollapse.getCookie=function(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

animatedcollapse.setCookie=function(name, value){
		document.cookie = name+"="+value
}

function IncreaseFontSize(FontUnitPixle)
{
    document.body.style.fontSize=FontUnitPixle + 'px'
}

function showTopBarSection(sectionName)
{
    //var d = document.getElementById;
    document.getElementById('aboutUsGridContainer').className='topBarDivHidden';
    document.getElementById('investmentsGridContainer').className='topBarDivHidden';
    document.getElementById('foundationGridContainer').className='topBarDivHidden';
    document.getElementById('kayamutGridContainer').className='topBarDivHidden';
    document.getElementById('SearchContainer').className='topBarDivHidden';
    
    if (document.getElementById(sectionName))
    {
        document.getElementById(sectionName).className='topBarDivShow';
    }
    if (sectionName == "aboutUsGridContainer") {
        if (document.getElementById('myMoreButton')) {
            document.getElementById('myMoreButton').style.display = '';
        }
    }
    else {
        document.getElementById('myMoreButton').style.display = 'none';
    }
    
}

function DocumentWrite(sHtml)
{
    //alert(sHtml);
	document.writeln(sHtml);
}

function WriteFlashObj(sSrc,sWidth,sHeight,bTrans,sFlashVars,sID)
{
    var sObj = "";
	var sWMode = "";
	var sObjID = sSrc.replace(".swf","");
	var sVars = "";
	var sPrfx = "?";
	if(sFlashVars){
	    sVars = sFlashVars;
	}
	if(sID){
	    sObjID = sID;
	}else{
	    sObjID = sSrc.replace(".swf","");
	}
	sObj = sObj+"<object style='position:relative;top:0px;z-index:2' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab' width='"+sWidth+"' height='"+sHeight+"' id='"+sObjID+"' align='middle' VIEWASTEXT>";
	sObj = sObj+"<param name='allowFullScreen' value='true' />";
	sObj = sObj+"<param name='allowScriptAccess' value='sameDomain' />";
	sObj = sObj+"<param name='movie' value='"+sSrc+"' />";
	sObj = sObj+"<param name='quality' value='high' />";
	sObj = sObj+"<param name='bgcolor' value='#ffffff' />";
	sObj = sObj+"<param name='flashvars' value='"+sVars+"' />";
	if(bTrans == true){
		sObj = sObj+"<PARAM NAME='WMode' VALUE='Transparent'>";
		sWMode = "wmode='transparent'";
	}
	sObj = sObj+"<embed src='"+sSrc+"' flashvars='"+sVars+"' quality='high' bgcolor='#ffffff' "+sWMode+" width='"+sWidth+"' height='"+sHeight+"' ID='"+sObjID+"' NAME='bg' align='middle' allowFullScreen='true' allowScriptAccess='sameDomain' swLiveConnect=true ID='bg' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
	sObj = sObj+"</object>";
	
	DocumentWrite(sObj);
	
}
function intro()
{
    document.getElementById('topBar_Default').style.visibility='visible';
}
function Search()
{
   var term = document.getElementById('txtSrchTerm').value;
   var termControl = document.getElementById('txtSrchTerm');
   if(term=='')
   {
        termControl.value='חובה להכניס טקסט';
   }
   else
   {
        window.location = 'SearchResults.aspx?SearchTerm='+ escape(term);
   }
}

function AAA(fontSize)
{
    document.body.style.fontSize = fontSize + 'px';
    if (fontSize == 16) {
        FixBigFont();
    }

    if (fontSize == 14) {
        FixMediumFont();
    }

    if (fontSize == 12) {
        FixSmallFont();
    }
    
   // ChangeAllFontTags(fontSize);
    if(document.getElementById('MainContentPage'))
    {
        CheckBackground();
    }
    highlightAAALink('12', false);
    highlightAAALink('14', false);   
    highlightAAALink('16', false);
    if(document.getElementById('aLink_' + fontSize))
    {
        highlightAAALink(fontSize, true);
    }
    setCookieAAA('AAAsize', fontSize, 365);
}

function highlightAAALink(fontSize, bHighLight)
{
    if(document.getElementById('aLink_' + fontSize))
    {
        if(bHighLight)
        {
            document.getElementById('aLink_' + fontSize).className = 'aaaHigh';
        }else{
            document.getElementById('aLink_' + fontSize).className = 'aaaLow';
        }
    }
}


function FixBigFont() {


    // Fix 2nd Level Menus

    var subMenu = document.getElementById("bussPhilantropyUL");
    if (subMenu != null) {
        subMenu.style.top = "166px";

    }

    subMenu = document.getElementById("awarenessUL");
    if (subMenu != null) {
        subMenu.style.top = "19px";

    }

    subMenu = document.getElementById("communicationUL");
    if (subMenu != null) {
        subMenu.style.top = "52px";

    }

    subMenu = document.getElementById("sustainabilityUL");
    if (subMenu != null) {
        subMenu.style.top = "83px";

    }
    

    ///
        

        var obj = document.getElementById("pagePathDiv");
        if (obj != null) {

            if (obj.innerHTML.toString().indexOf("בהתנהלות העסקית הגלובלית") != -1) {

              //  obj.style.fontSize = "14px";
            }

            if (obj.innerHTML.toString().indexOf("המרכז לתקשורת מודעת") != -1) {
            //    obj.style.fontSize = "14px";
            }
        }

        obj = document.getElementById("SidePageName_0");
        if (obj != null ) {

            if (obj.innerHTML.indexOf("קיימות") != -1) {
                
                for (var i=2; i <= 4; i++)
                {

                    obj = document.getElementById("SideRow_" + i);
                    if (obj != null) {
                       
                        if (i == 3) { obj.className = "RowReg2" } else { obj.className = "RowAlt2" }
                       
                    }
                }
            }


            if (obj.innerHTML.indexOf("מודעות") != -1) {

             
                obj = document.getElementById("SideRow_4");
                if (obj != null)
                {
                    obj.className = "RowReg2";
                }

            }
            
        }


        var obj = document.getElementById("pagePathDiv");
        if ((obj != null) && ((obj.innerHTML.indexOf("תפישת הקיימות") != -1) || (obj.innerHTML.indexOf("בהתנהלות הפנימית") != -1)) ) {

         //   obj.style.fontSize = "14px";

        }

      

        obj = document.getElementById("globalHeaderTitle");
        if (obj != null) {
            obj.style.fontSize = "16px";
        }
    

}


function FixMediumFont() {


    // Fix 2nd Level Menus

    var subMenu = document.getElementById("bussPhilantropyUL");
    if (subMenu != null) {
        subMenu.style.top = "147px";

    }

    subMenu = document.getElementById("awarenessUL");
    if (subMenu != null) {
        subMenu.style.top = "16px";

    }

    subMenu = document.getElementById("communicationUL");
    if (subMenu != null) {
        subMenu.style.top = "45px";

    }

    subMenu = document.getElementById("sustainabilityUL");
    if (subMenu != null) {
        subMenu.style.top = "74px";

    }


    ///
    
       var obj = document.getElementById("pagePathDiv");
       if (obj != null) {

           if (obj.innerHTML.toString().indexOf("בהתנהלות העסקית הגלובלית") != -1) {

           //    obj.style.fontSize = "14px";
           }
       }
    
    var obj = document.getElementById("SidePageName_0");
    if (obj != null) {

        if (obj.innerHTML.indexOf("קיימות") != -1) {

                obj = document.getElementById("SideRow_3");
                if (obj != null) {

                    obj.className = "RowAlt2";

                }
            }

            if (obj.innerHTML.indexOf("מודעות") != -1) {


                obj = document.getElementById("SideRow_4");
                if (obj != null) {
                    obj.className = "RowReg2";
                }

            }

        }

        obj = document.getElementById("globalHeaderTitle");
        if (obj != null) {
            obj.style.fontSize = "14px";
        }

    }

    function FixSmallFont() {


        // Fix 2nd Level Menus

        var subMenu = document.getElementById("bussPhilantropyUL");
        if (subMenu != null) {
            subMenu.style.top = "126px";

        }

        subMenu = document.getElementById("awarenessUL");
        if (subMenu != null) {
            subMenu.style.top = "15px";

        }

        subMenu = document.getElementById("communicationUL");
        if (subMenu != null) {
            subMenu.style.top = "43px";

        }

        subMenu = document.getElementById("sustainabilityUL");
        if (subMenu != null) {
            subMenu.style.top = "71px";

        }

        ///
        
        obj = document.getElementById("globalHeaderTitle");
        if (obj != null) {
            obj.style.fontSize = "12px";
        }

        var obj = document.getElementById("pagePathDiv");
        if (obj != null) {

            if (obj.innerHTML.toString().indexOf("בהתנהלות העסקית הגלובלית") != -1) {

              //  obj.style.fontSize = "12px";
            }
        }
    }


function ChangeAllFontTags(fontSize) {

    var fontTags = document.getElementsByTagName("font");

    switch (fontSize) {

        case "12":
            newSize = "2";
            break;
        case "14":
            newSize = "3";
            break;
        case "16":
            newSize = "4";
            break;
    
    }
    for (var i in fontTags) {
        fontTags[i].size = newSize;
     
    }
}

function CheckBackground()
{
    if(document.getElementById('innerMainBAckgroundDiv') && document.getElementById('MainContentPage') && document.getElementById('bgCenter'))
    {
        var myHeight = document.getElementById('MainContentPage').offsetHeight;
        document.getElementById('innerMainBAckgroundDiv').style.height = myHeight + 90 +'px';
        if(Math.round(Number(myHeight) - 350) > 0)
        {
            document.getElementById('bgCenter').style.height = myHeight - 350 + 'px';
        }else{
	       document.getElementById('bgCenter').style.height = 130 + 'px';
		}
    }else{
        return null;
    }
}

function showLargeImage(imgID)
{
    document.getElementById('LargeImage').style.display='';
    document.getElementById('LargeImageContainer').style.display='';
    document.getElementById('LargeImageFile').src = document.getElementById('imageBig_' + imgID).value;
    document.getElementById('currentShownImage').value = imgID;
    document.getElementById('imageText').innerHTML = document.getElementById('imageBigText_' + imgID).value;
    var mImgID = Math.round(imgID);
    document.getElementById('previousImage').href = 'javascript:showLargeImage(' + (mImgID - 1) + ')';
    document.getElementById('nextImage').href = 'javascript:showLargeImage(' + (mImgID + 1) + ')';
}

function closeImage()
{
    document.getElementById('LargeImage').style.display='none';
    document.getElementById('LargeImageContainer').style.display='none';
}

function showGlobalActivityTab(tabID)
{
    var i = 0;
    for (i=1;i<=4;i++) {

        if (i != tabID) {
            document.getElementById('Global_0' + i + '_Tab').style.display = 'none';
            document.getElementById('GlobalContent_0' + i).style.display = 'none';
        }
    }
    document.getElementById('Global_'+tabID+'_Tab').style.display='';
    document.getElementById('GlobalContent_'+tabID).style.display='';
}

function showAboutMoreContent()
{
    if(document.getElementById('aboutcontent').style.display=='none')
    {
        document.getElementById('aboutcontent').style.display='';
        document.getElementById('aboutMoreContent').style.display='none';
    }
    else
    {
        document.getElementById('aboutcontent').style.display='none';
        document.getElementById('aboutMoreContent').style.display='';    
    }
}

function showAboutDefaultContent()
{
    setTimeout('showAboutDefaultContentOnDemand()', 1000);
}

function showAboutDefaultContentOnDemand()
{
    document.getElementById('aboutcontent').style.display='';
    document.getElementById('aboutMoreContent').style.display='none';  
}

function showFoundationMoreContent(fID)
{
    document.getElementById('FoundationMoreContent_0').style.display='none';
    document.getElementById('FoundationMoreContent_1').style.display='';
}

function showKayamutMoreContent(kID)
{
    for(var i=0; i < 4; i++)
    {
        if(document.getElementById('KayamutMorecontent_' + i))
        {
            document.getElementById('KayamutMorecontent_' + i).style.display='none';
        }
    }
    document.getElementById('KayamutMorecontent_' + kID).style.display='';
}

function closeAllLis(elemID)
{
    var items = document.getElementById(elemID).getElementsByTagName('li');
        for(var i=0; i<items.length; i++)
        {
            var oObj = document.getElementById(elemID).getElementsByTagName('li')[i];
            if(oObj.className == 'listItem_TopBar' || oObj.className == 'listItem_TopBar2' || oObj.className == 'listItem_TopBar3' )
            {
                oObj.style.display='none';
            }
        }      
}
/*
function focusList(e, elementID) {

    var b3Level = false;
    var elemID_UL = '';
        
    if(elementID=='About')
    {
        elemID_UL = 'aboutUL';
        
        closeAllLis('groupUL');
        closeAllLis('kayamutUL');
        closeAllLis('languageUL');
        closeAllLis('bussPhilantropyUL');
        closeAllLis('awarenessUL');
        closeAllLis('communicationUL');               
    }
    if(elementID=='Group')
    {
        elemID_UL = 'groupUL';    
        
        closeAllLis('aboutUL');
        closeAllLis('languageUL');
        closeAllLis('kayamutUL');
        closeAllLis('awarenessUL');
        closeAllLis('communicationUL');           
    }
 
    if(elementID=='Kayamut')
    {
        elemID_UL = 'kayamutUL';    
        
        closeAllLis('aboutUL');
        closeAllLis('groupUL');
        closeAllLis('languageUL');
        closeAllLis('bussPhilantropyUL');
        closeAllLis('awarenessUL');
        closeAllLis('communicationUL');          
    }
 
    if(elementID=='Language')
    {
        elemID_UL = 'languageUL';
        
        closeAllLis('aboutUL');
        closeAllLis('groupUL');
        closeAllLis('kayamutUL');
        closeAllLis('bussPhilantropyUL');      
    }
 
    if(elementID=='Search')
    {
        closeAllLis('aboutUL');
        closeAllLis('groupUL');
        closeAllLis('kayamutUL');
        closeAllLis('languageUL');
        closeAllLis('bussPhilantropyUL');
        closeAllLis('awarenessUL');
        closeAllLis('communicationUL');      
    }

    if (elementID == 'BussPhilantropy') {
        elemID_UL = 'bussPhilantropyUL';
        b3Level = true;
    }

    if (elementID == 'Awareness') {
        elemID_UL = 'awarenessUL';
        b3Level = true;
        closeAllLis('communicationUL');
    }

    if (elementID == 'Communication') {
        elemID_UL = 'communicationUL';
        b3Level = true;
        closeAllLis('awarenessUL');
        closeAllLis('sustainabilityUL');
    }


    if (elementID == 'Sustainability') {
        elemID_UL = 'sustainabilityUL';
        b3Level = true;
        closeAllLis('communicationUL');
    }
    
    
    
    if(document.getElementById(elemID_UL))
    {
        var items  = document.getElementById(elemID_UL).getElementsByTagName('li');
        for(var i=0; i<items.length; i++)
        {
            var oObj = document.getElementById(elemID_UL).getElementsByTagName('li')[i];
            if(oObj.className == 'listItem_TopBar' || oObj.className == 'listItem_TopBar2' )
            {
                oObj.style.display='block';
            }
            
            if (b3Level &&  oObj.className == 'listItem_TopBar3')
            {
                oObj.style.display = 'block';
            }
        }    
    }
}
*/
function doSearch()
{
    if(document.getElementById('txtSearch'))
    {
        var srch=document.getElementById('txtSearch').value;
        if(srch!='')
        {
            window.location='SearchResults.aspx?SearchTerm='+escape(srch);
        }else{
        alert("נא להקליד מילות חיפוש");
        }
    }
}

function globalIE6Fix()
{
    var version = 999; // we assume a sane browser    
    if (navigator.appVersion.indexOf("MSIE") != -1)
    {
        version = parseFloat(navigator.appVersion.split("MSIE")[1]);    
        if(version < 7)
        {
            if(document.getElementById('globalImageLower'))
				document.getElementById('globalImageLower').style.left='15px';
			if(document.getElementById('globalHeaderLower'))
	            document.getElementById('globalHeaderLower').style.right='10px';
			if(document.getElementById('mainContentLoweTab'))
	            document.getElementById('mainContentLoweTab').style.right='10px';
        }
	}
	if(document.getElementById('GlobalActivities_Aspx') && document.getElementById('GlobalActivitiesLoweTab'))
	{
		var height1 = document.getElementById('GlobalActivities_Aspx').offsetHeight;
		var height2 = document.getElementById('GlobalActivitiesLoweTab').offsetHeight;
		
		document.getElementById('bgCenter').style.height=Number(height1)+Number(height2)-420+'px';
		
	}
}

function setEnter(e, elementID)
{
    if(e.keyCode == 13)
    {
        var s = document.getElementById(elementID).value;
        doSearch();
        return false;
    }
}
function setCookieAAA(c_name,value,expiredays)
{
    var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
    ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function getCookieAAA(c_name)
{
if (document.cookie.length>0)
  {
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1)
    { 
        c_start=c_start + c_name.length+1; 
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
  return "";
} 

function checkCookieAAA()
{
    var fSize = getCookieAAA('AAAsize');
    if(fSize != "")
    {
        AAA(fSize);
    }
}
function showME(elemID, bShow) {

   
    if(document.getElementById(elemID))
    {
        if(bShow)
        {
            //  document.getElementById(elemID).style.display = 'inline';
            document.getElementById(elemID).className = 'showLink';
          
        }else{
        //  document.getElementById(elemID).style.display='none';
        document.getElementById(elemID).className = 'hideLink';
        }
    }
}

function bodyKeyDown(e) {

//    var accessLinksIndex = document.getElementById("accessLinksIndex");
//    var siteMapLinkShow = document.getElementById("siteMapLinkShow");
//    var moveToContent = document.getElementById("moveToContent");
//    if (accessLinksIndex != null && e.keyCode == 9) {
//        if (accessLinksIndex.value == "0") {
//            showME('siteMapLinkShow', true);
//            accessLinksIndex.value = "1";
//            siteMapLinkShow.focus();
//        } else if (accessLinksIndex.value == "1") {

//        showME('siteMapLinkShow', false);
//        showME('moveToContent', true);
//        accessLinksIndex.value = "2";
//        moveToContent.focus();
//        }
//    }
}

function checkSidebarDivs()
{
    var oObj = document.getElementById('SideBarContainer');
    if(oObj)
    {
        var items = oObj.getElementsByTagName('div');
        for(var i=0; i<items.length;i++)
        {
            var itemID = items[i].id;
            if(itemID != null)
            {
                if(itemID.indexOf('pageTitle_') > -1)
                {
                    var oPageTitleDiv = document.getElementById(itemID);
                    if(oPageTitleDiv)
                    {
                        var itemPageDescID = itemID.substring(itemID.indexOf('_'), itemID.length);
                        if(itemPageDescID)
                        {
                            var oPageDesc = document.getElementById(itemPageDescID);
                            if(oPageDesc)
                            {
                                
                            }
                        }
                    }
                }            
            }
        }
    }
}

function ShowSubMenu(id, bShow) {

    var submenu = document.getElementById(id)
    if (submenu != null) {
        if (bShow) {
            submenu.style.display = "";
        } else {
        submenu.style.display = "none";
        }
    }

}


function HighlightSearch(bHighlight) {

    var obj = document.getElementById("imgSearch");
    if (obj != null) {

        if (bHighlight) {
            obj.src = "images/magnify_RollOver.jpg";
        } else {
        obj.src = "images/magnify.jpg";   
        }
        
    }

}

function DocumentWriteInElement(sHtml, elemID) {
    if (document.getElementById(elemID)) {
        document.getElementById(elemID).innerHTML = sHtml;
    }
}

function WriteFlashObjInElement(sSrc, sWidth, sHeight, bTrans, sFlashVars, sID, sElemID) {
    var sObj = "";
    var sWMode = "";
    var sObjID = sSrc.replace(".swf", "");
    var sVars = "";
    var sPrfx = "?";
    if (sFlashVars) {
        sVars = sFlashVars;
    }
    if (sID) {
        sObjID = sID;
    } else {
        sObjID = sSrc.replace(".swf", "");
    }

    sObj = sObj + "<object style='position:relative;top:0px;z-index:102; border-width:0px;' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab' width='" + sWidth + "' height='" + sHeight + "' id='" + sObjID + "' align='middle' VIEWASTEXT>";
    sObj = sObj + "<param name='allowScriptAccess' value='sameDomain' />";
    sObj = sObj + "<param name='movie' value='" + sSrc + "' />";
    sObj = sObj + "<param name='quality' value='high' />";
    sObj = sObj + "<param name='bgcolor' value='transparent' />";
    sObj = sObj + "<param name='flashvars' value='" + sVars + "' />";
    if (bTrans == true) {
        sObj = sObj + "<PARAM NAME='WMode' VALUE='Transparent'>";
        sWMode = "wmode='transparent'";
    }
    sObj = sObj + "<embed src='" + sSrc + "' flashvars='" + sVars + "' quality='high' bgcolor='transparent' " + sWMode + " width='" + sWidth + "' height='" + sHeight + "' ID='" + sObjID + "' NAME='bg' align='middle' allowScriptAccess='sameDomain' swLiveConnect=true ID='bg' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />";
    sObj = sObj + "</object>";

    DocumentWriteInElement(sObj, sElemID);
}

function CheckRefresh() {

 obj = document.getElementById("SidePageName_0");
 if (obj != null) {

     if (obj.innerHTML.indexOf("קיימות") != -1) {

         return true;

     }

     if (obj.innerHTML.indexOf("מודעות") != -1) {

         return true;

     }
 }

 obj = window.location.href.toString();

 if ((obj.indexOf("GlobalActivities.aspx") != -1) && isFirefox()) {
     return true;
 }

 return false;

}


function AAAClick(fontsize) {


    if (CheckRefresh()) {
        setCookieAAA('AAAsize', fontsize, 365);
        window.location = window.location;

    } else {
    AAA(fontsize);
    }
}

function isFirefox() {
  return navigator.userAgent.indexOf("Firefox") > -1;
}

function really_out(src) {
    if (!window.event)
        return true;
    var event = window.event;
    var from = event.fromElement;
    var to = event.toElement;

    return (src == from || src.contains(from)) && !src.contains(to) && src != to;
}


function clickedOutsideElement(elemId) {
    var theElem = getEventTarget(window.event);

    while (theElem != null) {
        if (theElem.id == elemId)
            return false;

        theElem = theElem.offsetParent;
    }

    return true;
}

function getEventTarget(evt) {
    var targ = (evt.target) ? evt.target : evt.srcElement;

    if (targ != null) {
        if (targ.nodeType == 3)
            targ = targ.parentNode;
    }

    return targ;
}
