function on_preview_post()
{
	form = document.getElementById( "post" );

	form.subaction.value = "preview";
	form.submit();

	return false;
}

function viewFull()
{
	img = event.srcElement;

	popupWin = window.open( img.src, "popup", "dependent = 0, channelmode = 0, directories = 0, fullscreen = 0, location = 0, menubar = 0, resizable = 1, scrollbars = 1, status = 1, toolbar = 0", "launcher" );

	if( window.focus )
	{
		popupWin.focus();
	}
}

function viewFullImage( img )
{
	popupWin = window.open( img, "popup", "dependent = 0, channelmode = 0, directories = 0, fullscreen = 0, location = 0, menubar = 0, resizable = 1, scrollbars = 1, status = 1, toolbar = 0", "launcher" );

	if( window.focus )
	{
		popupWin.focus();
	}
}

function view_iotd_image( file )
{
	popupWin = window.open( "/forum/view_iotd/" + file, "popup", "dependent = 0, channelmode = 0, directories = 0, fullscreen = 0, location = 0, menubar = 0, resizable = 1, scrollbars = 1, status = 1, toolbar = 0", "launcher" );

	if( window.focus )
	{
		popupWin.focus();
	}
}

function on_quote_post( post_id )
{
	form = document.getElementById( "frmAction" );

	if( form )
	{
		form.subaction.value = "show_quote_post";
		form.record_id.value = post_id;
		form.submit();
	}
}

function on_edit_post( post_id )
{
	form = document.getElementById( "frmAction" );

	if( form )
	{
		form.subaction.value = "show_edit_post";
		form.record_id.value = post_id;
		form.submit();
	}
}

function on_delete_post( post_id )
{
	form = document.getElementById( "frmAction" );

	if( form )
	{
		form.subaction.value = "delete_post";
		form.record_id.value = post_id;
		form.submit();
	}
}

function on_bigger_editor()
{
	editor = document.getElementById( "message" );

	if( editor )
	{
		editor.rows += 10;
	}
}

function on_smaller_editor()
{
	editor = document.getElementById( "message" );

	if( editor )
	{
		editor.rows -= 10;
	}
}

function on_delete_iotd_image( index )
{
	index --;
	form = document.getElementById( "post" );

	form.subaction.value = "preview";
	form.delete_iotd_image.value = index;
	form.submit();
}

function on_add_contest_prod()
{
	form = document.getElementById( "frmAddProd" );

	if( form )
	{
		if( form.team.options[form.team.selectedIndex].value == -1 )
		{
			alert( "Alege-ti echipa!" );
			return false;
		}

		form.subaction.value = "add_contest_prod";
		form.submit();
	}

	return false;
}

function launch_email( user, domain )
{
	document.location = "mailto:" + user + "@" + domain;
}

function on_edit_profile( id_user )
{
	document.location = "/profile/edit/" + id_user;
}
