var mclose="";
var t_out=null;
function openMenu(elem)
{
    var main_menus=["firm","portfolio","project","recogntn"];
	var dropdownid=elem.id+"_dd";
	var dropdown_elem=document.getElementById(dropdownid);
	if(dropdown_elem)
	{
		var disp_status=dropdown_elem.style.display;
		if(disp_status=="none") { dropdown_elem.style.display="block"; }
	}
    //Close other menus if not closed earlier
    for(i=0; i<main_menus.length; i++)
    {
        if(elem.id != main_menus[i])
        {
            var dd_elem = main_menus[i] + "_dd";
            if(document.getElementById(dd_elem))
                document.getElementById(dd_elem).style.display="none";
        }
    }	
}

function tryClosingParent(elem)
{
	//close the parent block after a predefined interval of time
	mclose=elem.parentNode.id;
	t_out=setTimeout("closeMenu()", 300);
	window.event.cancelBubble=true;
}

function tryClosingFirstChild(elem)
{
	//close the first child block after a predefined interval of time
	//alert(elem.parentNode.children.length);
	mclose=elem.parentNode.children[2].id;
	t_out=setTimeout("closeMenu()", 300);
}

function closeMenu()
{
	var close_block=document.getElementById(mclose);
	if(close_block)
		close_block.style.display="none";
}

function cancelHide()
{
	clearTimeout(t_out);
}

function extend(id)
{
    if(document.getElementById(id))
    {
        document.body.style.width="1240px";
        document.getElementById("logoCol").style.display="none";
        document.getElementById(id).style.display="block";
        document.getElementById("btn_extend").style.display="none";
        document.getElementById("btn_collapse").style.display="block";
    }
}

function collapse(id)
{
    if(document.getElementById(id))
    {
        document.body.style.width="1024px";
        document.getElementById("logoCol").style.display="block";
        document.getElementById(id).style.display="none";
        document.getElementById("btn_collapse").style.display="none";
        document.getElementById("btn_extend").style.display="block";
    }
}

function setMenuTitle(curr_item, menuid, title)
{
    var mid = document.getElementById(menuid);
    var arrow_div = menuid + "_rm";
    var blk = menuid + "_p";
    if(mid)
    {
        mid.innerHTML=title;
        mid.className="Div_Menu_Txt_Hl"
    }
    //document.getElementById(curr_item).style.display="none";
    document.getElementById(arrow_div).style.display="block";
    document.getElementById(blk).className="Div_Menu_Box_Hl";
}


function loadUrl(url)
{
    document.location.href=url;
}

function show(eid)
{
    if (document.getElementById(eid))
    {
        document.getElementById(eid).style.display="block";
    }
}

function hide(eid)
{
    if (document.getElementById(eid))
    {
        document.getElementById(eid).style.display="none";
    }
}

function changeImage(imgid, imgsrc)
{
    if(document.getElementById(imgid))
        document.getElementById(imgid).src = "cms/UploadedImages/" + imgsrc;
}

function changeImage1(imgid, imgsrc)
{
    if(document.getElementById(imgid))
        document.getElementById(imgid).src = "images/" + imgsrc;
}

function expAward(aid)
{
    var tgt = "openedAward_" + aid;
    var url = "expandAward.asp?awardid=" + aid;
    var red_band = "rd_" + aid;
    ajaxFunction(tgt,url);
    if(document.getElementById(red_band))
    {
        if(imgforaward > 0)
            document.getElementById(red_band).style.display="block";
    }
}

function expArticle(aid)
{
    var tgt = "openedArticle_" + aid;
    var url = "expandArticle.asp?articleid=" + aid;
    var red_band = "rd_" + aid;
    ajaxFunction(tgt,url);
    if(document.getElementById(red_band))
    {
        if(imgforaward > 0)
            document.getElementById(red_band).style.display="block";
    }
}

function expShow(eid)
{
    var tgt = "openedShow_" + eid;
    var url = "expandShow.asp?showid=" + eid;
    var red_band = "rd_" + eid;
    ajaxFunction(tgt,url);
    if(document.getElementById(red_band))
    {
        if(imgforaward > 0)
            document.getElementById(red_band).style.display="block";
    }
}

function expNews(enid)
{
    var tgt = "openedNews_" + enid;
    var url = "expandNews.asp?newsid=" + enid;
    var red_band = "rd_" + enid;
    ajaxFunction(tgt,url);
    if(document.getElementById(red_band))
    {
        if(imgforaward > 0)
            document.getElementById(red_band).style.display="block";
    }
}

function collapseShow(eid)
{
    var tgt = "openedShow_" + eid;
    var url = "collapseShow.asp?showid=" + eid;
    ajaxFunction(tgt,url);
}

function collapseAward(aid)
{
    var tgt = "openedAward_" + aid;
    var url = "collapseAward.asp?awardid=" + aid;
    ajaxFunction(tgt,url);
}

function collapseArticle(aid)
{
    var tgt = "openedArticle_" + aid;
    var url = "collapseArticle.asp?articleid=" + aid;
    ajaxFunction(tgt,url);
}

function collapseNews(enid)
{
    var tgt = "openedNews_" + enid;
    var url = "collapseNews.asp?newsid=" + enid;
    ajaxFunction(tgt,url);
}

function activateMember(mid, limg)
{
    url = "GetMemberData.asp?mid=" + mid;
    ajaxFunction("mem_data",url);
    enlarge(mid,limg);
}
