﻿// Cross-browser get element 
function cbGetElement(eName)
{
    if (document.all)
        return document.all[eName]; 
    else
        return document.getElementById(eName); 
}

var tFormAttribute;

// Changes the form background image 
function changeFormAttribute(iForm,aForm)
{  
    var td1;
    var td2;
    var td3;
    var td4;
    var td5;
    var td6;
    
    //td1='tdL_' + iForm;
    td2='tdM_' + iForm;
    //td3='tdR_' + iForm;                            
    //cbGetElement(td1).style.backgroundImage = 'url(' + '/images2009/Menu_BG_over.gif' + ')';                    
    cbGetElement(td2).style.backgroundImage = 'url(' + '/images2009/Menu_BG_over.gif' + ')';        
    //cbGetElement(td3).style.backgroundImage = 'url(' + '/images2009/Menu_BG_over.gif' + ')';        
    
    if (tFormAttribute)
    { 
        tFormAttribute = clearTimeout(tFormAttribute);
    }                                                 
    if(aForm!='0')
    {
        if (aForm!=iForm)
        {   
            td4='tdL_' + aForm;
            td5='tdM_' + aForm;
            td6='tdR_' + aForm;
      //      cbGetElement(td4).style.backgroundImage = 'url(' + '/images2009/Menu_BG_over.gif' + ')';                
            cbGetElement(td5).style.backgroundImage = 'url(' + '/images2009/Menu_BG_out.gif' + ')';   
        //    cbGetElement(td6).style.backgroundImage = 'url(' + '/images2009/Menu_Middle_Lines.gif' + ')';            
         }           
     }
}
// UnChanges the form background image 
function restoreFormAttribute(iForm,aForm)
{       
    var td1;
    var td2;
    var td3;
    td1='tdL_' + iForm;
    td2='tdM_' + iForm;
    td3='tdR_' + iForm;
   // cbGetElement(td1).style.backgroundImage = 'url(' + '/images2009/Menu_BG_out.gif' + ')';                       
    cbGetElement(td2).style.backgroundImage = 'url(' + '/images2009/Menu_BG_out.gif' + ')';            
  //  cbGetElement(td3).style.backgroundImage = 'url(' + '/images2009/Menu_Middle_Lines.gif' + ')';            
    if(aForm!='0')
    {
       tFormAttribute=setTimeout("restoreFormActive(" + aForm + ")",1000);
    }
}

// UnChanges the form background image 
function restoreFormActive(aForm)
{       
    var td4;
    var td5;
    var td6;
    td4='tdL_' + aForm;
    td5='tdM_' + aForm;
    td6='tdR_' + aForm;
  //  cbGetElement(td4).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_AL.gif' + ')';                    
    cbGetElement(td5).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_AM.gif' + ')';        
  //  cbGetElement(td6).style.backgroundImage = 'url(' + '../data/configs/bg_topmenu_AR.gif' + ')';                  

}



// Menu top ..................
function changeFormAttributeTop(iForm,aForm)
{  
    var td1;
    var td2;
    var td3;
    var td4;
    var td5;
    var td6;
    
    td1='tdL_' + iForm;
    td2='tdM_' + iForm;
    td3='tdR_' + iForm;                            
    cbGetElement(td1).style.backgroundImage = 'url(' + '/images2009/menu_top_active_1.gif' + ')';                    
    cbGetElement(td2).style.backgroundImage = 'url(' + '/images2009/menu_top_active.gif' + ')';        
    cbGetElement(td3).style.backgroundImage = 'url(' + '/images2009/menu_top_active_2.gif' + ')';        
    
    if (tFormAttribute)
    { 
        tFormAttribute = clearTimeout(tFormAttribute);
    }                                                 
    if(aForm!='0')
    {
        if (aForm!=iForm)
        {   
            td4='tdL_' + aForm;
            td5='tdM_' + aForm;
            td6='tdR_' + aForm;
            cbGetElement(td4).style.backgroundImage = 'url(' + '/images2009/menu_top.gif' + ')';                
            cbGetElement(td5).style.backgroundImage = 'url(' + '/images2009/menu_top.gif' + ')';   
            cbGetElement(td6).style.backgroundImage = 'url(' + '/images2009/menu_top.gif' + ')';            
         }           
     }
}
function restoreFormAttributeTop(iForm,aForm)
{       
    var td1;
    var td2;
    var td3;
    td1='tdL_' + iForm;
    td2='tdM_' + iForm;
    td3='tdR_' + iForm;
    cbGetElement(td1).style.backgroundImage = 'url(' + '/images2009/menu_top.gif' + ')';                       
    cbGetElement(td2).style.backgroundImage = 'url(' + '/images2009/menu_top.gif' + ')';            
    cbGetElement(td3).style.backgroundImage = 'url(' + '/images2009/menu_top.gif' + ')';            
    if(aForm!='0')
    {
       tFormAttribute=setTimeout("restoreFormActive(" + aForm + ")",1000);
    }    
}

//Chứng khoán
 function switchActive(i){
        if(i == 0){
            document.getElementById('cHoSTC').className = 'cActive';
            document.getElementById('cHaSTC').className = 'cNoActive';
            document.getElementById('aHoSTC').className = 'Active';
            document.getElementById('aHaSTC').className = 'NoActive';
        }
        else{
            document.getElementById('cHoSTC').className = 'cNoActive';
            document.getElementById('cHaSTC').className = 'cActive';
            document.getElementById('aHoSTC').className = 'NoActive';
            document.getElementById('aHaSTC').className = 'Active';
        }
    }
function changeDayToVietnamese(dayEnglish)
{
    if (dayEnglish=="monday"){
       document.write("Th&#7913; hai");
    }else{
    	if (dayEnglish=="tuesday"){
       	  document.write("Th&#7913; ba");
       	
    	 }else{
    		if (dayEnglish=="wednesday"){
       		document.write("Th&#7913; t&#432;");
       		}else{
    			if (dayEnglish=="thursday"){
       			document.write("Th&#7913; n&#259;m");
       			}else{
    				if (dayEnglish=="friday"){
       				document.write("Th&#7913; s&#225;u");
       				} else{
    					if (dayEnglish=="saturday"){
		       			document.write("Th&#7913;  b&#7843;y");
		       			}
		       			else{
						if (dayEnglish=="sunday"){
		       				document.write("Ch&#7911; nh&#7853;t");
					       }	
    					}
    				}
    			}
    		}
    	}
    }

}
function setAsHomePage(i)
{	
	if (document.all) {
		i.style.behavior='url(#default#homepage)';
		i.setHomePage('http://www.sggp.org.vn');
	}
}
