/////////////////envio de SMS//////////

function update_counter(count) {
    //count = count - document.web2sms.ema.value.length;
    count = count - document.web2sms.txtSMSMsg.value.length;
    document.web2sms.txtCharsNumber.value = count;
}

function TrackCount(fieldObj,countFieldName,maxChars)
{
  var countField = eval("fieldObj.form."+countFieldName);
  //countField = countField - 9; // para o nš do remetente
  //countField = countField - document.web2sms.ema.value.length;
  var diff = maxChars - fieldObj.value.length;
  // Need to check & enforce limit here also in case user pastes data
  if (diff < 0)
  {
    fieldObj.value = fieldObj.value.substring(0,maxChars);
    diff = maxChars - fieldObj.value.length;
  }
  countField.value = diff;
}

function LimitText(fieldObj,maxChars)
{
  var result = true; 
  //maxChars = maxChars - 9; // para o nš do remetente
  //maxChars = maxChars - document.web2sms.ema.value.length;
  if (fieldObj.value.length >= maxChars)
    result = false;
  
  if (window.event)
    window.event.returnValue = result;
  return result;
}


////////////////////////
function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                  if (event.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
      } 
} 

function ChangeQuantity(url, index)
{
	location.href = url + "?action=change&id=" + index.name + "&qtd=" + index.value;
}

function ClientRedirect(url)
{
	location.href = url;
}

function PrintWindow(url)
{
	window.open(url, 'Print');
	return;
}


function Quest_ChangeQ7(fieldObj,hidden_fieldObj,textObj)
{

  disabled_text_fields();

  if (fieldObj.checked)
  {
		hidden_fieldObj.checked = true;
		textObj.disabled =false;
  }
  else
  {
  		hidden_fieldObj.checked = false;
		textObj.disabled =true;
  }

}


function disabled_text_fields()
{
	document.Form1.Q7_txt1.disabled =true;
	document.Form1.Q7_txt2.disabled =true;
	document.Form1.Q7_txt3.disabled =true;
}



function FillQ7_Txt()
{

	if (document.Form1.RBList7[0].checked){
		document.Form1.TxtBoxQ7.value = document.Form1.Q7_txt1.value;
	}
	else{
		if(document.Form1.RBList7[1].checked){
			document.Form1.TxtBoxQ7.value = document.Form1.Q7_txt2.value;
		}
		else{
			if(document.Form1.RBList7[2].checked){
			document.Form1.TxtBoxQ7.value = document.Form1.Q7_txt3.value;
			}
			else{
				document.Form1.TxtBoxQ7.value = "";
			}
		}
	}
}


function Fill_Q7Options()
{
	document.Form1.Q7_txt1.Disabled=true;
	document.Form1.Q7_txt2.Disabled=true;
	document.Form1.Q7_txt3.Disabled=true;

	if (document.Form1.RBList7[0].checked)
	{
		document.Form1.Q7_op1.checked = true;
		document.Form1.Q7_txt1.Disabled = false;
	}

	if (document.Form1.RBList7[1].checked)
	{
		document.Form1.Q7_op2.checked = true;
		document.Form1.Q7_txt2.Disabled = false;
	}

	if (document.Form1.RBList7[2].checked)
	{
		document.Form1.Q7_op3.checked = true;
		document.Form1.Q7_txt3.Disabled = false;
	}
		
}


