function NewWindow(url)
{	// new window width specified size and no toolbar
	w = window.open(url);
}

function hashdistributorform()
{

	var password=document.getElementsByName('distributoraccess')[0].value;
	
	if ( (password=='') )
		{
			return false;
		}
	
	document.getElementsByName('distributoraccess')[0].value=hex_md5(password);
	
	//alert(document.getElementsByName('accesscode')[0].value);
	
	return true;
}

function getfieldvaluebyname(name)
{
	index=document.getElementsByName(name).length-1;
	if (index<0)
	{
		return false;
	}
	return document.getElementsByName(name)[index].value;
}

function checkmail(mail)
{
	regex=new RegExp(/.+@(.+[.])+[\w]{2,}/);
	return regex.test(mail);
}

function checkform()
{
	cont=true;

	checkfields=document.getElementsByName('td_check');

	for (x=0;x<checkfields.length;x++)
	{
		field=checkfields[x].id.substr(3);
	
		if (getfieldvaluebyname(field)==''  )
		{
			cont=false;
			document.getElementById('td_'+field).style.color='#ff0000';
			document.getElementById('td_'+field).style.fontWeight='bold';
		}
		else if ((field=='email') && (checkmail(getfieldvaluebyname(field))==false))	
		{
			cont=false;
			document.getElementById('td_'+field).style.color='#ff0000';
			document.getElementById('td_'+field).style.fontWeight='bold';
		}
		else 
		{
			document.getElementById('td_'+field).style.color='#000000';
			document.getElementById('td_'+field).style.fontWeight='bold';
		}
	}

	return cont;
}

function toggleHide(zone)
{	// hide a zone
	var lyr = document.getElementById(zone);
	lyr.style.display='none';
}
function toggleShow(zone)
{	// hide a zone
	var lyr = document.getElementById(zone);
	lyr.style.display='inline';
}