function getposOffset(overlay, offsettype)
{
        var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
        var parentEl=overlay.offsetParent;
        while (parentEl!=null)
        {
                totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
                parentEl=parentEl.offsetParent;
        }
        return totaloffset;
}

function overlay(curobj, subobjstr, opt_position)
{
        if (document.getElementById)
        {
                var subobj=document.getElementById(subobjstr);
                subobj.style.display=(subobj.style.display!="block")? "block" : "none";
                var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0);
                var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0);
                subobj.style.left=xpos+"px";
                subobj.style.top=ypos+"px";
                if(document.getElementById("DivShim"))
                {
                        var ifrRef = document.getElementById("DivShim");
                        ifrRef.style.width = subobj.offsetWidth;
                        ifrRef.style.height = subobj.offsetHeight;
                        ifrRef.style.top = subobj.style.top;
                        ifrRef.style.left = subobj.style.left;
                        ifrRef.style.marginTop = subobj.style.marginTop;
                        ifrRef.style.marginBottom = subobj.style.marginBottom;
                        ifrRef.style.marginLeft = subobj.style.marginLeft;
                        ifrRef.style.marginRight = subobj.style.marginRight;
                        ifrRef.style.display = subobj.style.display;
                        ifrRef.style.zIndex = 1;
                        subobj.style.zIndex = 2;
                }

//              return false;
        }
        else return true;
}


function overlayclose(subobj)
{
        var min,max,str_min,str_max;
        min = parseInt(document.getElementById("qm").value);
        max = parseInt(document.getElementById("qx").value);

        if(min>=1)
        {
                if(min == 12477)
                {
                        str_min = '< 50K';
                        min = '< 50,000';
                }
                else
                {
                        str_min = min+'L';
                        min = min+'L';
                }


                if(max>=1)
                {
                        if(max == 12477)
                        {
                                str_max = '< 50K';
                                max = '< 50Th';
                        }
                        else if(max == 10000000)
                        {
                                str_max = '> 50L';
                                max = '> 50L';
                        }
                        else
                        {
                                str_max = max+'L';
                                max = max+',00,000';
                        }
                }
                else
                {
                        str_max = '> 50L';
                        max = '> 50L';

                }
                document.getElementById("ctcsel").innerHTML = str_min+" to "+str_max+" [<a href='#' target='_self' onClick=\"change_qx('off'); document.getElementById('ctcsel').innerHTML = ''; return false;\">Off</a>]";

        }
        else
                document.getElementById("ctcsel").innerHTML = '';

        if(document.getElementById(subobj) != null && typeof (document.getElementById(subobj)) != 'undefined')
                document.getElementById(subobj).style.display="none";
        if(document.getElementById("DivShim"))
                document.getElementById("DivShim").style.display= 'none';
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

