﻿    var agt=navigator.userAgent.toLowerCase();
    var appVer = navigator.appVersion.toLowerCase();
    var is_major = parseInt(navigator.appVersion);
    
    var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    var is_ie3    = (is_ie && (is_major < 4));
    var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
    var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
            
function Popup(mypage, myname, w, h) {
	if (navigator.appVersion.indexOf("AOL") != -1)
    {
      newHeight = h + 25;
      newWidth = w + 25;
      winprops = 'height=' + newHeight + ',width=' + newWidth + ',scrollbars=2'
      win = window.open(mypage, myname, winprops);
    }
    else if (appVer.indexOf("mac") != -1 && is_ie5up)
    {
      newHeight = h;
      newWidth = w - 16;
      winprops = 'height=' + newHeight + ',width=' + newWidth + ',scrollbars=2'
      win = window.open(mypage, myname, winprops);
    }
    else
    {
     if (parseInt(navigator.appVersion) >= 4)
     {
      var offsetW = (screen.width - w) / 2;
      var offsetH = (screen.height - h) / 2;
      
      winprops = 'height='+ h +',width='+ w +',top='+ offsetH +',left='+ offsetW + ',scrollbars=2'
      win = window.open(mypage, myname, winprops);
      win.window.focus();
     }
     else
     {
      newHeight = h + 25;
      newWidth = w + 25;
      winprops = 'height=' + newHeight + ',width=' + newWidth + ',scrollbars=2'
      win = window.open(mypage, myname, winprops);
     } 
    }
   } 

function PopupScroll(mypage, myname, w, h, scroll, toolbar) {
 	//scroll = 'yes';
	if (toolbar == 'no')
		{	toolbar = 'no';	}
	else
		{	toolbar = 'yes'; 	}
	
	if (scroll == 'no')
		{	scroll = 'no';		}
	else
		{	scroll = 'yes';		}
		
    if (navigator.appVersion.indexOf("AOL") != -1)
    {
      newHeight = h + 25;
      newWidth = w + 25;
      winprops = 'height=' + newHeight + ',width=' + newWidth+',scrollbars='+scroll+',toolbar='+toolbar
      win = window.open(mypage, myname, winprops);
    }
    else if (appVer.indexOf("mac") != -1 && is_ie5up )
    {
      newHeight = h;
      newWidth = w - 16;
      winprops = 'height=' + newHeight + ',width=' + newWidth+',scrollbars='+scroll+',toolbar='+toolbar
      win = window.open(mypage, myname, winprops);
    }
    else
    {
     if (parseInt(navigator.appVersion) >= 4)
     {
      var offsetW = (screen.width - w) / 2;
      var offsetH = (screen.height - h) / 2;
      winprops = 'height='+ h +',width='+ w +',top='+ offsetH +',left='+ offsetW+',scrollbars='+scroll+',toolbar='+toolbar
      win = window.open(mypage, myname, winprops)
      win.window.focus();
     }
     else
     {
      newHeight = h + 25;
      newWidth = w + 25;
      winprops = 'height=' + newHeight + ',width=' + newWidth+',scrollbars='+scroll+',toolbar='+toolbar
      win = window.open(mypage, myname, winprops);
     } 
    }
   } 
 
 function PopupPollScroll(mypage, myname, w, h, scroll) {
  	//scroll = 'yes';
	toolbar = 'yes';
    if (navigator.appVersion.indexOf("AOL") != -1)
    {
      newHeight = h + 25;
      newWidth = w + 25;
      winprops = 'height=' + newHeight + ',width=' + newWidth+',scrollbars='+scroll
      win = window.open(mypage, myname, winprops);
    }
    else if (appVer.indexOf("mac") != -1 && is_ie5up )
    {
      newHeight = h;
      newWidth = w - 16;
      winprops = 'height=' + newHeight + ',width=' + newWidth+',scrollbars='+scroll
      win = window.open(mypage, myname, winprops);
    }
    else
    {
     if (parseInt(navigator.appVersion) >= 4)
     {
      var offsetW = (screen.width - w) / 2;
      var offsetH = (screen.height - h) / 2;
      winprops = 'height='+ h +',width='+ w +',top='+ offsetH +',left='+ offsetW+',scrollbars='+scroll
      win = window.open(mypage, myname, winprops)
      win.window.focus();
     }
     else
     {
      newHeight = h + 25;
      newWidth = w + 25;
      winprops = 'height=' + newHeight + ',width=' + newWidth+',scrollbars='+scroll
      win = window.open(mypage, myname, winprops);
     } 
    }
   } 

function PopupScrollWithResize(mypage, myname, w, h, scroll, toolbar,resizable) {

      //scroll = 'yes';

      if (toolbar == 'no')

            {     toolbar = 'no';   }

      else

            {     toolbar = 'yes'; }

      

      if (scroll == 'no')

            {     scroll = 'no';          }

      else

            {     scroll = 'yes';         }

      if (resizable == 'no')

            {     resizable = 'no';       }

      else

            {     resizable = 'yes';            }     

    if (navigator.appVersion.indexOf("AOL") != -1)

    {

      newHeight = h + 25;

      newWidth = w + 25;

      winprops = 'height=' + newHeight + ',width=' + newWidth+',scrollbars='+scroll+',resizable='+resizable+',toolbar='+toolbar

      win = window.open(mypage, myname, winprops);

    }

    else if (appVer.indexOf("mac") != -1 && is_ie5up )

    {

      newHeight = h;

      newWidth = w - 16;

      winprops = 'height=' + newHeight + ',width=' + newWidth+',scrollbars='+scroll+',resizable='+resizable+',toolbar='+toolbar

      win = window.open(mypage, myname, winprops);

    }

    else

    {

     if (parseInt(navigator.appVersion) >= 4)

     {

      var offsetW = (screen.width - w) / 2;

      var offsetH = (screen.height - h) / 2;

      winprops = 'height='+ h +',width='+ w +',top='+ offsetH +',left='+ offsetW+',scrollbars='+scroll+',resizable='+resizable+',toolbar='+toolbar

      win = window.open(mypage, myname, winprops)

      win.window.focus();

     }

     else

     {

      newHeight = h + 25;

      newWidth = w + 25;

      winprops = 'height=' + newHeight + ',width=' + newWidth+',scrollbars='+scroll+',resizable='+resizable+',toolbar='+toolbar

      win = window.open(mypage, myname, winprops);

     } 

    }

   }

