// JavaScript Document

var menuId=null;
var menuHd=null;
var menuLastObj=null;

function ShowMenu(arr,top,left){
        
       
          var L,T;
            if(top>0 || left>0){
                T=top;
                L=left;
            }
           else
            if(navigator.userAgent.indexOf("MSIE")>=0){
                L=event.clientX;
                T=event.clientY;
            }
            else{
                L=e.clientX;
                T=e.clientY;
            }
            
        var t=document.createElement("table");
       
        var b=document.createElement("tbody");
        t.appendChild(b);
        var tr=document.createElement("tr");
       
        for(var i=0;i<parseInt(arr.length);i++)
        {
        var td = document.createElement("td");
        td.style.textAlign="center";
            var arrdata=arr[i].split(",");
            if(arr[i]!=""){
                 var col0=arrdata[0];
                  var col1=arrdata[1];
                  
                td.innerHTML= col0;
                td.id=col1;
                
                
                var w=parseInt(col0.length)*7;
                td.style.width= w+"px";
//                td.className="tdvisited";
                td.onmouseover=function(){MenuRH(this)}
                td.onmouseout=function(){MenuRO(this)}
                td.onclick=function(){move(this.id)}
                td.style.fontFamily="Arial";
                td.style.fontSize="8pt";
                td.style.fontWeight="Bold";
                td.style.color="#ffffff";
                }
             tr.appendChild(td);
             b.appendChild(tr);
             
        }
        var d=document.createElement('div');
         
        d.id="cMenu";
        d.appendChild(t);
        d.style.position="absolute";
        document.body.appendChild(d);
        d.style.width="1000px";
        d.style.backgroundColor="#b2975d";
        d.style.left=L+"px";
        
        d.style.top=T+"px"; 
           


//        var d=document.createElement('iframe');
//        d.id="cMenu";
//        d.appendChild(t);
       
}

function HideMenu(){
    
    if(document.getElementById("cMenu")){
        
        document.body.removeChild(document.getElementById("cMenu"));
        }
        if(menuLastObj){
            MenuHO(menuLastObj);
            menuLastObj=null;
        }
        
        if(menuId){
            clearTimeout(menuId);
            menuId=null;
        }
    
}

function MenuRH(obj){
//    obj.style.backgroundColor="#660066";
if(obj.style.color=='#ffffff'){
    obj.style.color='#000000';
    obj.style.cursor='pointer';
    }
    
    MenuHF();
}

function MenuRO(obj){
if(obj.style.color=='#000000'){
    obj.style.backgroundColor="Transparent";
    obj.style.color='#ffffff';
    }
}

function MenuHH(obj){
    obj.style.color="#000000";
    menuLastObj=obj;
    MenuHF();
}

function MenuHO(obj){
    obj.style.color="#ffffff";
}

function MenuHF(){
    if(menuHd){
        clearTimeout(menuHd);
        menuHd=null;
    }
}

function MenuHL(){
    menuHd=setTimeout(HideMenu,500);
}

function MenuMain(opt){
 switch(opt){
        case 1:
            
            var arr=new Array(7);
            arr[0]="Index,#indices";
            arr[1]="Top Gainers/Losers,#topGL";
            arr[2]="52Week High/Low,#highlow";
            arr[3]="Advance/Decline,#AdvanceDecline";
            arr[4]="Circuit Filter,#Circiut";
            arr[5]="FII Activity,#Fii" ;
            arr[6]="MWPL,#mwpl";
            
            ShowMenu(arr,93,0);
            break;
         
        case 2:
           var arr=new Array(2);
            arr[0]="Place Buy Order";
            arr[1]="Place Sell Order";
             ShowMenu(arr,93,0);
            
            break;
      
        case 3:
            var arr=new Array(8);
            arr[0]="Company Info,CompanyInfo.aspx";
            arr[1]="FIIs Activity,FIIActivity.aspx";
            arr[2]="Charting,#";
            arr[3]="IPO,IPO.aspx";
            arr[4]="MF In/Out,#";
            arr[5]="Results,#";
            arr[6]="Price Watch,#";
            arr[7]="Commodity,#";
            ShowMenu(arr,93,0);
            break;
       
        case 4:
             var arr=new Array(10);
            arr[0]="NSE Announcement,NSEAnnouncement.aspx";
            arr[1]="BSE Announcement,BSEAnnouncement.aspx";
            arr[2]="Press Digest,#";
            arr[3]="Foreign News,ForeignNews.aspx";
            arr[4]="Bullion,#";
            arr[5]="Call Money,#";
            arr[6]="Economy News,EconomyNews.aspx";
            arr[7]="Sectoral News,#";
            arr[8]="IPO News,IPONews.aspx";
            arr[9]="Hot Persuit,#";
            ShowMenu(arr,93,0);
            break;
   
        case 5:
         var arr=new Array(5);
            arr[0]="Daily RoundUp,DailyRoundUp.aspx";
            arr[1]="Economic View,EconomicReport.aspx";
            arr[2]="Monthly Report,MonthlyReport.aspx";
            arr[3]="Research Report,ResearchReport.aspx";
            arr[4]="Special Report,#";
            ShowMenu(arr,93,0);
            break;
       
        case 6:
            var arr=new Array(7);
            arr[0]="Portfolios,#";
            arr[1]="Trading Tools,#";
            arr[2]="Community Forums,#";
            arr[3]="Education,#";
            arr[4]="Quote Traders,#";
            arr[5]="Mobile Quotes,#";
            arr[6]="Dummy Derivatives,DerivativesDummy.aspx";
            
            ShowMenu(arr,93,0);
            break;
     
        case 7:
           var arr=new Array(4);
            arr[0]="Trade Login,#";
            arr[1]="Client BackOffice gin,#";
            arr[2]="Branch Login,#";
            arr[3]="Mutual Fund Home Dummy,MFHome.aspx";
            ShowMenu(arr,93,0);
            break;
      
        case 8:
           var arr=new Array(6);
            arr[0]="Gainers & Losers,#";
            arr[1]="Top Traded Value,#";
            arr[2]="Advances & Declines,#";
            arr[3]="Closing Price,#";
            arr[4]="Highs & Lows,#";
            arr[5]="Technical Chart,#";
            ShowMenu(arr,93,0);
            break;
         
        case 9:
         var arr=new Array(1);
            arr[0]="&nbsp;";
           ShowMenu(arr,108,0);
            break;
            
        case 10:
         var arr=new Array(1);
            arr[0]="&nbsp;";
           ShowMenu(arr,88,0);
            break;
            
         }
 }
    
    
function move(url)
{
window.location.href=url;
}

function over(obj)
{
if(obj.style.backgroundImage=="url(Images1/Greay1.gif)")
{
obj.style.backgroundColor="#000000";
obj.style.backgroundImage="url(Images1/Black2.gif)";
obj.style.backgroundPosition="0px 0px";
obj.style.backgroundRepeat="no-repeat";           
}
}   


function over1(obj){
if(obj.style.backgroundImage=="url(Images1/Greay2.gif)")
{

obj.style.backgroundImage="url(Images1/Black.gif)";
obj.style.backgroundPosition="100% 0px";
obj.style.backgroundRepeat="no-repeat";  
}
}

function out(obj){
if(obj.style.backgroundImage=="url(Images1/Black2.gif)")
{
obj.style.backgroundColor="#666666";
obj.style.backgroundImage="url(Images1/Greay1.gif)";
obj.style.backgroundPosition="0px 0px";
obj.style.backgroundRepeat="no-repeat";           
}
}

function out1(obj){
if(obj.style.backgroundImage=="url(Images1/Black.gif)")
{
obj.style.backgroundImage="url(Images1/Greay2.gif)";
obj.style.backgroundPosition="100% 0px";
obj.style.backgroundRepeat="no-repeat"; 
}
}

function Refresh(){
	
			document.getElementById("d91").style.backgroundImage="url(Images1/Golden2.gif)";
            document.getElementById("d92").style.backgroundImage="url(Images1/Golden.gif)";
            document.getElementById("d91").style.backgroundColor="#b2975d";
            document.getElementById("d91").style.height="30px";
            document.getElementById("d91").style.backgroundRepeat="no-repeat";
            document.getElementById("d91").style.backgroundPosition="0px 0px";
            document.getElementById("d92").style.backgroundRepeat="no-repeat";
            document.getElementById("d92").style.backgroundPosition="100% 0px";
            document.getElementById("d91").style.backgroundImage="url(Images1/Golden2.gif)";
            document.getElementById("d92").style.backgroundImage="url(Images1/Golden.gif)";
            
            MenuMain(9);
	
}
