function showPage(id, pages, mark)
{
	string = (mark == 1)?'page':'prj';
	for(i = 1; i <= pages; i++)
	{
		document.getElementById(string + i).style.display = 'none';
		if(id == i)
			document.getElementById(string + i).style.display = 'block';
	}
	
	if(mark == 1)
		sendRequest(id, pages);
		
	/*if(mark == 2 && pages > 1)
		for(i = 1; i <= pages; i++)
		{
			document.getElementById('prjPage' + i).style.fontWeight = '100';
			if(id == i)
				document.getElementById('prjPage' + id).style.fontWeight = 'bold';
		}*/
	if(mark == 2)
	{
		div = document.getElementById('projectPages');
		str = '';
		
		if(pages > 1)
		{
			if(id > 1)
				str += '<a href="#prj" onclick="showPage(' + (id - 1) + ', ' + pages + ', 2)">&lt;&nbsp;&nbsp;</a>';
			for(i = 1; i <= pages; i++)
				if(i == id)
					str += '<b>' + id + '</b>&nbsp;';
				else
					str += '<a href="#prj" onclick="showPage(' + i + ', ' + pages + ', 2)">' + i + '</a>&nbsp;';
			if(id < pages)
				str += '<a href="#prj" onclick="showPage(' + (id + 1) + ', ' + pages + ', 2)">&nbsp;&gt;</a>';
		}
		div.innerHTML = str;
	}
	
}

function checkForm(lang)
{
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var mail = document.getElementById('mail').value;
	if(reg.test(mail) == false)
	{
		if(lang == 'ro')
			alert('Adresa introdusa nu este valida.');
		else
			alert('The e-mail adress is invalid.');
		return false;
	}
	
	if(document.getElementById('name').value == '' || document.getElementById('mail').value == '' || document.getElementById('mess').value == '')
	{
		if(lang == 'ro')
			alert('Toate cele trei campuri sunt necesare pentru a continua.');
		else
			alert('All three fields are required in order to proceed.');
		return false;
	}
	return true;
}

function adjustTile(ref)
{
	tileHeight = document.getElementById('content').offsetHeight - 440;
	if(tileHeight > 0)
	{
		bodyTile = document.getElementById('bodyTile');
		
		bodyTile.style.height = tileHeight + 'px';
		bodyTile.style.marginTop = '-' + (tileHeight) + 'px';
	}
	
	if(ref == 1)
		window.location = '#prj';
		
	return true;
}

/*function renderCloud(value, inter, index)
{
	cloud.style.top = (cloud.offsetTop - value) + 'px';
	cloud.style.left = (cloud.offsetLeft - value) + 'px';
	value+=10;
	op += (index * 0.15);
	cloud.style.opacity = op;
	document.getElementById('debug').innerHTML = 'T:' + cloud.offsetTop + ' - ' + 'L:' + cloud.offsetLeft + ' - ' + op;
	if(cloud.offsetTop < 470 && index == 1)
	{
		clearInterval(int);
	}
	if(cloud.offsetTop < 450 && index == -1)
	{
		clearInterval(int);
	}
}

function popCloud()
{
	int = setInterval("renderCloud(5, int, 1)", 1);
	return true;
}

function puffCloud()
{
	int = setInterval("renderCloud(2, int, -1)", 1);
	return true;	
}*/