function AgregarAlCarro(){
	document.forms['ComprarProductosForm'].submit();
}

function MarcarSeleccion(id,periodo){
	ResetearSeleccion();
	setClass(xGetElementById('wh_plan_head_'+id),'wh_plan_head_selected');
	setClass(xGetElementById('wh_plan_content_'+id),'wh_plan_content_selected');
	if(xGetElementById('wh_masvendido_td_'+id)){
		if(xGetElementById('wh_masvendido_td_'+id).className == 'wh_masvendido_td_0'){
			setClass(xGetElementById('wh_masvendido_td_'+id),'wh_masvendido_td_1');
		}
	}
	setClass(xGetElementById('wh_periodo_tr_'+id+'--'+periodo),'wh_periodo_tr_selected');
	show('bt_comprarhosting_container_'+id);
}

function ResetearSeleccionInicial(){
	ResetearSeleccion();
	var obj_Radio = document.getElementsByName('wh_periodo'); var i; var Datos=''; var Datos2='';
	for (i=0;i<obj_Radio.length;i++){
		if(obj_Radio[i].checked){ obj_Radio[i].checked = false; }
	}
}

function ResetearSeleccion(){
	var obj_Radio = document.getElementsByName('wh_periodo'); var i; var Datos=''; var Datos2='';
	for (i=0;i<obj_Radio.length;i++){
		Datos = obj_Radio[i].id;
		Datos = Datos.substring(15);
		Datos2 = Datos.split("--");
		if(xGetElementById('bt_comprarhosting_container_'+Datos2[0]).style.display!="none"){
			hide('bt_comprarhosting_container_'+Datos2[0]);
		}
		if(xGetElementById('wh_plan_head_'+Datos2[0]).className == 'wh_plan_head_selected'){
			setClass(xGetElementById('wh_plan_head_'+Datos2[0]),'wh_plan_head');
		}
		if(xGetElementById('wh_periodo_tr_'+Datos).className == 'wh_periodo_tr_selected'){
			setClass(xGetElementById('wh_periodo_tr_'+Datos),'wh_periodo_tr');
		}
		if(xGetElementById('wh_masvendido_td_'+Datos2[0])){
			if(xGetElementById('wh_masvendido_td_'+Datos2[0]).className == 'wh_masvendido_td_1'){
				setClass(xGetElementById('wh_masvendido_td_'+Datos2[0]),'wh_masvendido_td_0');
			}
		}
		if(xGetElementById('wh_plan_content_'+Datos2[0]).className == 'wh_plan_content_selected'){
			setClass(xGetElementById('wh_plan_content_'+Datos2[0]),'wh_plan_content');
		}
	}
}


function esTeclaValida(k) {
	if((k == 8) || (k == 9) || ((k > 34) && (k < 40)) || (k == 46) || ((k >= 48) && (k <= 57)) || ((k >= 96) && (k <= 105))){
		return true;
	}else{
		return false;
	}
}

function GetPeriodoSelected(){
	var LaCant = xGetElementById('cantidad');
	if(LaCant.value != ''){
		var obj_Radio = document.getElementsByName('wh_periodo'); var i; var ObjSelected='';
		for (i=0;i<obj_Radio.length;i++){
			if(obj_Radio[i].checked){ ObjSelected=obj_Radio[i]; }
		}
		if(ObjSelected != ''){ ObjSelected.click(); }
	}
	return false;
}

function SalidaCant(){
	getCantidadCuentas();
	GetPeriodoSelected();
}

function getCantidadCuentas() {
	var LaCant = xGetElementById('cantidad');
	var Cantidad = String(parseInt(LaCant.value));
	if(LaCant.value == '' || LaCant.value == 0){
		LaCant.value = 1;
	}else{
		if(LaCant.value != Cantidad){
			LaCant.value = Cantidad;
		}
	}
	return Number(LaCant.value);
}