function selectall(checkbox)
{
      if(!checkbox) // page does not have any checkbox
        return; 

      else if(!checkbox.length) // page has only one checkbox
        checkbox.checked = !checkbox.checked;
      else
      {
        for(var i=0; i<checkbox.length; i++)
        {
          var e = checkbox[i];
          e.checked = !e.checked;
        }
      }
}

function popupwin(url,w,h,x,y,winname)
{ 
  if(!winname) winname = "UniwebWin";
  var mypopup = new PopupWindow(url,winname);
  mypopup.width = w || 400;
  mypopup.height = h || 580;
  mypopup.x = x || 100;
  mypopup.y = y || 100;
  mypopup.show();  

//  window.open(url,"VIEWCART","menu=no,resizable=yes");
}

function opentarget(target,url)
{
  target.document.location = url;
}

/**** Resize the dialog box* Can only be called after calling show()**/
function PopupWindow_resizeTo(int_w,int_h)
{
  this.width = int_w || this.width;
  this.height = int_h || this.height;
}

/**** Move the dialog box* Can only be called after calling show()**/
function PopupWindow_moveTo(int_x,int_y)
{
  this.x = int_x || this.x;
  this.y = int_y || this.y;
}

/***
* Popup window object
**/

function PopupWindow_show()
{
//  var dialogOption = 'width='+this.width+',height='+this.height;
  var myfeatures = this.barOption; // + ',' + dialogOption;

  this.newWin = window.open (this.url,this.name, myfeatures);    
  this.newWin.window.moveTo(this.x,this.y);
  this.newWin.window.resizeTo(this.width,this.height);
  this.newWin.window.focus();
}

function PopupWindow(url,winname)
{
  // properties
  this.url = url;
  this.name = winname || ("win"+PopupWindow_count++);
  this.newWin = null;
  this.barOption = 'menubar=no,resizable=yes,scrollbars=yes'; //'directories=no,location=no,menubar=0,status=no,titlebar=no,toolbar=no';

  this.x = 100;
  this.y = 100;
  this.width = 100;
  this.height = 100;
  this.title = null;

  // methods
  this.show = PopupWindow_show;
  this.resizeTo = PopupWindow_resizeTo;
  this.moveTo = PopupWindow_moveTo;
}
PopupWindow_count = 0;

