﻿// JScript File

 var tac_pbx1,tac_pba1;/*@cc_on @*//*@if(@_jscript_version>=5)try{tac_pbx1=new ActiveXObject('msxml2.xmlhttp')}catch(e){try{tac_pbx1=new ActiveXObject('Microsoft.XMLHTTP')}catch(e){}}@else;tac_pbx1=false;tac_pba1=true;@end;@*/if(!tac_pbx1&&!tac_pba1)
{try{tac_pbx1=new XMLHttpRequest();}catch(e){}}
function tac_post(e,v)
{
    if(tac_pbx1)
    {
        tac_pbx1.open('POST', apath + 'ar/_controls/process.aspx',false);
        tac_pbx1.send('<root><tac>'+e+'</tac><tac>'+v+'</tac></root>');
        return tac_pbx1.responseText;
    }
}
 /* Rotating News */
 
var currentquote=0;	
function switchWhispers()
{
  var cnt = document.getElementById('ctl00_content_home_whisperslogin_hidWhispers').value.split('^').length;
  if(cnt > 0)
  {
    setQuote(currentquote);
    currentquote++;
    if(currentquote==cnt) currentquote=0;
  }
}
function setQuote(nId)
{
  var data = document.getElementById('ctl00_content_home_whisperslogin_hidWhispers').value.split('^');
  var uniq = data[nId].split('~');
  document.getElementById('ctl00_content_home_whisperslogin_lblWhisper').innerHTML=data[nId].substring(0,data[nId].length-5);
  document.getElementById('ctl00_content_home_whisperslogin_hrfMore').href =  "/ar/news/"+uniq[1] +".aspx"; 
}   


/* Send To Friend */
function printDoc()
{
    window.print();
}

function email(obj)
{
   eLoginclose() 
   ebc(true); 

   var cLeft = getposOffset(document.getElementById('lnkEmail'),"left");
   var cTop = getposOffset(document.getElementById('lnkEmail'),"top");
   
   document.getElementById('dvSend').style.left = (cLeft - 200) + "px";
   document.getElementById('dvSend').style.top = (cTop + 17 ) + "px";
   document.getElementById('dvSend').style.display = "block";
}

function eclose()
{
   ebc(false); 
   if(document.getElementById('dvSend') != null)
   {
    document.getElementById('dvSend').style.display = "none";
   }
}
function getposOffset(what, offsettype)
{
    var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null)
    {
        totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
    }
    return totaloffset;
}
function ebc(mode)
{
    if(document.getElementById("F1") != null)
    {
        if(mode) document.getElementById("F1").style.position = 'static';
        else document.getElementById("F1").style.position = 'relative';
    }
}


function Login(obj)
{
   eclose();
   ebc(true); 

   var cLeft = getposOffset(document.getElementById('lnkLogin'),"left");
   var cTop = getposOffset(document.getElementById('lnkLogin'),"top");
   
   document.getElementById('dvLogin').style.left = (cLeft - 15) + "px";
   document.getElementById('dvLogin').style.top = (cTop + 17 ) + "px";
   document.getElementById('dvLogin').style.display = "block";
}

function eLoginclose()
{
   ebc(false); 
   if(document.getElementById('dvLogin')!=null)
   {
    document.getElementById('dvLogin').style.display = "none";
   }
  
}
/* New Mouse over and Mouse Out */
var expandRow;
function BLOver(obj)
{
   // obj.className = 'BListOver';
   //alert('over');
   
    var trNormal=obj.rows[0].id;
    var trmore= obj.rows[1].id;
    var prevMoreRow=document.getElementById('ctl00_content_hidPrevMoreRow').value;
    var prevNormalRow=document.getElementById('ctl00_content_hidPrevNormalRow').value;
    if(prevMoreRow != '')
    {
     document.getElementById(prevMoreRow).style.display='none';
     document.getElementById(prevNormalRow).style.display='';
     
     //document.getElementById(trNormal).style.display='none';
     //document.getElementById(trmore).style.display='';
     //document.getElementById('ctl00_content_hidPrevNormalRow').value=obj.rows[0].id;
     //document.getElementById('ctl00_content_hidPrevMoreRow').value=obj.rows[1].id;
     
    }
    else
    {
     
     
     document.getElementById('ctl00_content_hidPrevNormalRow').value=obj.rows[0].id;
     document.getElementById('ctl00_content_hidPrevMoreRow').value=obj.rows[1].id;
    }
     document.getElementById(trNormal).style.display='none';
     document.getElementById(trmore).style.display='';
     
     document.getElementById('ctl00_content_hidPrevNormalRow').value=obj.rows[0].id;
     document.getElementById('ctl00_content_hidPrevMoreRow').value=obj.rows[1].id;
    
    
    
    
    
    //alert(answer);
}
function BLOut(obj)
{
}
//function BLOut(obj)
//{
//    //obj.className = 'BListOut';
//    //alert('out');
//    var trNormal=obj.rows[0].id;
//    var trmore= obj.rows[1].id;
//    document.getElementById(trNormal).style.display='';
//    document.getElementById(trmore).style.display='none';
//}
function HnewsOver(obj)
{
 obj.className = 'hnewsOver';
 //alert(obj.rows[1].cells[0].innerHTML);
 obj.rows[1].cells[0].className='hnewsOverdesc';
}
function HnewsOut(obj)
{
 obj.className = '';
 obj.rows[1].cells[0].className='news_content';
}

/* Artricles Advanced Search */
function ShowAdvancedSearch1()
{
     document.getElementById('ctl00_content_articles_trNormalSearch').style.display='none';
     document.getElementById('ctl00_content_articles_trAdvSearch').style.display='';
     document.getElementById('ctl00_content_articles_trAdvSearch1').style.display='';
     document.getElementById('ctl00_content_articles_hidAdvSearch').value="1"
}
function HideAdvancedSearch1()
{
     document.getElementById('ctl00_content_articles_trNormalSearch').style.display='';
     document.getElementById('ctl00_content_articles_trAdvSearch').style.display='none';
     document.getElementById('ctl00_content_articles_trAdvSearch1').style.display='none';
     
     document.getElementById('ctl00_content_articles_hidAdvSearch').value="0"
}

function ShowAdvancedSearch()
{
     document.getElementById('ctl00_content_trNormalSearch').style.display='none';
     document.getElementById('ctl00_content_trAdvSearch').style.display='';
     document.getElementById('ctl00_content_trAdvSearch1').style.display='';
     document.getElementById('ctl00_content_hidAdvSearch').value="1"
}
function HideAdvancedSearch()
{
     document.getElementById('ctl00_content_trNormalSearch').style.display='';
     document.getElementById('ctl00_content_trAdvSearch').style.display='none';
     document.getElementById('ctl00_content_trAdvSearch1').style.display='none';
     
     document.getElementById('ctl00_content_hidAdvSearch').value="0"
}

function ARlistOut(obj)
{
 obj.className = '';
// obj.rows[1].cells[0].className='hnewsOverdesc';
}
function ARlistOver(obj)
{
 obj.className = 'artlistover';
 //obj.rows[1].cells[0].className='news_content';
}
/* News letter */
function checkmail(oSrc, args)
{
    if(document.getElementById(tNletter).value == 'أدخل عنوان بريدك الالكتروني')
    {
        document.getElementById(tNletter).value = '';
        args.IsValid = false;
        ValidatorEnable(document.getElementById(reVal), false);
    }
    else 
    {
        args.IsValid = true;
        ValidatorEnable(document.getElementById(reVal), true);
    }
}
function cmail()
{
    if(document.getElementById(tNletter).value == 'أدخل عنوان بريدك الالكتروني')
    document.getElementById(tNletter).value = '';
}

function rmail()
{
    if(document.getElementById(tNletter).value == '')
    document.getElementById(tNletter).value = 'أدخل عنوان بريدك الالكتروني';
}
function cSearch()
{
    if(document.getElementById(tSearch).value == 'أدخل الكلمات الرئيسية')
    document.getElementById(tSearch).value = '';
}

function rSearch()
{
    if(document.getElementById(tSearch).value == '')
    document.getElementById(tSearch).value = 'أدخل الكلمات الرئيسية';
}
function checksearch(oSrc, args)
{
    if(document.getElementById(tSearch).value == 'أدخل الكلمات الرئيسية')
    {
        document.getElementById(tSearch).value = '';
        args.IsValid = false;
    }
    else
    {
        args.IsValid = true;
    }
}
function LogOut()
{
 var rtn=tac_post("on_logout",'');
 if(rtn=="1")
 {
  var url = location.href;
  alert("تم تسجيل الخروج بنجاح ");
  location.href=url;
 }
 else
 {
  var url = location.href;
  alert("تم تسجيل الخروج بنجاح ");
  location.href=url;
 }
}

/* Back function */
function back()
{
    history.back(-1);
}

/* Show video Scripts */
function PlayMovie(filename)
{
    Ovideo();
    var player=document.getElementById('flvPlayer');
    player.innerHTML="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='387' height='302' bgcolor='#000000' id='myFlashMovie' name='myFlashMovie'><param name='movie' value='/downloads/zoom.swf' /><param name='FlashVars' value='videos=/downloads/files/"+ filename+"&fms=&app=' /><param name='allowFullScreen' value='true' /><param name='quality' value='high'/><embed src='/downloads/zoom.swf' width='387' height='302' bgcolor='#000000' flashvars='videos=/downloads/files/" + filename +"&fms=&app=' allowfullscreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'  id='myFlashMovie' name='myFlashMovie'/></object>";
}
function setScroll()
{
    var tPos = (screen.availHeight) ? (screen.availHeight - 500)/2 : 0;
    tPos += document.documentElement.scrollTop;
    document.getElementById('nxt').style.top = tPos + "px";
}
function fixScroll()
{
      document.getElementById('main1').style.height = document.getElementById('tblHome').offsetHeight;
      document.getElementById('main1').style.width = screen.width-23;
      var lPos = (screen.width) ? (screen.width-300)/2 : 0;
      document.getElementById('nxt').style.left = lPos +'px';
      var tPos = (screen.availHeight) ? (screen.availHeight - 500)/2 : 0;
      document.getElementById('nxt').style.top = tPos+'px';
      

      var cleft=0;
      var cTop=0;
      var obj = document.getElementById('tdContent');
      if(obj != null)
        {
        if(obj.offsetParent)
        {
           
            while(true) 
            {
                cleft += obj.offsetLeft;
                cTop+=obj.offsetTop;
                if(!obj.offsetParent) break;
                obj = obj.offsetParent;
            }
        }
       }
}
function Ovideo()
{
     document.getElementById('main1').style.display = 'block';
     document.getElementById('nxt').style.display = 'block';
}
function Cvideo()
{
    document.getElementById('main1').style.display = 'none';
    document.getElementById('nxt').style.display = 'none';
    var player=document.getElementById('flvPlayer');
    player.innerHTML='';
}

/* LAnguage Match */
var apath="/"
function English()
    {
       var Urls = location.href;
       if(Urls.length > 0)
       {
            var fixpath = Urls.split("/ar/ar-ae/");
            if(fixpath.length > 1)
            {
                location.href = apath+"en/en-us/"+fixpath[fixpath.length-1];
            }
            else
            {
                var fixpath = Urls.split("/ar/");
                if(fixpath.length > 1)
                {
                    location.href = apath+"en/"+fixpath[fixpath.length-1];
                }
            }
       }
       else
       {
        location.href = apath+"en/";
       }
    }
/* LAnguage Match End */

function sbc(mode)
    {
        if(document.getElementById("F3") != null)
        {
            if(mode) document.getElementById("F3").style.position = 'static';
            else document.getElementById("F3").style.position = 'relative';
        }
    }
 /* Rotating Banner */
 
var currentBanner=0;	
function switchBnners(hiddenBanners)
{
    if(document.getElementById(hidBanners) != null)
    {
      document.getElementById(hidBanners).value = hiddenBanners;
      var cnt = document.getElementById(hidBanners).value.split('@').length;
      if(cnt > 0)
      {
        setBanner(currentBanner);
        currentBanner++;
        if(currentBanner==cnt) currentBanner=0;
      }
    }
}
function setBanner(nId)
{
  var data = document.getElementById(hidBanners).value.split('@');
  var uniq = data[nId].split(',');
  if(uniq[4] == "False")
  {
    document.getElementById(bImage).style.display = 'block';
    document.getElementById(bImagePlane).style.display = 'none';
   
    document.getElementById(bImage).src = uniq[1];
    document.getElementById(hrefbImage).enabled = 'true';
    if(uniq[3].length > 7)
    {
        document.getElementById(hrefbImage).href = uniq[3];
        document.getElementById(hrefbImage).target = "_blank"
    }
    else
    {
        document.getElementById(bImage).style.display = 'none';
        document.getElementById(bImagePlane).style.display = 'block';
   
        document.getElementById(bImagePlane).src = uniq[1];
    }
    
  }
  else
  {
    document.getElementById(bImage).style.display = 'none';
    document.getElementById(bImagePlane).style.display = 'block';
   
    document.getElementById(bImagePlane).src = uniq[1];
  }
}

/* New Video Gallery */
function PlayMovie1(filename)
{
    Ovideo();
    var player=document.getElementById('flvPlayer');
    player.innerHTML="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='387' height='302' bgcolor='#000000' id='myFlashMovie' name='myFlashMovie'><param name='movie' value='" + apath+"downloads/zoom.swf' /><param name='FlashVars' value='videos="+ filename+"&fms=&app=' /><param name='allowFullScreen' value='true' /><param name='quality' value='high'/><embed src='"+ apath + "downloads/zoom.swf' width='387' height='302' bgcolor='#000000' flashvars='videos=" + filename +"&fms=&app=' allowfullscreen='true' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'  id='myFlashMovie' name='myFlashMovie'/></object>";
} 