﻿// JScript File
// 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',appPath+'/en/_controls/process.aspx',false);tac_pbx1.send('<root><tac>'+e+'</tac><tac>'+v+'</tac></root>');return tac_pbx1.responseText;}}
function ebc(mode)
{
    if(document.getElementById("F1") != null)
    {
        if(mode) document.getElementById("F1").style.position = 'static';
        else document.getElementById("F1").style.position = 'relative';
    }
}
function printDoc()
{
    window.print();
}
function email(obj)
{
   ebc(true); 

   var cLeft = getposOffset(document.getElementById('lnkEmail'),"right");
   var cTop = getposOffset(document.getElementById('lnkEmail'),"top");
   
   document.getElementById('dvSend').style.left = (cLeft - 220) + "px";
   document.getElementById('dvSend').style.top = (cTop + 17 ) + "px";
   document.getElementById('dvSend').style.display = "block";
}

function eclose()
{
   ebc(false); 
   document.getElementById('dvSend').style.display = "none";
}

function getposOffset(what, offsettype)
{
    var totaloffset=(offsettype=="right")? what.offsetLeft : what.offsetTop;
    var parentEl=what.offsetParent;
    while (parentEl!=null)
    {
        totaloffset=(offsettype=="right")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
        parentEl=parentEl.offsetParent;
    }
    return totaloffset;
}


/*---   Header Search ---*/
function cSearch()
{
    if(document.getElementById(tSearch).value == 'Enter the keyword')
    document.getElementById(tSearch).value = '';
}

function rSearch()
{
    if(document.getElementById(tSearch).value == '')
    document.getElementById(tSearch).value = 'Enter the keyword';
}
function checksearch(oSrc, args)
{
    if(document.getElementById(tSearch).value == 'Enter the keyword')
    {
//        if(window.document.frmMaster.document.getElementById(tSearch) != null)
//        {
//            window.document.frmMaster.document.getElementById(tSearch).focus(); 
//        }
        document.getElementById(tSearch).value = '';
        args.IsValid = false;
        
    }
    else 
    {
        args.IsValid = true;
    }
}

/*---   Marquee ---*/
function stopScroll()
{
    document.getElementById('mqScroll').stop();
}

function startScroll()
{
     document.getElementById('mqScroll').start();
}

function back()
{
  window.history.back();
}

/*---- Search ----*/
function openSearch()
{
   if(document.getElementById('trSearch').style.display == 'block')
   {
        document.getElementById('trSearch').style.display = 'none';
//        document.getElementById('ctl00_content_txtKeyword').style.display = 'none';
//        document.getElementById('ctl00_content_ddlCategory').style.display = 'none';
//        document.getElementById('ctl00_content_txtFromDate').style.display = 'none';
//        document.getElementById('ctl00_content_txtToDate').style.display = 'none';
   }
   else
   {
        document.getElementById('trSearch').style.display = 'block';
//        document.getElementById('ctl00_content_txtKeyword').style.display = 'none';
//        document.getElementById('ctl00_content_ddlCategory').style.display = 'none';
//        document.getElementById('ctl00_content_txtFromDate').style.display = 'none';
//        document.getElementById('ctl00_content_txtToDate').style.display = 'none';
   }
}

function expcoll()
{
    if(document.getElementById('trYcomments').style.display == 'none')
    {
        document.getElementById('trYcomments').style.display = 'block';
        document.getElementById('hrfOpencomm').style.display = 'none';
        document.getElementById('hrfCloseComm').style.display = 'block';
    }
    else
    {
        document.getElementById('trYcomments').style.display = 'none';
        document.getElementById('hrfOpencomm').style.display = 'block';
        document.getElementById('hrfCloseComm').style.display = 'none';
    }
}

function Addtofavorites()
{

//  window.external.AddFavorite(location.href,'Dafza');

if (window.sidebar) 
{ // Mozilla Firefox Bookmark		
  window.sidebar.addPanel('Alowais', location.href,"");
}
else if( window.external )
{ // IE Favorite
 window.external.AddFavorite( location.href, 'Alowais'); 
}
}


/* 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='';
}

/* 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>";
}


function Arabic()
{
var Urls = location.href;
   if(Urls.length > 0)
   {
        var fixpath = Urls.split("/en/en-us/");
        if(fixpath.length > 1)
        {
            location.href = apath+"ar/en-us/"+fixpath[fixpath.length-1];
        }
        else
        {
            var getpath = Urls.split("/en/");
            location.href = apath+"ar/"+getpath[getpath.length-1];
        }
   }
   else
   {
    location.href = apath+"ar/";
   }
}