﻿// JScript File
 function hs(obj,pro){
     var dt = $(obj); 
    if(pro == 0)
    {
        dt.style.visibility = 'hidden'; 
    }
    else
    {
         dt.style.visibility = 'visible'; 
    }   
 }
  
function setDivs()
    {
        var menu = $('menu');
        var divs = menu.getElementsByTagName('div');
        for(var i=0; i<divs.length; i++)
        {                                    
            divs[i].className = "menuDyn";
            
            divs[i].onmouseover = function(){hs(this.id, 1)};
            divs[i].onmouseout = function(){hs(this.id, 0)};
            
            if(divs[i].id.length > 2)
            {
                divs[i].parentNode.style.verticalAlign = 'top';
                divs[i].style.marginTop = '-4px';
            }           
        }
    }
    function tbl()
    {
        var col = "<table>";
        for (i=0;i<tbl.arguments.length;i++){
            col += "<tr><td><a href='myAccount-edit.aspx?stage=" + tbl.arguments[i] + "</a></td></tr>";		
			}   
		col += "</table>"; 
		document.write(col);
		return col;    
    }   
 
    function loader(where, type)
    {
        var menu = $(where);     
        if(menu.innerHTML.length < 6)
        {
            if(logstat < 1)
            {
               menu.innerHTML = "<a href='login.aspx'>Please&nbsp;login&nbsp;first</a>"; 
            }
            else
            {
            var menureq = new Ajax.Updater(where, 'mn.aspx',{method: 'get', parameters: 'gt=' + type + '&dm=' + new Date().getTime()}); 
            menu.innerHTML = "<img src='images/in.gif' />&nbsp;loading...";    
            }     
        }
        hs(where, 1);
    }
    function log()
    {
    var account = $('s4'); 
    var rows = account.getElementsByTagName('tr');
        
        if(rows.length == 7)
        {
            if(logstat == 0)
        {        
            account.innerHTML = "<table>" + rows[rows.length - 1].innerHTML + "</table>";
        }
        else if(logstat == 2)
        {
            var link = rows[rows.length -1].getElementsByTagName('a');
            link[0].innerHTML = "log out";
            link[0].href += "?do=logout";
        }
        }
    
    }