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');
		}
	}
}

//Manejo de camparativos de planes
var AllPlans = new Array('plan_negocio','plan_compania');

function ShowPlan(id_plan){
	var PlataformaCompare = ((xGetElementById('PlataformaHosting').value).toLowerCase()).charAt(0);
	xGetElementById('compara_'+PlataformaCompare+'_'+id_plan).style.display=visible;
}

function ShowPlanPlat(id_plan){
	xGetElementById('compara_'+id_plan).style.display=visible;
}

function HidePlan(id_plan){
	var PlataformaCompare = ((xGetElementById('PlataformaHosting').value).toLowerCase()).charAt(0);
	hide('compara_'+PlataformaCompare+'_'+id_plan);
}

function HidePlanPlat(id_plan){
	hide('compara_'+id_plan);
}

function ShowAllPlans(){ //Llamada desde afuera
 var i;
	for (i=0;i<AllPlans.length;i++){
		ShowPlan(AllPlans[i]);
	}
}

function ShowAllPlansPlat(Plat){
 var i;
	for (i=0;i<AllPlans.length;i++){
		ShowPlanPlat(Plat+'_'+AllPlans[i]);
	}
}

function HideAllPlans(){ //Llamada desde afuera
	var i;
	for (i=0;i<AllPlans.length;i++){
		HidePlan(AllPlans[i]);
	}
}

function ComparePlans(){ //Llamada desde afuera
	HideAllPlans();
	var formCbx = document.forms['ComprarProductosForm'];
	var cuenta = 0;
	var i;
	for (i=0; i<formCbx.length; i++) {
		if((formCbx.elements[i].type == 'checkbox') && (formCbx.elements[i].checked == true) && ((formCbx.elements[i].id).indexOf('comparar_', 0) != -1)){
			cuenta = cuenta + 1;
		}
	}
	if(cuenta > 0){
		for (i=0; i<formCbx.length; i++) {
			if((formCbx.elements[i].type == 'checkbox') && (formCbx.elements[i].checked == true) && ((formCbx.elements[i].id).indexOf('comparar_', 0) != -1)){
				ShowPlan(formCbx.elements[i].value);
			}
		}
		return true;
	}else{
		alert('Debe seleccionar los planes que desea comparar...');
		return false;
	}
}