// JS Document

var bEnd = 0;
function increaseIt(sta) {
	$('.perc').html(sta+'%')	
	if (sta < bEnd) {
		sta++;
		setTimeout('increaseIt('+sta+')', 50);
	}
}

function checkProfComplete(msg) {
	$('#pools').html(msg.substr(7,msg.length));
	$('.skip').click(function() {
		
		var num = Number($(this).html());
		$(this).parent().parent().parent().parent().hide(1000, function() {
    		$(this).remove();
  		});
  		var sta = Number($('.perc').html().substr(0,($('.perc').html().length-1)));
  		bEnd = (sta+num);
  		$.ajax({
    	    type: "POST",
    	    url: "/classes/Profile.php",
    	    data: "call=skip&id="+escape(this.id),
    	    success: function(msg){
    	    	if (msg == 'PROFILE_COMPLETED') {
        			location = '/manager';
        		} else {
	    	    	increaseIt(sta);
    	    	}
    	    }
    	});
  		
	});
	$('.imgBlock').click(function() {
		
		//alert(this.id)
		
		switch(this.id) {
			
			case 'createUser':
				location = '/settings';
				break;
				
			case 'billingInfo':
				location = '/settings#billing';
				break;
				
			case 'shippingInfo':
				location = '/settings#shipping';
				break;
				
			case 'verifyEmail':
				location = 'settings&verifyEmail=true';
				break;
			
			case 'myPrivacy':
			case 'standardInfo':
				location = '/info-privacy';
				break;
			
			case 'checkCredits':
				location = '/credits';
				break;
				
			case 'uploadAvatar':
				location = '/avatar';
				break;
				
			case 'addressBook':
				location = '/addressbook';
				break;
				
			case 'securityAnswers':
				location = '/security-answers';
				break;
				
			case 'socialNet':
				location = '/social';
				break;
		}
	});
}
