function setMenu(s) {
	var u = parent.leftFrame.location;
	u = u.toString();
	var f = u.split("/");
	if(f[f.length-1] != s) {
		parent.leftFrame.location = s;
		if(s = 'left.user.php') {
			parent.topFrame.location = 'top.php';
		}
	}
}

function setRightMenu(s) {
	var u = parent.rightFrame.location;
	u = u.toString();
	var f = u.split("/");
	if(f[f.length-1] != s) {
		parent.rightFrame.location = s;
		/*if(s = 'left.user.php') {
			parent.topFrame.location = 'top.php';
		}*/
	}
}

function hlImg(e, i) {
	o = e.src;
	e.src = i;
	e.onmouseout = function() {
		this.src = o;
	}
}

function setBottomMenu(s) {
	var u = parent.bottomFrame.location;
	u = u.toString();
	var f = u.split("/");
	if(f[f.length-1] != s) {
		parent.bottomFrame.location = s;
		/*if(s = 'left.user.php') {
			parent.topFrame.location = 'top.php';
		}*/
	}
}

function doConfirm(q, l) {
	if(confirm(q)) {
		document.location.href = l;
	}
}

function doPopup (url, width, height, extra) {
	day     = new Date();
    id      = day.getTime();
    bwidth  = window.screen.width;
    bheight = window.screen.height;
    fleft    = ((bwidth - width) / 2);
    ftop     = ((bheight - height) / 2);
    
    extra = extra ? extra : "toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0";

   	eval("page" + id + " = window.open(url, \'" + id + "\', \'"+ extra +",width=" + width + ",height=" + height + ",left = " + fleft + ",top = " + ftop + "\');");
   	eval("obj = page"+id+";");

    return obj;
}

function openProductBuy (url) {
	width = 480;
	height = 580;
	day     = new Date();
    id      = day.getTime();
    bwidth  = window.screen.width;
    bheight = window.screen.height;
    fleft    = ((bwidth - width) / 2);
    ftop     = ((bheight - height) / 2);

   	eval("page" + id + " = window.open(url, \'" + id + "\', \'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=1,resizable=0,width=" + width + ",height=" + height + ",left = " + fleft + ",top = " + ftop + "\');");
   	eval("obj = page"+id+";");

    return obj;
}

function editForumPost(postId) {
	doPopup('/forum.edit.php?post_id='+postId, 480, 250);
}

function editGuestbook(guestbook_id) {
	doPopup('/user.guestbook.edit.php?guestbook_id='+guestbook_id, 480, 250);
}

function editNote(noteId) {
	doPopup('/user.note.edit.php?note_id='+noteId, 480, 250);
}

function openNotebook() {
	doPopup('user.notebook.php', 1020, 600, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0');
}