/* start */

 var FontSizeMin = 10;
 var FontSizeMax = 14;
 
 setCookie("ContentBoxIDstatus", "0");
 
 function SiteOnLoadColl() {
 
   SiteImagesLoad();
   
   BottomNav3Load();

   PagesOptions();
  // setTopAreaTime();
   SiteInnerBoxesHeights();
   
   HomeMediaBannerView();

 } // end function
 

 function ChangeFontSize(v) {
 
   SitePagesContentAreaObj = document.getElementById("SitePagesContentArea").getElementsByTagName('*');

   for(i=0;i<SitePagesContentAreaObj.length;i++) {
   
       childObj = SitePagesContentAreaObj[i];

       if(childObj.innerHTML != "") {
     
          s = 10;
       
          if(childObj.style.fontSize)
             var s = parseInt(childObj.style.fontSize.replace("px",""));
      
          s = s + v;
       
          if(s >= FontSizeMin && s <= FontSizeMax)
             childObj.style.fontSize = s+"px";
       
       } // end if innerHTML
       
   } // end for
 
 } // end function


 function ChangeFontSizeTo(v) {
 
   SitePagesContentAreaObj = document.getElementById("SitePagesContentArea");
   
   if(SitePagesContentAreaObj) {
   
      SitePagesContentAreaObjItems = SitePagesContentAreaObj.getElementsByTagName('*');

      for(i=0;i<SitePagesContentAreaObjItems.length;i++) {
   
          childObj = SitePagesContentAreaObjItems[i];

          if(childObj.innerHTML != "") {

             childObj.style.fontSize = v + "px";

          } // end if innerHTML
       
      } // end for
      
   } // end if
 
 } // end function


 function PagesOptions() {

   if(document.getElementById("PagesOptionsTop")) {
   
      PagesOptionsBottomNavLinks = document.getElementById("PagesOptionsBottom").innerHTML;
      
      PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("mpage_bottom", "mpage_top");
      PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("mpage_bottom", "mpage_top");
      PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("mpage_bottom", "mpage_top");
      PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("mpage_bottom", "mpage_top");
      PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("mpage_bottom", "mpage_top");
      PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("mpage_bottom", "mpage_top");
      PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("mpage_bottom", "mpage_top");
      PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("mpage_bottom", "mpage_top");
      PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("mpage_bottom", "mpage_top");
      
      page_options2_len = parseFloat(document.getElementById("page_options2_count").innerHTML);
      
      for(p=0;p<page_options2_len;p++) {
          PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("PagesOptionsBottomImgs", "PagesOptionsTopImgs");
          PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("PagesOptionsBottomImgs", "PagesOptionsTopImgs");
          PagesOptionsBottomNavLinks = PagesOptionsBottomNavLinks.replace("PagesOptionsBottomImgs", "PagesOptionsTopImgs");
      }
      
      document.getElementById("PagesOptionsTop").innerHTML = PagesOptionsBottomNavLinks;
      
   } // end if
 
 } // end function
 
 
 function PagePrint() {
      
   document.getElementById("PrintButton").style.display = "none";

   window.print();
   
   document.getElementById("PrintButton").style.display = "block";

 } // end function


 function ContentBoxDisplay(sitem, action_type, style_type) {
 
   oContentBoxID = getCookie("ContentBoxID");
   oContentBoxIDtype = getCookie("ContentBoxIDtype");
   
   if(oContentBoxID != "" && oContentBoxID != null && oContentBoxID != sitem) {
         
      if(document.getElementById(oContentBoxID)) {
       if(oContentBoxIDtype == "visibility")
          document.getElementById(oContentBoxID).style.visibility = "hidden";
       else  
          document.getElementById(oContentBoxID).style.display = "none";
      }   
                  
   } // end if

   
   setCookie("ContentBoxID", sitem);
   setCookie("ContentBoxIDtype", style_type);
   
   anObj = document.getElementById(sitem);
      
   if(anObj) {
      
    if(style_type == "visibility") {
    
     if(action_type == "0")
        anst = "visible";
     else if(anObj.style.visibility == "visible")
        anst = "hidden";
     else
        anst = "visible";
    
     DASB = document.getElementById(sitem + "HTD");
     
     if(DASB) {
     //alert(DASB.offsetWidth +"\n"+document.getElementById(sitem + "TBTD").offsetWidth)
        DASBHTDw = DASB.offsetWidth - 4;
        document.getElementById(sitem + "TBTD").setAttribute("width", DASBHTDw + "px");
     }
        
     anObj.style.visibility = anst;
     
    } else {
     
     if(action_type == "0")
        anst = "block";   
     else if(anObj.style.display == "block")
        anst = "none";
     else
        anst = "block";

     anObj.style.display = anst;
     
    } // end else if
       
   } // end if
   
 } // end function

 function ContentBoxDisplayChStatus() {
 
    if(getCookie("ContentBoxIDstatus") == "1") {

       oContentBoxID = getCookie("ContentBoxID");
       oContentBoxIDtype = getCookie("ContentBoxIDtype");
   
       if(oContentBoxID != "" && oContentBoxID != null) {
         
          if(document.getElementById(oContentBoxID)) {
           if(oContentBoxIDtype == "visibility")
              document.getElementById(oContentBoxID).style.visibility = "hidden";
           else  
              document.getElementById(oContentBoxID).style.display = "none";
          }    
                  
          setCookie("ContentBoxIDstatus", "0");
                  
       } // end if

    } // end if

 } // end function

 function ContentBoxStatus(stv) {
 
    setCookie("ContentBoxIDstatus", stv);
 
 } // end function


 function Opacity(id, opacStart, opacEnd, millisec) { 

    //speed for each frame 
    
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("ChangeOpacity(" + i + ",'" + id + "','0')",(timer * speed)); 
            timer++; 
        } 
    } 
    else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) { 
            setTimeout("ChangeOpacity(" + i + ",'" + id + "','1')",(timer * speed)); 
            timer++; 
        } 
    } 

 } // end function


 function ChangeOpacity(opacity, id, ov) { 
 
 // change the opacity for different browsers 
 
  omenu_subs_opened_area = document.pages_vars_form.menu_subs_opened_area.value;
  
  if(omenu_subs_opened_area != "" || ov == "1") {
  
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
    
  } // end if  
    
 } // end function
 

 /*
 function SiteContentMenuItemsOpacity(n) {
 
    TBA = document.getElementById("TopBannerImg");

    TBA.style.opacity = n / 10;
    TBA.style.filter = 'alpha(opacity=' + n * 10 + ')';
    
    if(n > 2 && n < 10) {
       n--;
       sto2 = setTimeout("SiteContentMenuItemsOpacity("+n+")", 50);
    }
 
 } // end function
 */


 function setTopAreaTime() {
/*
   var DateObj = new Date();
    
   ht = DateObj.getHours();
   mt = DateObj.getMinutes();
   
   if(ht < 12)
      tt = "AM";
   else
      tt = "PM";
      
   if(ht > 12)
      ht-=12;

   if(ht == 0)
      hht = "12";   
   else if(ht < 10)
      hht = "0" + ht;
   else
      hht = ht;
      
   if(mt < 10)
      mmt = "0" + mt;
   else
      mmt = mt;
            
   document.getElementById("TopAreaCurrentTime").innerHTML = hht + ":" + mmt + " " + tt;
 */
 } // end function
 
 
 function PrintPageContentAreaStyle() {
 
   PrintPageContentAreaObj = document.getElementById("PrintPageContentArea");
   
   if(PrintPageContentAreaObj) {
   
      PrintPageContentAreaObjItems = PrintPageContentAreaObj.getElementsByTagName('*');

      for(i=0;i<PrintPageContentAreaObjItems.length;i++) {
   
          childObj = PrintPageContentAreaObjItems[i];

          if(childObj.innerHTML != "") {

             childObj.style.color = "#000000";

          } // end if innerHTML
       
      } // end for
      
   } // end if 
 
  } // end function


 function InnerContentBoxDisplay(sitem, action_type, style_type) {
 
   anObj = document.getElementById(sitem);
      
   if(anObj) {
      
    if(style_type == "visibility") {
    
     if(action_type == "0")
        anst = "visible";
     else if(anObj.style.visibility == "visible")
        anst = "hidden";
     else
        anst = "visible";
    
     DASB = document.getElementById(sitem + "HTD");
     
     if(DASB) {
        DASBHTDw = DASB.offsetWidth - 4;
        document.getElementById(sitem + "TBTD").setAttribute("width", DASBHTDw + "px");
     }
        
     anObj.style.visibility = anst;
     
    } else {
     
     if(action_type == "0")
        anst = "block";   
     else if(anObj.style.display == "block")
        anst = "none";
     else
        anst = "block";

     anObj.style.display = anst;
     
    } // end else if
       
   } // end if
   
 } // end function


 function SiteImagesLoad() {

  // Top Banner

     TBIA = document.getElementById("TopBannerImgAlt").innerHTML;
  
     TopBannerImgTag = "<img id=\"TopBannerImg\" border=\"0\" width=\"955\" height=\"269\" ";
     TopBannerImgTag += " src=\"" + document.getElementById("TopBannerImgSrc").innerHTML + "\" ";
     TopBannerImgTag += " alt=\"" + TBIA + "\" title=\"" + TBIA + "\" ";
     TopBannerImgTag += "/>";
     
     document.getElementById("TopBannerArea").innerHTML = TopBannerImgTag;
     /*
    alert(document.getElementById("TopBannerImgSrc").innerHTML)
    document.getElementById("TopBannerArea").setAttribute('height',270);
document.getElementById("TopBannerArea").style.backgroundImage = "url('"+document.getElementById("TopBannerImgSrc").innerHTML+"')";
    // document.getElementById("TopBannerArea").innerHTML = "&nbsp;";
*/
  // Menu Subs Thumbs

     si = 0;
     
     while(si > -1) {
     
       SC2ndSS = document.getElementById("site_content_2nd_subs_src" + si);
       
       if(SC2ndSS) {
          SC2ndST = document.getElementById("site_content_2nd_subs_thumb" + si);
          SC2ndST.src = SC2ndSS.innerHTML;
          SC2ndST.style.display = "block";
          si++;
       }
       else {
          si = -1;
       }
     
     } // end while

  // Home Page experience palestine

     da = 0;
     
     while(da > -1) {
     
       DAWBBGSRC = document.getElementById("DAWBannerBGSRC" + da);
       
       if(DAWBBGSRC) {
       
          DAWBBGSRC_conts = DAWBBGSRC.innerHTML;
          
          if(DAWBBGSRC_conts != "0")
             document.getElementById("DAWBannerBGTD" + da).style.backgroundImage = "url('"+DAWBBGSRC_conts+"')";

          da++;
       }
       else {
          da = -1;
       }
     
     } // end while
 
 } // end function


 function BottomNav3Load() {

    var mmli = 0;
    var smli = 0;
    
    bottom3nav_area_content = "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">";
    bottom3nav_area_content += "<tr>";
    
    while(mmli > -1) {

       MMLI_OBJ = document.getElementById("MainMenuLinkItem" + mmli);
       
       if(MMLI_OBJ) {
       
          tdadds = "";
          
          if(mmli == 0)
             tdadds = " width=\"120\" ";

          mmli_href = MMLI_OBJ.href;
          mmli_target = MMLI_OBJ.target;
          mmli_title = MMLI_OBJ.innerHTML;
          
          bottom3nav_area_content += "<td valign=\"top\" " + tdadds + ">";
          
           bottom3nav_area_content += "<table border=\"0\" width=\"100%\" id=\"table2\" cellspacing=\"0\" cellpadding=\"0\">";
           
            bottom3nav_area_content += "<tr>";
             bottom3nav_area_content += "<td height=\"20\">";
              bottom3nav_area_content += "<a class=\"BottomGrayMenuMainTitle2\" href=\""+mmli_href+"\" target=\""+mmli_target+"\">";
              bottom3nav_area_content += mmli_title;
              bottom3nav_area_content += "</a>";
             bottom3nav_area_content += "</td>";
            bottom3nav_area_content += "</tr>";
            
            smli = 0;
            
            while(smli > -1) {

             SMLI_OBJ = document.getElementById("SubMenuLinkItem" + mmli + smli);
             
             if(SMLI_OBJ) {
             
              smli_href = SMLI_OBJ.href;
              smli_target = SMLI_OBJ.target;
              
              smli_title = document.getElementById("SubMenuLinkTitle" + mmli + smli).innerHTML;
              smli_title = smli_title.replace("<b>", "");
              smli_title = smli_title.replace("</b>", "");
              smli_title = smli_title.replace("<B>", "");
              smli_title = smli_title.replace("</B>", "");
             
              bottom3nav_area_content += "<tr>";
               bottom3nav_area_content += "<td height=\"8\"></td>";
              bottom3nav_area_content += "</tr>";
            
              bottom3nav_area_content += "<tr>";
               bottom3nav_area_content += "<td>";
                bottom3nav_area_content += "<a class=\"BottomGrayMenu2\" href=\""+smli_href+"\" target=\""+smli_target+"\">";
                bottom3nav_area_content += smli_title;
                bottom3nav_area_content += "</a>";
               bottom3nav_area_content += "</td>";
              bottom3nav_area_content += "</tr>";
              
              smli++;
              
             }
             else {
              smli = -1;
             } 
             
            } // end while 
            
           bottom3nav_area_content += "</table>";
           
          bottom3nav_area_content += "</td>";
          
          mmli++;
       
       }
       else {
          mmli = -1;  
       }

       if(document.getElementById("MainMenuLinkItem" + mmli))
          bottom3nav_area_content += "<td valign=\"top\" class=\"VerGrayDottedSep\" width=\"10\">&nbsp;</td>";
       
    } // end while
       
    bottom3nav_area_content += "</tr>";
    bottom3nav_area_content += "</table>";
    
    document.getElementById("BottomNav3Area").innerHTML = bottom3nav_area_content;
 
 } // end function


 function HomeMediaBannerView() {
 
    HMBA = document.getElementById("HomeMediaBannerArea");
    
    if(HMBA) {
    
       HMBA.innerHTML = "<iframe name='HMBp' frameborder='0' width='238' height='175' scrolling='no' src='media_banner.php'></iframe>";
       
    } // end if
 
 } // end function


/* end */