
function highlightTR(row){	
	var theTable = document.getElementById('t1');
	theTable.rows(row - 1).cells(0).innerHTML = '<b>Please check your selections highlighted below:</b>';	
	// theTable.rows(row).cells(0).class = "error_right";
	// theTable.rows(row).cells(0).style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	// theTable.rows(row).cells(1).class = "red";
	}

function changeclass(id1, id2){
	var myId1 = document.getElementById(id1);
	var myId2 = document.getElementById(id2);
	var errorline = document.getElementById('errorfield');
	myId1.style.backgroundColor = "#ffed99";
	myId2.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}

function changeclass2(){
	var myId1 = document.getElementById('r2c1');
	var myId2 = document.getElementById('r2c2');
	var errorline = document.getElementById('errorfield');
	myId1.style.backgroundColor = "#ffed99";
	myId2.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}

function changeclass3(){
	var myId1 = document.getElementById('r1c1');
	//myId1.style.backgroundColor = "#ffed99";
	myId1.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}
	
function changeclass4(){
	var myId1 = document.getElementById('r1c1');
	var myId2 = document.getElementById('r1c2');
	var errorline = document.getElementById('errorfield');
	myId1.style.backgroundColor = "#ffed99";
	myId2.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}
	
function emailrequired(){
	var myId1 = document.getElementById('r1c2');
	//myId1.style.backgroundColor = "#ffed99";
	myId1.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}

function emailrequired2(){
	var myId1 = document.getElementById('r1c2');
	//myId1.style.backgroundColor = "#ffed99";
	myId1.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}

function checkcomments(){
	var myId1 = document.getElementById('comments');
	var myId2 = document.getElementById('comments2');
	myId1.style.backgroundColor = "#ffed99";
	myId2.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}

function invalidstore(){
	var myId1 = document.getElementById('storenum');
	//myId1.style.backgroundColor = "#ffed99";
	myId1.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}

function invalidstate(){
	var myId1 = document.getElementById('storestate');
	//myId1.style.backgroundColor = "#ffed99";
	myId1.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}

function invalidcity(){
	var myId1 = document.getElementById('storecity');
	//myId1.style.backgroundColor = "#ffed99";
	myId1.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}
	
function invaliddate1(){
	var myId1 = document.getElementById('dateofvisit');
	//myId1.style.backgroundColor = "#ffed99";
	myId1.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}

function invaliddate2(){
	var myId1 = document.getElementById('dateofvisit');
	//myId1.style.backgroundColor = "#ffed99";
	myId1.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}
	
function missingbrand(){
	var myId1 = document.getElementById('brandtype');
	//myId1.style.backgroundColor = "#ffed99";
	myId1.style.backgroundImage = "url(images/form_error_highlight_right.jpg)";
	//errorline.innerHTML = '<b>Please enter all required information:</b>';
	return false;
	}

function alertTest(){
	alert('yes');}
	

function validateForm(){
  	alert('validation code here');
	}
	
function validateRadios(thisform)  {	
	// validate radio buttons (r1)
	highlightTR(1);
	myOption = -1;
	for (i=thisform.rblRestVisit.length-1; i > -1; i--) {
	if (thisform.rblRestVisit[i].checked) {
	myOption = i;
	}
	}
	if (myOption == -1) {
	alert("You must select a radio button");	
	return false;
	}

	alert("You selected button number " + myOption
	+ " which has a value of "
	+ thisform.rblRestVisit[myOption].value);

	// place any other field validations that you require here
	thisform.submit(); // this line submits the form after validation
	}


//counter of characters.
function Count(txtObj,countObj,texto,maxChars) {
  txtObjObj= document.getElementById(txtObj);
  countObjObj= document.getElementById(countObj);
  var longitud=maxChars - txtObjObj.value.length;
  if(longitud <= 0) {
    longitud=0;
    texto='<div class="disable">'+texto+' </div>';
    txtObjObj.value=txtObjObj.value.substr(0,maxChars);
  }
  countObjObj.innerHTML = texto.replace("{CHAR}",longitud); 
}
		
