function refreshme() {
	parent.window.location.reload();
}

function changeurl(url) {
	parent.window.location = "/" + url;
}

var newwin = null;

function openwin( obj_id ) {
  var url = "/iteminfo.phtml?obj_id="+obj_id

  try {
    if (newwin != null && typeof(newwin.location.href) != 'undefined') {
      newwin.location.href = url;
    } else {
      newwin = open(url, "item", "height=550,width=450,innerHeight=500,innerWidth=410,outerHeight=550,outerWidth=450,screenX=0,left=0,screenY=0,top=0,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=yes,scrollbars=0,status=0,toolbar=0");
    }

    newwin.focus();
  } catch (e) {
     newwin = open(url, "item", "height=550,width=450,innerHeight=550,innerWidth=450,outerHeight=550,outerWidth=450,screenX=0,left=0,screenY=0,top=0,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=yes,scrollbars=0,status=0,toolbar=0");
    newwin.focus()
  }
}

function cash_win(cash_obj_id, gucid, obj_type, is_habitat, is_giftbox, force_live) {
	// TODO: Should this be different than iteminfo?
	var width = 450;
	var height = 550;
	if (is_giftbox) {
		var url = "/ncmall/boxinfo.phtml?";
		height = 600;
	} else {
		var url = "/iteminfo.phtml?";
	}
	if (force_live) {
		url = "http://www.neopets.com" + url;
	}

	url += "cash_obj_id=" + cash_obj_id + "&gucid=" + gucid;
	
	url += (is_habitat) ? "&habitat=1" : "&habitat=0";
	
	try {
		if (newwin != null && typeof(newwin.location.href) != 'undefined') {
			newwin.location.href = url;
		} else {
			newwin = open(url, "item", "width=" + width + ",height=" + height + ",innerHeight=" + (height - 50) +",innerWidth=" + (width - 40) + ",outerHeight=" + height + ",outerWidth=" + width + ",screenX=0,left=0,screenY=0,top=0,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0");
		}

		newwin.focus();
	} catch (e) {
		newwin = open(url, "item", "width=" + width + ",height=" + height + ",innerHeight=" + height + ",innerWidth=" + width + ",outerHeight=" + height + ",outerWidth=" + width + ",screenX=0,left=0,screenY=0,top=0,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=1,scrollbars=1,status=0,toolbar=0");
		newwin.focus()
	}
}

