
function get_id(id_name)
{
	if (document.all)
	{
		element_id = eval("document.all." + id_name);
	}
	else if (document.getElementById)
	{
		element_id = eval("document.getElementById('" + id_name + "')");
	}
	else if (document.layers)
	{
		element_id = eval("document." + id_name);
	}
	
	return element_id;
	
}

function toogle_div(div_id, status)
{
	id = get_id(div_id);
	
	switch (status)
	{
		case 1:
		{
			id.style.display = 'block';
			break;
		}
		case -1:
		{
			id.style.display = 'none';
			break;
		}
		default:
		{
			if (id.style.display == 'block')
			{
				id.style.display = 'none';
			}
			else
			{
				id.style.display = 'block';
			}
			break;
		}
		
	}
	
	return true;
}

function external_links() 
{
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) 
	{
		var anchor = anchors[i];
		if ((anchor.getAttribute("href") && (anchor.getAttribute("rel") == "external")))
		{
			anchor.target = "_blank";
		}
	}
}
window.onload = external_links;


function open_popup(url) 
{

	w = 520;

	h = 520;

	sw = screen.width;

	sh = screen.height;

	l = (sw - w) / 2;

	t = (sh - h) / 2;

	window.open(url, 'evomediasoft', 'width='+w+',height='+h+',top='+t+',left='+l+',scrollbars=no,resizable=no');	

}


function check_emailform()
{
	
	ret = true;
	txt = '<ul>';
	
	if ((get_id('fname_id').value == ''))
	{
		txt += '<li>Va rugam sa completati prenumele dvs.!</li>';
		ret = false;
	}
	
	if ((get_id('lname_id').value == ''))
	{
		txt += '<li>Va rugam sa completati numele dvs.!</li>';
		ret = false;
	}
	
	if ((get_id('email_id').value == ''))
	{
		txt += '<li>Va rugam sa completati adresa dvs. de email!</li>';
		ret = false;
	}
	
	if ((get_id('phone_id').value == ''))
	{
		txt += '<li>Va rugam sa completati numarul dvs. de telefon!</li>';
		ret = false;
	}
	
	if ((get_id('subject_id').value == ''))
	{
		txt += '<li>Va rugam sa completati subiectul mesajului!</li>';
		ret = false;
	}
	
	if ((get_id('message_id').value == ''))
	{
		txt += '<li>Va rugam sa completati mesajul dvs.!</li>';
		ret = false;
	}
	
	if (ret == false)
	{
		urchinTracker ('/scop/formular_email_invalid');
		get_id('msg_div').innerHTML = "<h1>ATENTIE!</h1>" + txt;
		get_id('msg_div').style.display = 'block';
		get_id('msg_div').className = 'front_msg_err';
		window.scroll(0, 0);
	}
	else
	{
		urchinTracker ('/scop/formular_email_valid');
	}
	
	return ret;
}


function check_priceform()
{
	
	ret = true;
	txt = '<ul>';
	
	if ((get_id('fname_id').value == ''))
	{
		txt += '<li>Va rugam sa completati prenumele dvs.!</li>';
		ret = false;
	}
	
	if ((get_id('lname_id').value == ''))
	{
		txt += '<li>Va rugam sa completati numele dvs.!</li>';
		ret = false;
	}
	
	if ((get_id('email_id').value == ''))
	{
		txt += '<li>Va rugam sa completati adresa dvs. de email!</li>';
		ret = false;
	}
	
	if ((get_id('phone_id').value == ''))
	{
		txt += '<li>Va rugam sa completati numarul dvs. de telefon!</li>';
		ret = false;
	}
	
	if ((get_id('desc323_id').value == ''))
	{
		txt += '<li>Va rugam sa completati descrierea proiectului!</li>';
		ret = false;
	}
	
	if ((get_id('budget_id').value == ''))
	{
		txt += '<li>Va rugam sa completati bugetul aproximativ alocat proiectului dvs.!</li>';
		ret = false;
	}
	
	if (ret == false)
	{
		urchinTracker ('/scop/cerere_oferta_invalida');
		get_id('msg_div').innerHTML = "<h1>ATENTIE!</h1>" + txt;
		get_id('msg_div').style.display = 'block';
		get_id('msg_div').className = 'front_msg_err';
		window.scroll(0, 0);
	}
	else
	{
		urchinTracker ('/scop/cerere_oferta_valida');
	}
	
	return ret;
}

function prepare_extradiv(div_id, parent_id)
{
	
	return;
//	alert('ok');
	
	var left0 = get_id(parent_id).style.left;
	var top0 = get_id(parent_id).style.top;
	
	get_id(div_id).style.left = left0;
	get_id(div_id).style.top = top0;
	
	get_id(div_id).style.display = 'block';
	
}

function start_rotate(div_id, start, step, max_nr, move, crt)
{
	return;
	
	if (move > 0)
	{
//		alert('move! - crt:' + crt + ' - step:' + step + ' - start:' + start + ' - move:' + move);
		if ((parseInt(crt) - parseInt(start)) > parseInt(step))
		{
			var start2 = parseInt(start) + parseInt(step);
			setTimeout('start_rotate("' + div_id + '", "' + start2 + '", "' + step + '", "' + max_nr + '", "'+ 0 + '", "' + crt + '")', 20);
		}
		else
		{
			var crt2 = parseInt(crt) + 1;
//			var pos = parseInt(get_id(div_id).style.left);
//			alert ('a: ' + get_id(div_id).style.left);
//			get_id(div_id).style.left = parseInt(pos + 1) + 'px';
			setTimeout('start_rotate("' + div_id + '", "' + start + '", "' + step + '", "' + max_nr + '", "'+ 1 + '", "' + crt2 + '")', 20);
		}
	}
	else
	{
//		alert('stop! ' + start);
		var crt2 = parseInt(crt);
		setTimeout('start_rotate("' + div_id + '", "' + start + '", "' + step + '", "' + max_nr + '", "'+ 1 + '", "' + crt2 + '")', 2000);
	}
	
}

