function saveProfile(pform)
{
	names = new Array("p_first_name","p_last_name","p_email","p_country");

	hideError("error_message");
	resetFields(names);
	if (checkFilled(names))
	{
		submitForm(pform);
	} else
		showError("error_message","Some required fields are empty");
}

function showPhotoEditor(id)
{
	shadeMain();

	div = document.getElementById(id);
	width = document.body.clientWidth;
	height = document.body.clientHeight;


//	div.style.top = "220px";
	div.style.left = (width/2 - 210)+"px";

	div.style.display = "block";
}

function hidePhotoEditor(id)
{
	unshadeMain();
	document.getElementById(id).style.display = "none";
}

function uploadPhoto(url)
{
	obj = window["photo_flash"] ? window["photo_flash"] : document["photo_flash2"];
//	obj.SetVariable("pictureURL",url);
//	obj.SetVariable("do_load","1");
	obj.startProcess(url);
}

function startUploadPhoto(pform)
{
	pform.submit();
}

function startSetPhoto(pform)
{
	obj = window["photo_flash"] ? window["photo_flash"] : document["photo_flash2"];
	pform.res_x.value = obj.getVar("res_x");
	pform.res_y.value = obj.getVar("res_y");
	pform.res_scale.value = obj.getVar("res_scale");

	pform.submit();
}

function refillBalance(pf,prov)
{
	shadeMain();
	showMessage("pwait");

	pform = document.getElementById(pf);

	pform.provider.value = prov;
	pform.submit();
}

function showNomination(point,nom,pos)
{
	getData("/how-it-works/prizes/"+nom+"/"+pos);
	                              
	points = point.parentNode.getElementsByTagName("IMG");
	for (i=0;i<points.length;i++)
		points.item(i).src = "/i/point.gif";

	point.src = "/i/point_red.gif";
}

function thumbRoll(im,over)
{
	im.style.width = im.style.height = over ? "148px" : "144px";
	im.style.top = im.style.left = over ? "12px" : "14px";
}

function updateAffiliates(lnk,time)
{
	links = lnk.parentNode.getElementsByTagName("A");
	for (i=0;i<links.length;i++)
		links.item(i).className = "xplain";

	lnk.className = "wp_active";

	getData('/profile/affiliates/'+time);

	return false;
}

function updateWPS(lnk,type,url)
{
	links = lnk.parentNode.getElementsByTagName("A");
	for (i=0;i<links.length;i++)
		links.item(i).className = "xplain";

	lnk.className = "wp_active";

	url = url ? "/profile/wisdom-pieces/" : "/profile/wps5/";
	getData(url+type);

	return false;
}