function showmsg(msg,left,top) {
    var div=jQuery('#messagebox_prototype').clone();
    div.children('.messagebox_content').html(msg);
    div.addClass('messagebox');
    jQuery(document.body).prepend(div);
    if (left) div.css({left:left});
    if (top) div.css({top:top});
//    div.css({marginLeft:'auto',marginRight:'auto'});
    div.show('slow');
}

function nw(cim, cel, egyeb) {
    if (typeof egyeb == 'undefined') egyeb = "";
    ujwin=window.open(cim+'adatlap.php?id='+cel+egyeb,'','width=870, height=600, resizable=yes, scrollbars=yes, menubar=no');
    ujwin.opener=self;
}

function pw(uid,pid,t) {
    var w=400;
    var h=300;
    var winl=(screen.width-w)/2;
    var wint=(screen.height-h)/2;
    var cim='view_pic.php?uid='+uid+'&pid='+pid;
    if (t==1) cim='view_pic.php?s=1&uid='+uid+'&pid'+pid;
    ujwin=window.open(cim,'','width=400, height=300, left='+winl+', top='+wint+', resizable=yes, scrollbars, menubar=no, status=no');//scrollbars=no, 
    ujwin.opener=self;
//    return false;
}

function uw(uid,abspath) {
    if (!abspath) abspath='';
    var w=628;
    var h=465;
    var winl=(screen.width-w)/2;
    var wint=(screen.height-h)/2;
    ujwin=window.open(abspath+'view_msgsend.php?userid='+uid,'','width='+w+', height='+h+', left='+winl+', top='+wint+', resizable=yes, scrollbars=no, menubar=no');
    ujwin.opener=self;
//    return false;
}

function ujw(cim,w,h) {
    var winl=(screen.width-w)/2;
    var wint=(screen.height-h)/2;
    ujwin=window.open(cim,'','width='+w+', height='+h+', left='+winl+', top='+wint+', resizable=yes, scrollbars=no, menubar=no');
    ujwin.opener=self;
//    return false;
}

function ew(uid) {
    var w=615;
    var h=460;
    var winl=(screen.width-w)/2;
    var wint=(screen.height-h)/2;
    ujwin=window.open('view_suggest.php?userid='+uid,'','width='+w+', height='+h+', left='+winl+', top='+wint+', resizable=yes, scrollbars=no, menubar=no');
    ujwin.opener=self;
//    return false;
}

var cwin;

function cw(cim) {
    var w=780;
    var h=550;
    var winl=(screen.width-w)/2;
    var wint=(screen.height-h)/2;
    if ( (!cwin) || (!cwin.open) || (cwin.closed) ) {
	cwin=window.open(cim,'erinteschat','width='+w+', height='+h+', left='+winl+', top='+wint+', resizable=yes, scrollbars=no, menubar=no');
	cwin.opener=self;
    } else {
	cwin.focus();
    }
}

function newImage(arg) {
    if (document.images) {
	rslt = new Image();
	rslt.src = arg;
	return rslt;
    }
}

function changeImages() {
    if (document.images && (preloadFlag == true)) {
	for (var i=0; i<changeImages.arguments.length; i+=2) {
	    document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
	}
    }
}

var preloadFlag = false;
function preloadImages() {
    if (document.images) {
	randi_over = newImage("pic/menu_magazin_over.gif");
	randi_over = newImage("pic/menu_tars_over.gif");
	forum_over = newImage("pic/menu_forum_over.gif");
	chat_over = newImage("pic/menu_chat_over.gif");
	jatek_over = newImage("pic/menu_jatek_over.gif");
	gyik_over = newImage("pic/menu_infok_over.gif");
	preloadFlag = true;
    }
}

function resize() {
    var htmlheight = document.body.clientHeight;
    var td=document.getElementById("szaz");
    td.height=htmlheight-122-50;//header, lablec
//    alert('asd');
}

function FitPic(w,h) {
    var NS=(navigator.appName=="Netscape")?true:false;
    iWidth = (NS)?window.innerWidth:document.body.clientWidth;
    iHeight = (NS)?window.innerHeight:document.body.clientHeight;
    iWidth = w - iWidth;
    iHeight = h - iHeight;
    window.resizeBy(iWidth, iHeight);
}

function SetParent() {
    if (parent.opener) {
	parent.opener.cwin=this;
	setTimeout("SetParent();",250);
    }
}

