function LoadUserUpload(id_user, id_upl, dest_div){
	var upload=document.getElementById('upl_'+id_upl);
	var last_upload=document.getElementById('upl_'+window.curr_id_upl);
	window.curr_id_upl=id_upl;
	if(upload){
		last_upload.className='uicon';
		upload.className='uicon_active';
	}
	AjaxQuery(window.server_path+'/ajax_user.php?sel=user_upload&id_user='+id_user+'&id_upl='+id_upl, dest_div);
}

function LoadUserBlogImage(id_blog, id_upl, dest_div){
	var upload=document.getElementById('upl_'+id_upl);
	var last_upload=document.getElementById('upl_'+window.curr_id_upl);
	window.curr_id_upl=id_upl;
	if(upload){
		last_upload.className='uicon';
		upload.className='uicon_active';
	}
	AjaxQuery(window.server_path+'/ajax_user.php?sel=blog_upload&id_blog='+id_blog+'&id_upl='+id_upl, dest_div);
}

function ResizeFrame(id_frame, height){
	if(id_frame==null || id_frame=='undefined')	return;
	res_height = window.frames[id_frame].document.body.scrollHeight;
	if (res_height>height) height = res_height;
	frame_obj = document.getElementById(id_frame);
	frame_obj.height = height+30;
	frame_obj.onreadystatechange=ResizeFrame;
	window.last_frame=id_frame;
	window.last_height=height;
}

function SwapFocus(id_elem, act){
	var objElem=document.getElementById('gal_'+id_elem);
	var objInfo=document.getElementById('galinfo_'+id_elem);
	
	if(act=='show'){
		objElem.className='gallery_act';
		objInfo.className='galleryi_act';
	}
	else{
		objElem.className='gallery';
		objInfo.className='galleryi';
	}
}

function loadSitePopup(url, caption){
	var width=640;
	var height=480;
	var width_offset=50;
	var height_offset=55;
	
	var scr_width=screen.width-width_offset-30;
	var scr_height=screen.height-height_offset-30;

	if(width>scr_width || height>scr_height){
		var coof_x=scr_width/width;
		var coof_y=scr_height/height;
		var coof=Math.min(coof_x, coof_y);
		
		width=width*coof;
		height=height*coof;
	}

	window.obj={
		width:width,
		height:height,
		width_offset:width_offset,
		height_offset:height_offset,
		scr_width:scr_width,
		scr_height:scr_height
	};	

	var win_top_offset=(screen.height-window.obj.scr_height);
	var Left = (window.obj.scr_width - window.obj.width) / 2 - 200;
	var Top = (window.obj.scr_height - window.obj.height + win_top_offset) / 2 - 200;
	var shown=window.open(url, caption,"top="+Top+",left="+Left+", width=1024, height=728, scrollbars=yes, status=yes, toolbar=yes, menubar=yes, resizable=yes, location=yes");
	shown.focus();
	
	return false;
	{literal}
}

