// JavaScript Document
	
/* ------------------------------- VENTANAS  ------------------------------------------------------ */	
var WindowObjectReference = null;

var openRequestedPopup = function (strUrl, strWindowName, ancho, altura, titulo)
{
  if(WindowObjectReference == null || WindowObjectReference.closed)
  {
    ventana = window.open("", strWindowName, "resizable=yes,scrollbars=yes,status=no,titlebar=no,menubar=no,personalbar=no,location=no, fullscreen=no, width="+(parseInt(ancho) + 45)+",height="+(parseInt(altura) + 45));
	ventana.document.open();
	ventana.creator=window;
	cabecera = "<html><head><title>-- "+ titulo +"</title></head><body><img src='" + strUrl + "' width='"+ancho+"' height='"+altura+"' border='0' style='display: block;  margin-left: auto; margin-right: auto;' /><br/><input type='button' style='border:0; background-color:#000000; color: #ffffff' value='cerrar' onclick='window.close();' /></body>";	
	ventana.document.write(cabecera);
	ventana.document.close();
	ventana.creator=window;
  }
  else
  {
    WindowObjectReference.focus();
  };
}

function openTextPopup(strUrl, strWindowName)
{
  if(WindowObjectReference == null || WindowObjectReference.closed) {
    WindowObjectReference = window.open(strUrl, strWindowName, "resizable=yes,scrollbars=yes,status=no,titlebar=no,menubar=no,personalbar=no,location=yes, fullscreen=no, width=450,height=500");
  } else {
    WindowObjectReference.focus();
  };
}


function validateForm(obj, url, error) {
		
	//alert("EL VALOR :" + obj.newsletter_pay_form.checked);
	if(obj.newsletter_pay_form.checked == true && (obj.number.value == '' || obj.month.selectedValue == '' || obj.month.selectedValue == 0 || obj.year.selectedValue == '' || obj.year.selectedValue == 0 || obj.code.value == '')) {
		alert(error);
		obj.number.focus();
		return false;
	} else {
		var myAjax = new Ajax.Updater('formularioRegistro',url ,{method:'POST', evalScripts:true, parameters:Form.serialize(obj)}); 
		return false;
	}
}

function validateFormLanding(obj, url, error) {
		

	if(obj.event_price.value != 0 && (obj.number.value == '' || obj.month.selectedValue == '' || obj.month.selectedValue == 0 || obj.year.selectedValue == '' || obj.year.selectedValue == 0 || obj.code.value == '')) {
		alert(error);
		obj.number.focus();
		return false;
	} else {

		return true;
	}
}

function confirmDecline() 
{
	if (confirm('Are you sure you want to decline these terms?')) 
		location = 'http://www.majesticpeaktrading.com';
} 
function checkCountry(ctry) 
{
	
	if(ctry != '223') document.getElementById('state_id').disabled = 'disabled';
	else document.getElementById('state_id').disabled = '';
}
