function goTo(newLoc){
	var URL = newLoc.options[newLoc.selectedIndex].value;
	if(URL!=0){
		window.location.href = URL;
	}
}

function popUP(theURL,windowName,theWidth,theHeight){
	goMiddle = (screen.availHeight / 2) - (theHeight / 2);
	goCenter = (screen.availWidth / 2) - (theWidth / 2);
	window.open(theURL,windowName,"toolbar=0,menubar=no,location=0,scrollbars=no,resizable=no,width="+theWidth+",height="+theHeight+",left="+goCenter+",top="+goMiddle);
}

function cataPult(theURL,windowname,horz,vert,resizeMe) {
	if (resizeMe == null) { resizeMe = 1; }
	hCent	= (screen.availWidth / 2) - (horz / 2);
	vCent = (screen.availHeight / 2) - (vert / 2);
	window.open(theURL, windowname,'toolbar=0,location=0,directories=0,status=no,left=' + hCent + ',top=' + vCent + ',menubar=0,scrollbars=' + resizeMe + ',resizable=' + resizeMe + ',width=' + horz + ',height=' + vert );
}

function popUPscroll(theURL,windowName,theWidth,theHeight){
	window.open(theURL,windowName,"toolbar=0,menubar=no,location=0,scrollbars=yes,resizable=yes,width="+theWidth+",height="+theHeight+",left=100,top=100");
}

function BillToShip() {
	document.info.shipping_address.value = document.info.address.value;
	document.info.shipping_address2.value = document.info.address2.value;
	document.info.shipping_city.value = document.info.city.value;
	document.info.shipping_zip.value = document.info.zip.value;
	document.info.shipping_state.value = document.info.state.value;
	document.info.shipping_country.value = document.info.country.value;
}

//confirm action popup message
function confirmAction(theMessage) {
	if(confirm(theMessage)){ return true ; }
	else{ return false ; }
}

//functions for form character counting
function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

function Contar(entrada,salida,texto,caracteres) {
  var entradaObj=getObject(entrada);
  var salidaObj=getObject(salida);
  var longitud=caracteres - entradaObj.value.length;
  if(longitud <= 0) {
    longitud=0;
    texto='<span class="disable"> '+texto+' </span>';
    entradaObj.value=entradaObj.value.substr(0,caracteres);
  }
  salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
}