
function chose_utype(utype){
	if (utype == 'professional'){
		$('#employer_form').hide();
		$('#professional_form').show();
	}else if (utype == 'employer'){
		$('#professional_form').hide();
		$('#employer_form').show();
	}	
}

function change_us_states(o,name){
	if (o.value == "US"){
		$("#state_field").hide().removeAttr("name");
		$("#state_dropdown").show().attr("name",name);
		
		
	}else{
		$("#state_dropdown").hide().removeAttr("name");
		$("#state_field").show().attr("name",name);
	}
}

function to_currency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-')  + num + '.' + cents);
}

function only_currency(evt){
	 var key;
	 if(window.event) // IE
	 {
	  key = evt.keyCode;
	 }
	  else if(evt.which) // Netscape/Firefox/Opera
	 {
	  key = evt.which;
	 }
	
//return (key <= 13 || (key >= 48 && key <= 57) || key == 46);
//return (key <= 13 || (key >= 48 && key <= 57) || key == 46 || key == 44);
return (key <= 13 || (key >= 48 && key <= 57) || key == undefined || key == 46 || key == 44);
}

function only_numbers(evt){
		 var key;
		 if(window.event) // IE
		 {
		  key = evt.keyCode;
		 }
		  else if(evt.which) // Netscape/Firefox/Opera
		 {
		  key = evt.which;
		 }

	//return (key <= 13 || (key >= 48 && key <= 57) || key == 46);
	//return (key <= 13 || (key >= 48 && key <= 57) || key == 46 || key == 44);
	return (key <= 13 || (key >= 48 && key <= 57) || key == undefined);

}


/*********************************************************************************************/
// FOR SIGN UP

var cur_step = '1';
function next() {
	switch (cur_step) {
		case '1':
			goto_step('2');
			break;
		case '2':
			goto_step('3');
			break;
		default:
			goto_step('1');
	}
}

function goto_step(step) {
	
	if (!document.getElementById('read_privacy').checked) {
		alert('Please, confirm you have read and you accepted the terms of services and privacy policy before continuing.');
		document.getElementById('read_privacy').focus();
		return false;
	}
	
	$('#_step'+cur_step).hide();
	
	$('#_step'+step).fadeIn();
	
	$('#step_'+cur_step+'_menu').removeClass('step_'+cur_step);
	$('#step_'+cur_step+'_menu').addClass('step_'+cur_step+'_off');
	
	$('#step_'+step+'_menu').removeClass('step_'+step+'_off');
	$('#step_'+step+'_menu').addClass('step_'+step);
	
	cur_step = step;
	add_rte();

	return false;
}

function set_ptype(ptype) {
	$('#opt_'+ptype).attr("checked", true);
	switch(ptype) {
		case 'professional':
			$('.step_employer').hide();
			$('.step_professional').fadeIn();
			break;
		case 'employer':
			$('.step_employer').fadeIn();
			$('.step_professional').hide();
			break;
	}
}

function signup() {
	if (signup_confirm()) {
		document.getElementById('form_signup').submit();
	}
}

function signup_confirm(form) {
	//alert('signup_confirm');
	//if (!confirm('You are about to submit this registration form. Do you want to continue?'))
	//	return false;
	//else {
		if (!document.getElementById('read_privacy').checked) {
			alert('Please, confirm you have read and you accepted the terms of services and privacy policy before continuing.');
			//goto_step('1');
			document.getElementById('read_privacy').focus();
			return false;
		}
		else {
			return true;
		}
	//}
}

function skip() {
	document.getElementById('extend').value = 'no';
	signup();
}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num + '.' + cents);
}

function add_rte(){
//	$('.rte-zone').rte('rte.css', '/gfx/rte/');
}

function window_opener(direccion, pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, izquierda, arriba, sustituir){
     var opciones = "fullscreen=" + pantallacompleta +
                 ",toolbar=" + herramientas +
                 ",location=" + direcciones +
                 ",status=" + estado +
                 ",menubar=" + barramenu +
                 ",scrollbars=" + barrascroll +
                 ",resizable=" + cambiatamano +
                 ",width=" + ancho +
                 ",height=" + alto +
                 ",left=" + izquierda +
                 ",top=" + arriba;
     var ventana = window.open(direccion,"venta",opciones,sustituir);

}

 $(document).ready(function(){
    $(".select_2").change(function () {
          var str = "";
          $("select option:selected").each(function () {
                str += $(this).val() + " ";
              });
          if(str != " "){
           		location.href = str;	
          }
        })
		
  });
  
$(document).ready(function(){
	$("#currentcontent").click(function () {
		 $("#currentprofile").show();
		 $("#newprofile").hide();
		 $("#currentcontent").addClass("active");
		 $("#newcontent").removeClass("active");
	})
	
	$("#newcontent").click(function () {
		 $("#newprofile").show();
		 $("#currentprofile").hide();
		 $("#currentcontent").removeClass("active");
		 $("#newcontent").addClass("active");
	})
})

