var popupWindow=null;

function showPopup(url,popupName,w,h,pos,infocus,reload,is_resizable,with_scrollbars) {

  if(pos == 'random') {

    LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;

    TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;

  }

  if(pos == 'center') {

    LeftPosition=(screen.width)?(screen.width-w)/2:100;

    TopPosition=(screen.height)?(screen.height-h)/2:100;

  }

  else if( (pos!='center' && pos!='random') || pos==null) {

    LeftPosition = 100;

    TopPosition =  100;

  }



  settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=yes,resizable='+is_resizable+',dependent=no,scrollbars='+with_scrollbars;



  popupWindow = window.open('',popupName,settings);



  params = url.split('?');



  if ( params.length <= 1 ) {

    url = url+'?windowName='+window.name;

  } else if (params[1].indexOf('windowName=') < 0) {

    url = url+'&windowName='+window.name;

  }



  popupWindow.location=url;



  if(infocus=='front') {

    popupWindow.focus();

  }



  if ( reload ) {

    if (infocus=='front') {

      params = window.location.search;

      // cut ?

      if ( params.charAt(0) == '?' ) {

        params = params.substring(1, params.length-1);

      }

      params = params.split('&');



      if ( params.length <= 1 ) {

        concat = '?';

      } else {

        concat = '&';

      }



      addParam = true;

      for (i=0; i<params.length; i++) {

        if ( params[i].substring(0, 10) == 'doNotFocus' ) {

          addParam = false;

        }

      }



      timeOut = 1*1000;

      if ( addParam ) {

        window.setTimeout("window.location = window.location+concat+'doNotFocus=yes'", timeOut);

      } else {

        window.setTimeout("window.location.reload();", timeOut);

      }



    }

  }



}



/* original

function showPicture(url) {

 myWindow = window.open(url, "showPicture", "resizable=yes,width=100,height=100");

 myWindow.focus();

}

*/



function showPicture(url) {

 myWindow = window.open('/inc/include.picture.php?picture='+url, 'showPicture', 'resizable=yes,width=100,height=100');

 myWindow.focus();

}



function openWindow(url, width, height) {

  window1 = window.open(url, "popupWindow", "width="+width+",height="+height+",left=100,top=200");

  window1.focus();

}


function popup(a)
{
  var width = 800;
  var height = 550;
  window1 = window.open(a.href + '?parse=content', null, "resizable=yes,scrollbars=yes,width="+width+",height="+height+",left=100,top=200");
  window1.focus();
  return false;

}

