function popupwin(thehref, win, xwidth, yheight, attrib )
	{
	//figure out the center position
	var scrW = screen.availWidth;
	var scrH = screen.availHeight;
	if (xwidth > scrW)
		{
		pW = scrW - 10;
		}
	else
		{
		pW = xwidth;
		}
	if (yheight > scrH)
		{
		pH = scrH - 40;
		}
	else
		{
		pH = yheight;
		}
	scrX = (scrW - pW - 10) * .5;
	scrY = (scrH - pH - 30) * .5;

	var windowatts = "width=" + xwidth + ",height=" + yheight + ",left=" + scrX + ",top=" + scrY + ",screenX=" + scrX + ",screenY=" + scrY;
  windowatts += "," + attrib;
	window.open( thehref, win, windowatts);
	return false;
	}

$(document).ready(function()
	{

	$("a.popup").click( function()
		{
			var address = this.href;
			popupwin(address, '', 880, 600, 'statusbar=1,status=1,toolbar=1,scrollbars=1,resizable=1,location=1,address=1,directories=1,menubar=1' );
			return false;
		});

	$("a.popup-small").click( function()
		{
			var address = this.href;
			popupwin(address, '', 550, 400, 'statusbar=1,status=1,toolbar=1,scrollbars=1,resizable=1,location=1,address=1,directories=1,menubar=1' );
			return false;
		});

  $("a.bookmark-this").click(function(e)
    {
    e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
    var bookmarkUrl = this.href;
    var bookmarkTitle = this.title;

    if (window.sidebar)
      { // For Mozilla Firefox Bookmark
      window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
      }
    else if( window.external || document.all)
      { // For IE Favorite
      window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
      }
    else if(window.opera)
      { // For Opera Browsers
      $("a.jQueryBookmark").attr("href",bookmarkUrl);
      $("a.jQueryBookmark").attr("title",bookmarkTitle);
      $("a.jQueryBookmark").attr("rel","sidebar");
      }
    else
      { // for other browsers which does not support
      alert('Your browser does not support this bookmark action. Please add a bookmark manually.');
      return false;
      }
    });

	});



