﻿var dom = (document.getElementById) ? true : false;
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;

   
 /*---- use width=..px to give an exact dimension-------*/  
 /*---- use width=100% for no scaling-------*/  
 
    function InsertFlash(name,id,width,height,bgcolor)
    {
    if (!width) width="100%";
    if (!height) height="100%";
    if (!id) id="FlashViewer"; 
     document.write("<object id='"+id+"' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' width='"+width+"' height='"+height+"' codebase='http://active.macromedia.com/flash5/cabs/swflash.cab#version=7,0,0,0'>");
     document.write("<param name='MOVIE' value='"+name+"' />");
     document.write("<param name='PLAY' value='true' />");
     document.write("<param name='LOOP' value='true' />");
     if (bgcolor) document.write("<param name='bgcolor' value='"+bgcolor+"' />");
     document.write("<param name='QUALITY' value='high' />");
     var bgs="";
     if (bgcolor) bgs="bgcolor='"+bgcolor+"' ";     
     //document.write("<embed src='"+name+"' id='"+id+"Embed' "+bgs+"quality='high' width='"+width+"' height='"+height+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
     document.write("<embed src='"+name+"' id='"+id+"Embed' "+bgs+"quality='high' width='"+width+"' height='"+height+" type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
     document.write("</object>");
    }
    
    
    function ActivateFlashMovie(text)
{
   panel=document.getElementById('ViewerPanel');
   if (panel) panel.style.display='block';
   flashViewer=document.getElementById('FlashViewer');
   if (flashViewer) flashViewer.movie=text;
   flashViewer=document.getElementById('FlashViewerEmbed');
   if (flashViewer)  flashViewer.src=text;
   if (flashViewer)  flashViewer.play='true';
 }
    
    /*---- Search section ----Start-------*/
    var theForm = document.forms['aspnetForm'];
    if (!theForm) {  theForm = document.aspnetForm; }
    function OnSearchPressed(e) 
    {
        var theKey;
        if(e.keyCode)
            theKey = e.keyCode;
        else 
            theKey = e.which;
        
        if (theKey == 13)
        {
            var word=document.aspnetForm.TextBoxSearch.value;
            if (word)
                window.open("http://www.google.com/search?hl=en&q=" + word + "+site%3ahttp%3a%2f%2fwww.novabrain.com", "_blank","left=0,top=0,screenX=0,screenY=0,toolbar=1,status=1,scrollbars=1,resizable=yes,width=765,height=500");
            return false;
        }
    }
/*---- Search section ----End-------*/

 
/*---- Expend and Collapse Element ----Start-------*/
    function CollapseExpand(elemName, imgName)
    {
        var elem;
        var img;

        if(document.getElementById)
        {
            elem = document.getElementById(elemName);
            img = document.getElementById(imgName);
        }
        else if(document.all)
        {
            elem = document.all[elemName];
            img = document.all[imgName];
        }
                
        if(elem.style.display == "none")
        {
            elem.style.display = "block";
            img.src = "../Images/Bullets/expanded.png";
        }
        else
        {
            elem.style.display = "none";
            img.src = "../Images/Bullets/collapsed.png";
        }
    }
    
    function NoOp()
    {
    }
/*---- Expend and Collapse Element ----End-------*/
    
    
/*  To be removed and replaced with the PopBox javascript  */
    function OpenScreenShot(url)    
    {
        window.open(url,"_blank","left=0,top=0,screenX=0,screenY=0,toolbar=0,status=0,scrollbars=1,resizable=yes,width=1074,height=818");    
    }
    
    function LaunchFlashViewer(clip,width,heigth)    
    {
    if (!width) width=900;
    if (!heigth) heigth=720;
     var array=location.href.split("novabrain.com");
     var url=array[0]+"novabrain.com/Media/Viewers/FlashViewer.aspx?file="+clip; 

     window.open(url,"_blank","toolbar=0,left=100,top=100,status=0,scrollbars=0,resizable=yes,width="+width+",height="+heigth);    

return false;
    }
    
    function LaunchPlayListViewer(playlist,movieTitle)    
    {
    
     var array=location.href.split("novabrain.com");
     var url=array[0]+"novabrain.com/Media/Viewers/PlayListViewer.aspx?File=" + playlist;
     if(movieTitle) url = url + "&movie="+ movieTitle;
     window.open(url,"_blank","toolbar=0,left=100,top=100,status=0,scrollbars=1,resizable=yes,width=1074,height=720");    
  return false;
    }