function Ccolor(id,type) {
	tablecolour = '#F6F6F6'
		if (type == 'in') { 
			id.bgColor = tablecolour;
		}
		else {
			id.bgColor = '#FFFFFF';
		}
}

function ColorBg(id,clr) 
{
	id.bgColor = clr;
}
function validate(form) {
	//alert(form);
	var j = 0;
	msg = "";
	for(var i = 0;i < ele.length;i++) {
		if(isBlank(form, ele[i])) {
			invalid(form, ele[i]);
			msg = msg + msgs[i] +"\n";
			j = j +1;
		}
	}
	if(j == 0) {
		return true;
	}
	else {
		alert(alertMsg + "\n"+ msg);
		return false;
	}
}
function invalid(form, ele) {
	if(!document.layers) {
			document.forms[form].elements[ele].style.backgroundImage = 'url(./images/bcg_input_2.png)';
			document.forms[form].elements[ele].style.borderBottom  = '1px solid #FF8800';
			document.forms[form].elements[ele].style.borderRight = '1px solid #FF8800';
		}
	return msg;
}

function isBlank(form,ele) {
	str = document.forms[form].elements[ele].value;
	if(str == "") {
		return true;
	}
	else {
		return false;
	}

}

function checkEmail(form,nameEmailField,msg) {
	var email = document.getElementById(nameEmailField);
	var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email.value)) {
		document.getElementById(nameEmailField).style.borderColor = '#cccccc';
		document.getElementById(nameEmailField).style.background = '#FF9900';	
		
		alert(msg)
		
		return false;		
	}
	else
	{
		document.getElementById("visualmessage").src = "http://pledil.antherica.it/pledil/images/ok.gif";
		document.getElementById(nameEmailField).style.backgroundImage = 'url(http://pledil.antherica.it/images/bcginput.jpg)';
		document.getElementById('password').disabled = false;
		return true
	}
}

function calcHeight(nameiframe,linkimage,id)
{
  //find the height of the internal page
  var the_height= document.getElementById(nameiframe).contentWindow.document.body.scrollHeight;

  //change the height of the iframe
  document.getElementById(nameiframe).height= the_height;
  
  document.getElementById(linkimage).href = 'html/popup_aziende.html?height=' + the_height + '&width=630&id=' + id + '&modal=true';
}

