
    var windowHeight = 0;
    var windowWidth = 0;
  
    function addEvent(obj, evType, fn){ 
     if (obj.addEventListener){ 
       obj.addEventListener(evType, fn, false); 
       return true; 
     } else if (obj.attachEvent){ 
       var r = obj.attachEvent("on"+evType, fn); 
       return r; 
     } else { 
       return false; 
     } 
    }
    //addEvent(window, 'load', doSelfOpen);
    
    function doSelfOpen()
    {
        //parentWindow = window.open('EquipmentInquire.aspx' + window.document.URL.substring( window.document.URL.indexOf('?'),window.document.URL.length ),'','');
        thisWindow = window.open('','_self','');
        //parentWindow.location = window.location;
        thisWindow.focus();
        
        try{
            alert(window.opener.name);
        }catch(e){
            //alert(e.name + ", " + e.message);
            //ignore error
        }
        
    }
    
    function setSizes() {
      var tempWidth = 0;
      var tempHeight = 0;
      if( typeof( window.innerWidth ) == 'number' ) {
        //FF etc
        tempWidth = window.innerWidth;
        tempHeight = window.innerHeight;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+
        tempWidth = document.documentElement.clientWidth;
        tempHeight = document.documentElement.clientHeight;
      } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //old IE
        tempWidth = document.body.clientWidth;
        tempHeight = document.body.clientHeight;
      }
      windowWidth = tempWidth;
      windowHeight = tempHeight;
    }

    function maximize()
    {
        top.window.moveTo(0,0);
        if (document.all) {
        top.window.resizeTo(screen.availWidth,screen.availHeight);
        }
        else if (document.layers||document.getElementById) {
            if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
            top.window.outerHeight = screen.availHeight;
            top.window.outerWidth = screen.availWidth;
            }
        }
    }
    
    function pausecomp(millis) 
    {
    var date = new Date();
    var curDate = null;

    do { curDate = new Date(); } 
    while(curDate-date < millis);
    } 

    function openInquiryWindow()
    {
        //setSizes();
        pausecomp(500);
        
        //window.location = 'EquipmentInquire.aspx' + window.document.URL.substring( window.document.URL.indexOf('?'),window.document.URL.length );
        
        /*var fromEmail = 0;
        var thisOpener;
        
        try
        {
            if(window.opener)
            {
             //check if this throws and exception
             try{
                //bad opener (email)   
                window.opener.location='EquipmentInquire.aspx' + window.opener.document.URL.substring( window.opener.document.URL.indexOf('?'),window.opener.document.URL.length );
             }catch(e){
                fromEmail = 1;
             }
            }else{
               //no opener (direct URL)
               fromEmail = 2; 
            }
        }catch(e){
            //bad opener (email)
            fromEmail = 1;
        }

        if(fromEmail>0)
        {
            //from email or bad opener
            var newUrl = 'EquipmentInquire.aspx' + window.document.URL.substring( window.document.URL.indexOf('?'),window.document.URL.length );
            window.open(newUrl,'','toolbar=1,resizable=1,menubar=1,scrollbars=1,location=1,height= ' + screen.availHeight + ', width= ' + screen.availWidth + '');
            maximize();
            window.open('','_self','');
            window.close();
        }else{
            //not from email
            if(fromEmail==2)
            {
                alert(fromEmail);
            }else{
                window.opener.location='EquipmentInquire.aspx' + window.opener.document.URL.substring( window.opener.document.URL.indexOf('?'),window.opener.document.URL.length );
                window.close();
                window.open('','_self','');
                window.close();
            }
        }*/
    }

